qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
349,366
<p>I've notice an issue - it feels like a bug but I suspect a 'feature' - in SSMS in SQL Server 2008.</p> <p>I have various tabs open, for example an alter table script in one table and a SProc that queries that table in another tab, and when I execute my Alter Table script the changes are not reflected in Intellisense in the other tab.</p> <p>I can create new queries and the changes are still not reflected in Intellisense. If I open a new SSMS instance, the changes are reflected, until I make further changes, of course.</p> <p>However, if you over-rule Intellisense and push ahead with your modified tables and code, everything compiles without a grumble (as expected).</p> <p>Is this a bug? A feature? Is there a setting somewhere that alters this behaviour? I checked in the options but couldn't see anything</p>
[ { "answer_id": 1840118, "author": "Gabriel Guimarães", "author_id": 181969, "author_profile": "https://Stackoverflow.com/users/181969", "pm_score": 6, "selected": false, "text": "CTRL" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6898/" ]
349,369
<p>I want to send some strings in a list in a POST call. eg:</p> <pre><code> www.example.com/?post_data = A list of strings </code></pre> <p>The python code receives the data as a single string (Instead of a list of strings). How do I post it as a list of strings?</p>
[ { "answer_id": 349389, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "post_data= \",\".join( list_of_strings )\n" }, { "answer_id": 349776, "author": "Philippe F", "author_id": ...
2008/12/08
[ "https://Stackoverflow.com/questions/349369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2220518/" ]
349,375
<p>When it comes to putting the <strong>submit and reset buttons</strong> on your forms, <strong>what order do you use?</strong></p> <pre><code>[SUBMIT] [RESET] </code></pre> <p>or</p> <pre><code>[RESET] [SUBMIT] </code></pre> <p>This issue has come up countless times at work...</p> <p>So, in your opinion, which is the most usable for online users?</p> <p>I personally favor the latter, but some people tend to think otherwise.</p>
[ { "answer_id": 349423, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 0, "selected": false, "text": "confirm" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44084/" ]
349,383
<p>How is it possible to check if MOSS Standard or MOSS Enterprise is installed?</p>
[ { "answer_id": 456821, "author": "dahlbyk", "author_id": 54249, "author_profile": "https://Stackoverflow.com/users/54249", "pm_score": 2, "selected": false, "text": "SPFarm.Local.FeatureDefinitions" }, { "answer_id": 12693374, "author": "Still Learning", "author_id": 1694...
2008/12/08
[ "https://Stackoverflow.com/questions/349383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41291/" ]
349,387
<p>I am testing a couple of workflows for their workflow history cleanup time intervals. The workflow History needs to be retained for a specific number of days. I have implemented the solutions recommended <a href="http://mdablog.spaces.live.com/Blog/cns!B0C40902E1212960!796.entry" rel="nofollow noreferrer">here</a> </p> <p>My problem is that, now I need to test my code to see if the workflow history is getting cleaned up after the exact number of days. </p> <p>I came to know that the workflow history is cleanep up by a timer job called "Workflow Auto Cleanup" which runs daily.</p> <p>But in my case, the workflow History cleanup does not seem to run, because, in "Central Administration > Operations > Timer Job Definitions > Edit Timer Job" , the last run time is shown as "N\A"</p> <p>Is there anything I am missing here? What should I do to make this timer job run properly?</p> <p>Update: Checking the SharePoint logs gives this message: "Upgrade job definition already exists, waiting for the existing upgrade to complete"</p>
[ { "answer_id": 456821, "author": "dahlbyk", "author_id": 54249, "author_profile": "https://Stackoverflow.com/users/54249", "pm_score": 2, "selected": false, "text": "SPFarm.Local.FeatureDefinitions" }, { "answer_id": 12693374, "author": "Still Learning", "author_id": 1694...
2008/12/08
[ "https://Stackoverflow.com/questions/349387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1909/" ]
349,398
<p>Where can you get information on the ASP.NET State Service e.g. how it works, performance, behaviour characteristics etc. Have looked on internet but cant find in depth information or an article dedicated to the subject. Thanks</p>
[ { "answer_id": 349578, "author": "JSC", "author_id": 37311, "author_profile": "https://Stackoverflow.com/users/37311", "pm_score": 0, "selected": false, "text": "Session[\"Key\"]" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,410
<p>I have a registry value which is stored as a binary value (REG_BINARY) holding information about a filepath. The value is read out into an byte array. But how can I transform it into a readable string?</p> <p>I have read about system.text.encoding.ASCII.GetString(value) but this does not work. As far as I got to know the registry value is arbitrary binary data and not ASCII which is the reason for the method to produce useless data.</p> <p>Does anybody know how I can convert the data? </p> <p>Sample: (A piece of the entry)</p> <pre><code>01 00 00 00 94 00 00 00 14 00 00 00 63 00 3A 00 5C 00 70 00 72 00 6F 00 67 00 72 00 61 00 6D 00 6d 00 65 00 5C 00 67 00 65 00 6D 00 65 00 69 00 6E 00 73 00 61 00 6D 00 65 00 20 00 64 00 61 00 74 00 65 00 69 00 65 00 6E 00 5C </code></pre> <p>Due to the regedit this is supposed to be:</p> <pre><code>............c.:.\.p.r.o.g.r.a.m.m.e.\.g.e.m.e.i.n.s.a.m.e. .d.a.t.e.i.e.n.\ </code></pre> <p>The entry itself was created from Outlook. It's an entry for an disabled addin item (resiliency)</p>
[ { "answer_id": 349428, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "Encoding.Unicode.GetString(value)" }, { "answer_id": 349486, "author": "abatishchev", "author_id": 41956,...
2008/12/08
[ "https://Stackoverflow.com/questions/349410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25428/" ]
349,442
<p>I have a class with two methods defined in it.</p> <pre><code>public class Routines { public static method1() { /* set of statements */ } public static method2() { /* another set of statements.*/ } } </code></pre> <p>Now I need to call method1() from method2()</p> <p>Which one the following approaches is better? Or is this qualify as a question?</p> <pre><code>public static method2() { method1(); } </code></pre> <p>OR</p> <pre><code>public static method2() { Routines.method1(); } </code></pre>
[ { "answer_id": 349484, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "Routines.method1()" }, { "answer_id": 349511, "author": "Yuval Adam", "author_id": 24545, "author_pr...
2008/12/08
[ "https://Stackoverflow.com/questions/349442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40614/" ]
349,446
<p>I am given a problem where I have been given N nodes in a graph that are interconnected to each other then given a matrix which lists down a node being connected to another (1 if it is, 0 if not). I am wondering how to best approach this problem. I think these are adjacency matrix? But how would I implement that ...</p> <p>Basically what I am trying to get out of these is find whether a particular node is connected to all other nodes in a given set 'S'. And whether selected items are clique or not...</p> <p>I'd appreciate any hints.</p>
[ { "answer_id": 349493, "author": "Piotr Lesnicki", "author_id": 38796, "author_profile": "https://Stackoverflow.com/users/38796", "pm_score": 2, "selected": false, "text": "M" }, { "answer_id": 349646, "author": "James", "author_id": 41039, "author_profile": "https://...
2008/12/08
[ "https://Stackoverflow.com/questions/349446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44286/" ]
349,459
<p>Say I have a table called "xml" that stores XML files in a single column "data". How would I write a MySQL query that run an XPath and return only rows matching that XPath?</p>
[ { "answer_id": 350180, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 4, "selected": true, "text": "SELECT * FROM xml\nWHERE EXTRACTVALUE(data, '<xpath-expr>') != '';\n" }, { "answer_id": 350226, "author": "...
2008/12/08
[ "https://Stackoverflow.com/questions/349459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
349,460
<p>I have this code:</p> <pre><code>SELECT idcallhistory3, callid, starttime, answertime, endtime, duration, is_answ, is_fail, is_compl, is_fromoutside, mediatype, from_no, to_no, callerid, dialednumber, lastcallerid, lastdialednumber, group_no, line_no FROM "public".callhistory3 WHERE (starttime &gt;= ?) AND (endtime &lt;= ?) AND (is_fromoutside = ?) AND (from_no = ?) AND (to_no = ?) </code></pre> <p>The problem is I need to pass one value for ? and get all the result without filter, some thing like *</p> <p>Any help?</p>
[ { "answer_id": 349473, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "WHERE (? IS NULL OR starttime >= ?)\n" }, { "answer_id": 349481, "author": "Community", "author_id": -1,...
2008/12/08
[ "https://Stackoverflow.com/questions/349460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,513
<p>I'm looking for a way to easily load test and benchmark some of our SQL (using ADO.NET, nothing fancy using LINQ or PLINQ) that has to be performant when running under high parallel load.</p> <p>I've thought of using the new parallel extensions CTP and specifically <code>Parallel.For</code> / <code>Parallel.ForEach</code> to simply run the SQL over 10k iterations or so - but I've not been able to find any data on what these have been optimized for.</p> <p>Essentially I'm worried that because database access is inherently I/O bound, it won't create sufficient load. Does anyone know if Parallel. For is intelligent enough to use > x threads (where x = # of CPUs) if the tasks it is executing are not totally CPU bound? I.e. does it behave in a similar manner to the managed thread pool?</p> <p>Would be rather cool if it was so!</p> <p><b>EDIT: As @CVertex has kindly referred to below, you can set the number of threads independently. Does anyone know if the parallel libraries by default are intelligent enough to keep adding threads if a job is I/O bound?</b></p>
[ { "answer_id": 349617, "author": "Mauricio Scheffer", "author_id": 21239, "author_profile": "https://Stackoverflow.com/users/21239", "pm_score": 0, "selected": false, "text": "PLINQ_DOP\nDOP stands for degree of parallelism. Setting this environment variable defines the number of threads...
2008/12/08
[ "https://Stackoverflow.com/questions/349513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5777/" ]
349,520
<p>Is there any built-in utility or helper to parse <code>HttpContext.Current.User.Identity.Name</code>, e.g. <code>domain\user</code> to get separately domain name if exists and user?</p> <p>Or is there any other class to do so?</p> <p>I understand that it's very easy to call <code>String.Split("\")</code> but just interesting</p>
[ { "answer_id": 349654, "author": "Ian G", "author_id": 31765, "author_profile": "https://Stackoverflow.com/users/31765", "pm_score": 2, "selected": false, "text": "public static string GetDomain(string s)\n{\n int stop = s.IndexOf(\"\\\\\");\n return (stop > -1) ? s.Substring(0, st...
2008/12/08
[ "https://Stackoverflow.com/questions/349520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41956/" ]
349,524
<p>In my SQL Server backend for my app, I want to create history tables for a bunch of my key tables, which will track a history of changes to the rows.</p> <p>My entire application uses Stored Procedures, there is no embedded SQL. The only connection to the database to modify these tables will be through the application and the SP interface. Traditionally, shops I've worked with have performed this task using triggers.</p> <p>If I have a choice between Stored Procedures and Triggers, which is better? Which is faster?</p>
[ { "answer_id": 363757, "author": "Ian Boyd", "author_id": 12597, "author_profile": "https://Stackoverflow.com/users/12597", "pm_score": 6, "selected": true, "text": "CREATE TABLE [AuditLog] (\n [AuditLogID] [int] IDENTITY (1, 1) NOT NULL ,\n [ChangeDate] [datetime] NOT NULL CONSTRA...
2008/12/08
[ "https://Stackoverflow.com/questions/349524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24126/" ]
349,536
<p>I've got a potentially rather large list of objects I'd like to bind to a ListBox in WPF. However, I'd like to have the List load itself incrementally. How can I bind a ListBox to an IEnumerable that loads itself on-demand in such a way that the listbox only tries to enumerate as much as it needs for the display?</p>
[ { "answer_id": 349947, "author": "Cameron MacFarland", "author_id": 3820, "author_profile": "https://Stackoverflow.com/users/3820", "pm_score": 3, "selected": true, "text": "<ListBox \n VirtualizingStackPanel.IsVirtualizing=\"True\"\n ItemSource=\"...\"\n />\n" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3279/" ]
349,540
<p>Is there a way to sniff SQL queries sent to a SQL Server db on any level (above transport level)? Perhaps there's some kind of a tracer in ASP.NET or built-in log in SQL Server ? </p>
[ { "answer_id": 349585, "author": "Dave Harding", "author_id": 42697, "author_profile": "https://Stackoverflow.com/users/42697", "pm_score": 2, "selected": false, "text": "select db_id()\n" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,544
<p>There is <code>ConnectionManager</code> which waits for incoming connections. For each incoming connection it creates a <code>Connection</code> instance which handles the inbound and outbound traffic on this connection. Each <code>Connection</code> has a <code>Watchdog</code> which handles "bad connection" conditions and calls registered "Listerners". One "Listener" is the <code>ConnectionManager</code> which closes the connection and deletes the <code>Connection</code> instance which in turn deletes the corresponding Watchdog.</p> <p>Wait. A. Minute.</p> <p>The <code>Watchdog</code> calls the <code>ConnectionManager</code> which deletes the <code>Connection</code> which deletes the <code>Watchdog</code>? The Watchdog chases its own tail.</p> <p>I am completly blocked. How do I resolve this?</p> <hr> <p><strong>Solution</strong>: I will make the Listener thingy asynchronous, altough I don't know yet how to do that without too much pain. The <code>Watchdog</code> doesn't know about the <code>ConnectionManager</code>. It is fairly generic. Also the Win32-Thread-API doesn't have something like "join", so I might need to roll my own with <code>GetExitCodeThread()</code> and <code>STILL_ACTIVE</code>...</p> <p>Thanks, guys.</p>
[ { "answer_id": 349567, "author": "Skizz", "author_id": 1898, "author_profile": "https://Stackoverflow.com/users/1898", "pm_score": 2, "selected": false, "text": "ConnectionManager" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8976/" ]
349,559
<p>I have a database with two main tables <code>notes</code> and <code>labels</code>. They have a many-to-many relationship (similar to how stackoverflow.com has questions with labels). What I am wondering is how can I search for a note using multiple labels using SQL? </p> <p>For example if I have a note "test" with three labels "one", "two", and "three" and I have a second note "test2" with labels "one" and "two" what is the SQL query that will find all the notes that are associated with labels "one" and "two"?</p>
[ { "answer_id": 349570, "author": "Kev", "author_id": 16777, "author_profile": "https://Stackoverflow.com/users/16777", "pm_score": 1, "selected": false, "text": "select * from notes a\ninner join notes_labels mm on (mm.note = a.id and mm.labeltext in ('one', 'two') )\n" }, { "ans...
2008/12/08
[ "https://Stackoverflow.com/questions/349559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004/" ]
349,576
<p>On Linux, how can I (programmatically) retrieve the following counters <em>on a per-interface basis</em>:</p> <ul> <li>Sent/received ethernet frames,</li> <li>Sent/received IPv4 packets,</li> <li>Sent/received IPv6 packets.</li> </ul>
[ { "answer_id": 349623, "author": "xahtep", "author_id": 42184, "author_profile": "https://Stackoverflow.com/users/42184", "pm_score": 4, "selected": true, "text": "iptables" }, { "answer_id": 349629, "author": "unwind", "author_id": 28169, "author_profile": "https://S...
2008/12/08
[ "https://Stackoverflow.com/questions/349576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21435/" ]
349,597
<p>Is anyone aware of a good resource <strong><em>online</em></strong> for detailed information on the use of ole excel objects(embeded workbooks, worksheets, etc...) in VB6? I'm maintaining an application that makes heavy use of these conrols and I'm having a lot of trouble getting them to work properly for the user's of this program. The scattered bits of Q&amp;A I can find online related to ole excel controls is very limited and not very definitive. Obviously, I have read through what there is on MSDN but I'm not finding it very helpful so I would like to find another good source of reference.</p> <p>Thanks</p>
[ { "answer_id": 381896, "author": "JeffK", "author_id": 5420, "author_profile": "https://Stackoverflow.com/users/5420", "pm_score": 3, "selected": true, "text": "' Start a new workbook in Excel '\n\nDim oExcel As Excel.Application\nDim oBook As Excel.Workbook\n\n' Launch an instance of Mi...
2008/12/08
[ "https://Stackoverflow.com/questions/349597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10007/" ]
349,603
<p>I wanted to start with the use of Remoting under C# in a testdriven way, but I got stuck.</p> <p>One thing I found on the topic is this <a href="http://www.codeproject.com/KB/architecture/TddRemoting.aspx" rel="nofollow noreferrer">article by Marc Clifton</a>, but he seems to have the server running by starting it manually from the console.</p> <p>I try to have the server started (i.e. register the serving class) in the test fixture. I probably also have the usage of the interface wrong, but that will come later.</p> <p>I always get an Exception (sorry for the german message) that the channel is registered already. System.Runtime.Remoting.RemotingException : Der Channel tcp wurde bereits registriert.</p> <p>After commenting out the ChannelServices.RegisterChannell() line in the test method, it occurs for the call Activator.GetObject().</p> <p>I tried to put the StartServer() into a thread, but that did not help either. I found that creating a new AppDomain might be a possible way, but have not tried yet.</p> <p>Can you tell me, if my approach is inherently wrong? How can I fix it?</p> <pre><code>using System; using NUnit.Framework; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; namespace Bla.Tests.Remote { [TestFixture] public class VerySimpleProxyTest { int port = 8082; string proxyUri = "MyRemoteProxy"; string host = "localhost"; IChannel channel; [SetUp] public void SetUp() { StartServer(); } [TearDown] public void TearDown() { StopServer(); } [Test] public void UseRemoteService() { //IChannel clientChannel = new TcpClientChannel(); //ChannelServices.RegisterChannel(clientChannel, false); string uri = String.Format("tcp://{0}:{1}/{2}", host, port, proxyUri); IMyTestService remoteService = (IMyTestService)Activator.GetObject(typeof(IMyTestService), uri); Assert.IsTrue(remoteService.Ping()); //ChannelServices.UnregisterChannel(clientChannel); } private void StartServer() { channel = new TcpServerChannel(port); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyTestService), proxyUri, WellKnownObjectMode.Singleton); } private void StopServer() { ChannelServices.UnregisterChannel(channel); } } public interface IMyTestService { bool Ping(); } public class MyTestService : MarshalByRefObject, IMyTestService { public bool Ping() { return true; } } } </code></pre>
[ { "answer_id": 656400, "author": "Bas Bossink", "author_id": 74198, "author_profile": "https://Stackoverflow.com/users/74198", "pm_score": 1, "selected": false, "text": "ChannelServices.RegisterChannel" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32679/" ]
349,612
<pre><code>$(document).ready(function() { $("span.link").mouseover(function(e){ $(this.children).css("display","inline"); }); }); </code></pre> <p>I'm not a javascript expert, but I've cobbled together a few functions using jQuery. </p> <p>In this case, the stylesheet hides some controls. When the user mouses over, this function exposes those controls. </p> <p>This works on every browser but Firefox (on the Mac and Windows). Am I missing something obvious? </p> <p>Thanks for your help,</p> <p>Jason</p>
[ { "answer_id": 349627, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 4, "selected": true, "text": "$(function() {\n $(\"span.link\").mouseover(function(e){\n $(this).children().css(\"display\",\"inline\"); ...
2008/12/08
[ "https://Stackoverflow.com/questions/349612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10461/" ]
349,613
<p>Hopefully an easy question, but I'd quite like a technical answer to this!</p> <p>What's the difference between:</p> <pre><code>i = 4 </code></pre> <p>and</p> <pre><code>Set i = 4 </code></pre> <p>in VBA? I know that the latter will throw an error, but I don't fully understand why.</p>
[ { "answer_id": 349624, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 6, "selected": false, "text": "Set" }, { "answer_id": 349636, "author": "Treb", "author_id": 22114, "author_profile": "https://Stacko...
2008/12/08
[ "https://Stackoverflow.com/questions/349613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4019/" ]
349,614
<p>i have the following javascript code:</p> <p><a href="http://www.nomorepasting.com/getpaste.php?pasteid=22561" rel="nofollow noreferrer">http://www.nomorepasting.com/getpaste.php?pasteid=22561</a></p> <p>Which works fine(the makewindows function has been changed to show it is a php variable), however the html contains unicode characters, and will only be assigned characters leading up to the first unicode character. If I make a small test file and echo out article_desc directly, all the html is output, although quetsions marks are displayed instead of the correct symbols. However json_encode seems to cut short the html, resulting in errors. </p> <p>edit: here is a dump straight from the mysql database of the html I am trying to display: </p> <p><a href="http://www.yousendit.com/download/TTZueEVYQzMrV3hMWEE9PQ" rel="nofollow noreferrer">http://www.yousendit.com/download/TTZueEVYQzMrV3hMWEE9PQ</a> </p> <p>it says utf-8 in the source. the actual page code generated from echoing out article_desc is here: </p> <p><a href="http://www.nomorepasting.com/getpaste.php?pasteid=22566" rel="nofollow noreferrer">http://www.nomorepasting.com/getpaste.php?pasteid=22566</a> </p> <p>it is definitely the same record, so I am unsure why it seems to very different.</p> <p>edit: this was fixed by calling: mysql_query('SET NAMES utf8'); </p>
[ { "answer_id": 350797, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 2, "selected": false, "text": "json_encode" }, { "answer_id": 459118, "author": "Community", "author_id": -1, "author_profile": "htt...
2008/12/08
[ "https://Stackoverflow.com/questions/349614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
349,626
<p>I want to get virtual path of a web page from a web service. Is there any way to do this?. suppose i have an aspx page like aa, i want to get full path as a url for that page from my web service.</p> <p>Regards, Harsh Suman</p>
[ { "answer_id": 349662, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "HttpContext.Current" }, { "answer_id": 349871, "author": "Ron Todosichuk", "author_id": 43294, "a...
2008/12/08
[ "https://Stackoverflow.com/questions/349626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,652
<p>I'm getting a strange effect in Jena 2.5.5 (on Linux) where I am playing around with the inference API. The following code is a stripped down version. I am creating an initially empty Model and a generic rule reasoner. I add a reflexivity rule for a certain statement. I attach the reasoner to the model to get an InfModel. Then I create the matching statement and add it to the Model. </p> <p>Result: InfModel contains both the statement and its reverse. So far so good, that's what it's supposed to do.</p> <p>Now, when I <code>System.out.println()</code> the InfModel prior to adding the matching statement to Model, the result is completely different: the rule seems not to fire and thus, InfModel will end up not containing the reverse of the original statement.</p> <p>How does writing the model to the console change the functionality of the code? Is this behavior documented?</p> <pre><code>import java.util.*; import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.reasoner.rulesys.*; /** * Describe class &lt;code&gt;RuleTest&lt;/code&gt; here. */ public class RuleTest { public static void main(String[] args) throws Exception { /* create model */ Model model = ModelFactory.createDefaultModel(); /* output model */ System.out.println("original model : " + model); System.out.println("-----"); /* collect rules */ List&lt;Rule&gt; rules = new ArrayList&lt;Rule&gt;(); Rule rule = Rule.parseRule("[ (subject predicate object) -&gt; (object predicate subject) ]."); rules.add(rule); /* create rule reasoner */ GenericRuleReasoner reasoner = new GenericRuleReasoner(rules); /* attach reasoner to model */ InfModel infModel = ModelFactory.createInfModel(reasoner, model); /* output model */ //-----------------------------------------------// // commenting the following line in/out changes // // the output of (*) below in Jena 2.5.5 ?!?!?! // //-----------------------------------------------// //System.out.println("inference model: " + infModel); System.out.println("====="); /* add facts to original model */ Resource s = model.createResource("subject"); Property p = model.createProperty("predicate"); RDFNode o = model.createResource("object"); Statement stmt = model.createStatement(s, p, o); model.add(stmt); /* output models */ System.out.println("original model : " + model); System.out.println("-----"); System.out.println("inference model: " + infModel); // (*) } } </code></pre>
[ { "answer_id": 18987508, "author": "Joshua Taylor", "author_id": 1281433, "author_profile": "https://Stackoverflow.com/users/1281433", "pm_score": 0, "selected": false, "text": "original model : <ModelCom {} | >\n-----\n=====\noriginal model : <ModelCom {subject @predicate object} | ...
2008/12/08
[ "https://Stackoverflow.com/questions/349652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,653
<p>The following doesn't work, because it doesn't wait until the process is finished:</p> <pre><code>import subprocess p = subprocess.Popen('start /WAIT /B MOZILL~1.LNK', shell=True) p.wait() </code></pre> <p>Any idea how to run a shortcut and wait that the subprocess returns ?</p> <p><strong>Edit:</strong> originally I was trying this without the <strong>shell</strong> option in my post, which caused Popen to fail. In effect, <code>start</code> is not an executable but a shell command. This was fixed thanks to Jim.</p>
[ { "answer_id": 349697, "author": "JimB", "author_id": 32880, "author_profile": "https://Stackoverflow.com/users/32880", "pm_score": 3, "selected": true, "text": "p = subprocess.Popen('start /B MOZILL~1.LNK', shell=True)\np.wait()\n" }, { "answer_id": 349793, "author": "rob", ...
2008/12/08
[ "https://Stackoverflow.com/questions/349653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28165/" ]
349,655
<p>I've created a database in Visual Studio 2008 in an App_Data folder of a MVC Web Application project. This results in an mdf file for the database that can be explored in the Server Explorer tab. You can create a SQL script for changes you do to the database.</p> <p>So I'm wondering how you run these sql change scripts to an mdf-file in Visual Studio 2008? Or am I forced to do this via the SQL Management Studio Express application?</p>
[ { "answer_id": 349670, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 3, "selected": true, "text": "CREATE DATABASE [databaseName]\n" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]
349,657
<p>I have a problem. </p> <p>I'm working on another guy's code and there is a JFrame with lots of JSeparators(he used them as borders for 'panels') now I'm replacing them for a JBorderedPanel class that follows the same border style of the whole application.</p> <p>The problem is that some of his separators are not clear to determine where they are in the code, there are lots of jSeparator#, replace with for any number between 0 and 999.</p> <p>Is there any way to determine which variable correspond to which border other than testing all jSeparators one by one?</p> <p>In before 'Don't replace them!' I'm obligated to replace them. I wouldn't be doing this if I could.</p> <p>Thanks in advance.</p>
[ { "answer_id": 349690, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 1, "selected": false, "text": "MouseListener" }, { "answer_id": 349735, "author": "Diones", "author_id": 2605, "author_profile": "https...
2008/12/08
[ "https://Stackoverflow.com/questions/349657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,659
<h1>Duplicate from : <a href="https://stackoverflow.com/questions/16432/c-string-output-format-or-concat">String output: format or concat in C#?</a></h1> <p>Especially in C# world using String.Format for everything is really common, normally as VB.NET developer unless I have to* I don't String.Format, </p> <p>I prefer normal string concatenation, such as:</p> <pre><code>V1 = V2 &amp; "test-x" &amp; V3 &amp; "-;" </code></pre> <p>to me it's better than this:</p> <pre><code>V1 = String.Format("{0} test-x {1} -;", V2, V3) </code></pre> <p>Am I missing something? Or is this just a personal preference?</p> <p><strong>Reasons to Use String.Format (From The Answers)</strong> (<em>I'll try to keep this up to date</em>)</p> <ul> <li>Localization is so much easier if you use String Format</li> <li>Obviously it's easier to change the format of input</li> <li>It's more readable (<em>however this is personal</em>)</li> <li>Better Performance </li> </ul> <p>**Sometimes I need to change the style or replacing stuff dynamically then I use String.Format*</p>
[ { "answer_id": 349688, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 1, "selected": false, "text": "StringBuilder.AppendLine(string.Format(\"Some text {0}.\", \"here\"));\n" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40322/" ]
349,668
<p>I've recently used our company's spare laptop (that has a general user set up) while mine was being repaired. I've checked the "Remember password" option in SQL Server Management Studio when logging in to the database. </p> <p>I need to clear the login and password information that I have used to prevent the next person that will use the laptop from using my login names and passwords. How can I do this?</p>
[ { "answer_id": 1220687, "author": "Robin Luiten", "author_id": 103491, "author_profile": "https://Stackoverflow.com/users/103491", "pm_score": 9, "selected": false, "text": "C:\\Users\\%username%\\AppData\\Roaming\\Microsoft\\SQL Server Management Studio\\14.0\\SqlStudio.bin" }, { ...
2008/12/08
[ "https://Stackoverflow.com/questions/349668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,702
<p>I'm trying to learn bash string handling. How do I create a bash script which is equivalent to this Java code snippet?</p> <pre><code>String symbols = "abcdefg12345_"; for (char i : symbols.toCharArray()) { for (char j : symbols.toCharArray()) { System.out.println(new StringBuffer().append(i).append(j)); } } </code></pre> <p>The output of the above code snippet starts with:</p> <pre><code>aa ab ac ad ae af </code></pre> <p>And ends with:</p> <pre><code>_g _1 _2 _3 _4 _5 __ </code></pre> <p>My goal is to have a list of allowed characters (not necessarily the ones above) and print out all the permutations of length 2. If it is possible I would like a solution which relies solely on bash and doesn't require anything else installed.</p> <p><strong>Edit:</strong> Just a little follow up question: Is there a way to do this with a string without spaces separating sub-strings? Like LIST="abcdef12345_"?</p>
[ { "answer_id": 349712, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 4, "selected": true, "text": "echo {a,b,c,d,e,f,g,1,2,3,4,5,_}{a,b,c,d,e,f,g,1,2,3,4,5,_}\n" }, { "answer_id": 349716, "author": "Bombe", ...
2008/12/08
[ "https://Stackoverflow.com/questions/349702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,705
<p>As in the subject, how can one get the total width of an element, including its border and padding, using jQuery? I've got the jQuery dimensions plugin, and running <code>.width()</code> on my <code>760px-wide</code>, <code>10px padding</code> DIV returns <code>760</code>.</p> <p>Perhaps I'm doing something wrong, but if my element manifests itself as <code>780 pixels wide</code> and Firebug tells me that there's <code>10px padding</code> on it, but calling <code>.width()</code> only gives 760, I'd be hard pressed to see how.</p> <p>Thanks for any suggestions.</p>
[ { "answer_id": 349719, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 9, "selected": true, "text": "border" }, { "answer_id": 673622, "author": "James", "author_id": 21677, "author_profile": "https...
2008/12/08
[ "https://Stackoverflow.com/questions/349705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
349,724
<p>A recent <a href="https://stackoverflow.com/questions/349659/stringformat-or-not">question came up</a> about using String.Format(). Part of my answer included a suggestion to use StringBuilder.AppendLine(string.Format(...)). Jon Skeet suggested this was a bad example and proposed using a combination of AppendLine and AppendFormat.</p> <p>It occurred to me I've never really settled myself into a "preferred" approach for using these methods. I think I might start using something like the following but am interested to know what other people use as a "best practice":</p> <pre><code>sbuilder.AppendFormat("{0} line", "First").AppendLine(); sbuilder.AppendFormat("{0} line", "Second").AppendLine(); // as opposed to: sbuilder.AppendLine( String.Format( "{0} line", "First")); sbuilder.AppendLine( String.Format( "{0} line", "Second")); </code></pre>
[ { "answer_id": 349736, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "AppendFormat" }, { "answer_id": 349762, "author": "Joel Coehoorn", "author_id": 3043, "author_profile...
2008/12/08
[ "https://Stackoverflow.com/questions/349724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26414/" ]
349,729
<p>I am using <a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getallnetworkinterfaces.aspx" rel="nofollow noreferrer">NetworkInterface.GetAllNetworkInterfaces()</a> to get all the interfaces on a PC. However, this appears to only return "active" interfaces. How can I find "inactive" network interfaces, such as unconnected VPNs, disabled NICs, etc. in .NET. </p> <p>I would like to find them by their name in "Control Panel" -> "Network Connections". So, for example, if I have a VPN called "My Work" I would like to be able to find it using the name "My Work".</p> <p>Using Win32_NetworkAdapterConfiguration does not seem to be an option as it does not return the name shown in "Network Connections" (as far as I can see).</p> <p>Many thanks,</p> <p>RB.</p>
[ { "answer_id": 349766, "author": "Paul Nearney", "author_id": 24071, "author_profile": "https://Stackoverflow.com/users/24071", "pm_score": 1, "selected": false, "text": "using System.Management;\n\nstring query = \"SELECT * FROM Win32_NetworkAdapterConfiguration\";\nManagementObjectSear...
2008/12/08
[ "https://Stackoverflow.com/questions/349729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15393/" ]
349,742
<p>I frequently make use of <code>Request.QueryString[]</code> variables.</p> <p>In my <code>Page_load</code> I often do things like:</p> <pre><code> int id = -1; if (Request.QueryString["id"] != null) { try { id = int.Parse(Request.QueryString["id"]); } catch { // deal with it } } DoSomethingSpectacularNow(id); </code></pre> <p>It all seems a bit clunky and rubbish. How do you deal with your <code>Request.QueryString[]</code>s?</p>
[ { "answer_id": 349748, "author": "VVS", "author_id": 21038, "author_profile": "https://Stackoverflow.com/users/21038", "pm_score": 5, "selected": false, "text": "if (!int.TryParse(Request.QueryString[\"id\"], out id))\n{\n // error case\n}\n" }, { "answer_id": 349749, "autho...
2008/12/08
[ "https://Stackoverflow.com/questions/349742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31765/" ]
349,743
<p>My homepage (or welcome page) will consist of data from two models (lets call them authors and posts). I am new to rails and not sure what is the best way to accomplish this.</p> <p>Should I create a new controller called welcome which gathers data from the authors and posts and then display them in the welcome index view? Or should I have a welcome view under the post model which also gets data from authors? Or any other way to accomplish this?</p> <p>I understand how to do all this technically but just unsure what is the best practice method using the rails framework.</p>
[ { "answer_id": 349800, "author": "Robert K", "author_id": 24950, "author_profile": "https://Stackoverflow.com/users/24950", "pm_score": 7, "selected": true, "text": "Static" }, { "answer_id": 6486205, "author": "irakli", "author_id": 784635, "author_profile": "https:/...
2008/12/08
[ "https://Stackoverflow.com/questions/349743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50718/" ]
349,769
<p>Is it possible to return an XElement from a webservice (in C#/asp.net)?</p> <p>Try a simple web service that returns an XElement:</p> <pre><code>[WebMethod] public XElement DoItXElement() { XElement xe = new XElement("hello", new XElement("message", "Hello World") ); return xe; } </code></pre> <p>This compiles fine but if you try and run it you get </p> <pre>Cannot use wildcards at the top level of a schema.</pre> <p>I found <a href="http://blog.bksanders.com/index.php/tag/linq-to-xml/" rel="nofollow noreferrer">this post implying that this is a bug</a> in .net.</p> <p>So... Can I return an XElement from a web service? If so, how?</p> <p>Thanks.</p>
[ { "answer_id": 40387725, "author": "Abacus", "author_id": 1078031, "author_profile": "https://Stackoverflow.com/users/1078031", "pm_score": 0, "selected": false, "text": "[System.Runtime.CompilerServices.Extension()]\npublic XmlElement ToXmlElement(XElement value)\n{\n var xmlDoc = ne...
2008/12/08
[ "https://Stackoverflow.com/questions/349769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3099/" ]
349,779
<p>I am writing an application which opens USB devices and transfer some data. I am following the UsbSimpleNotificationExample from the Developer Examples. The example adds notifications and assigns callbacks for a unique Vendor ID and Product ID. But for my application I have multiple PIDs and a single VIDs. How can I add a dictionary entry with single Vid and more than one PIDs? If I use CFDictionarySetValue with 2 PIDs, the 2nd Pid call overwrites the first dictionary value. I am not able to match IOServiceAddMatchingNotification callbacks properly due to this. What are the other options I can try? </p>
[ { "answer_id": 22538012, "author": "Chris Marshall", "author_id": 879365, "author_profile": "https://Stackoverflow.com/users/879365", "pm_score": 0, "selected": false, "text": "CFMutableDictionaryRef matchingDict = IOServiceMatching ( kIOUSBDeviceClassName );\nif ( matchingDict )\n{\n ...
2008/12/08
[ "https://Stackoverflow.com/questions/349779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,787
<p>In a software-project written in java you often have resources, that are part of the project and should be included on the classpath. For instance some templates or images, that should be accessible through the classpath (getResource). These files should be included into a produced JAR-file.</p> <p>It's clear that these resources should be added to the revision-control-system. But in which directory you put these files? Parallel to the java-source-files or in another directory that also reproduces the needed package-structure?</p>
[ { "answer_id": 349897, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 2, "selected": false, "text": "project/src\nproject/resources\nproject/classes\nproject/lib\nproject/dist\n" }, { "answer_id": 6644514, "aut...
2008/12/08
[ "https://Stackoverflow.com/questions/349787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21005/" ]
349,802
<p>Is it possible for me to create and destroy a TXMLDocument by myself in Borland C++ Builder? I've tried but borland keeps telling me that TXMLDocument is (and must be) an IDE managed component. </p> <p>Also, the only reason that I want to do this is that TXMLDocument sort of crashes: I get the TXMLDocument and 'Gets' a workbook from it, sets some document properties (the xml is saved as an Excel-file later), and the I add some styles. Ok, then I add a worksheet and then all the cells that I want with proper formatting and then I save it. At this point everything is OK. </p> <p>Then I want to save another Excel-file. Since the IDE doesn't let me delete and recreate the TXMLDocument I try to delete just the worksheet form it. When I try this (in debug mode) the IDE goes in to line step mode in the CPU tab (showing some assembler):</p> <pre><code>ntdll.DbgBreakPoint: 77A07DFE CC int 3 77A07DFF C3 ret </code></pre>
[ { "answer_id": 349857, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 3, "selected": true, "text": "_di_IXMLDocument Doc = NewXMLDocument(); \n" }, { "answer_id": 1427403, "author": "enzo1959", "author_id": 1737...
2008/12/08
[ "https://Stackoverflow.com/questions/349802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079/" ]
349,811
<p>How to arrange a Makefile to compile a kernel module with multiple .c files?</p> <p>Here is my current Makefile. It was auto generated by <a href="http://www.kdevelop.org/" rel="noreferrer">KDevelop</a></p> <pre><code>TARGET = nlb-driver OBJS = nlb-driver.o MDIR = drivers/misc EXTRA_CFLAGS = -DEXPORT_SYMTAB CURRENT = $(shell uname -r) KDIR = /lib/modules/$(CURRENT)/build PWD = $(shell pwd) DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR) obj-m += $(TARGET).o default: make -C $(KDIR) M=$(PWD) modules $(TARGET).o: $(OBJS) $(LD) $(LD_RFLAG) -r -o $@ $(OBJS) ifneq (,$(findstring 2.4.,$(CURRENT))) install: su -c "cp -v $(TARGET).o $(DEST) &amp;&amp; /sbin/depmod -a" else install: su -c "cp -v $(TARGET).ko $(DEST) &amp;&amp; /sbin/depmod -a" endif clean: -rm -f *.o *.ko .*.cmd .*.flags *.mod.c make -C $(KDIR) M=$(PWD) clean -include $(KDIR)/Rules.make </code></pre>
[ { "answer_id": 349973, "author": "ctuffli", "author_id": 26683, "author_profile": "https://Stackoverflow.com/users/26683", "pm_score": 2, "selected": false, "text": "OBJS = nlb-driver.o\nOBJS += file1.o\nOBJS += file2.o\n...\n" }, { "answer_id": 43600027, "author": "Mateusz P...
2008/12/08
[ "https://Stackoverflow.com/questions/349811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
349,822
<p>When using the following function (compare 2 user's group membership), I get results that do not make sense.</p> <pre><code>function Compare-ADUserGroups &lt;br&gt; { #requires -pssnapin Quest.ActiveRoles.ADManagement param ( [string] $FirstUser = $(Throw "logonname required."), [string] $SecondUser = $(Throw "logonname required.") ) $a = (Get-QADUser $FirstUser).MemberOf $b = (Get-QADUser $SecondUser).MemberOf $c = Compare-Object -referenceObject $a -differenceObject $b $c | Sort-Object InputObject } </code></pre> <p>When I call this (Compare-ADUserGroups User1 User2), I get a result set similar to the following:</p> <ul> <li>CN=[All Users],OU=adm,DC=OSUMC,DC=EDU &lt;=</li> <li>CN=[All Users],OU=adm,DC=OSUMC,DC=EDU =></li> <li>CN=Extended Users,OU=MSG,DC=OSUMC,DC=EDU &lt;=</li> <li>CN=Extended Users,OU=MSG,DC=OSUMC,DC=EDU =></li> <li>CN=LCS2005,OU=Distribution Lists,DC=OSUMC,DC=EDU &lt;=</li> <li>CN=LCS2005,OU=Distribution Lists,DC=OSUMC,DC=EDU =></li> </ul> <p>I would expect these to not show given that they are equal and I am not using the -IncludeEqual parameter. Any ideas on why these are showing up?</p>
[ { "answer_id": 34658760, "author": "Alban", "author_id": 1911082, "author_profile": "https://Stackoverflow.com/users/1911082", "pm_score": 1, "selected": false, "text": "#requires -version 2\n<#\n .SYNOPSIS\n Compare les groupe entre 2 users\n .DESCRIPTION\n Affiche s...
2008/12/08
[ "https://Stackoverflow.com/questions/349822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,842
<p>I want to do some functional testing on a (restful) webservice. The testsuite contains a bunch of test cases, each of which performs a couple of HTTP requests on the webservice.</p> <p>Naturally, the webservice has to run or the tests will fail. :-)</p> <p>Starting the webservice takes a couple of minutes (it does some heavy data lifting), so I want to start it as infrequently as possible (at least all test cases that only GET resources from the service could share one).</p> <p>So is there a way to do set up me the bomb in a test suite, before the tests are run like in a @BeforeClass method of a test case?</p>
[ { "answer_id": 349863, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 1, "selected": false, "text": "@BeforeSuite" }, { "answer_id": 352576, "author": "Dan Vinton", "author_id": 21849, "author_profile": "h...
2008/12/08
[ "https://Stackoverflow.com/questions/349842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,845
<p>Environment: Rails 2.2.2, Oracle 10g</p> <p>Most of the columns declared "date" in my ActiveRecord models are exactly that: dates: they don't care about time at all.</p> <p>So with a model declared thus:#</p> <pre><code>class MyDateOnlyModel &lt; ActiveRecord::Migration def self.up create_table :my_date_only_model do |t| t.date :effective_date t.timestamps end end end </code></pre> <p>writing a test like this:</p> <pre><code>test_date = Date.new(2008,12,05) MyDateOnlyModel.create!(:effective_date =&gt; test_date) assert_equal test_date, MyDateOnlyModel.find(:first).effective_date </code></pre> <p>should pass, shouldn't it? (Assuming I didn't mess anything up transcribing the above, of course)</p> <p>But it doesn't - not quite. I get this:</p> <pre><code>&lt;Fri, 05 Dec 2008&gt; expected but was &lt;Fri, 05 Dec 2008 00:00:00 UTC +00:00&gt;. </code></pre> <p>So I put a date into the database and got ... well what <em>did</em> I get?</p> <pre><code>puts MyDateOnlyModel.find(:first).eff_date.class </code></pre> <p>tells me I actually got a <code>ActiveSupport::TimeWithZone</code>. Which wasn't what I wanted at all.</p> <p>Is there a simple way to tell ActiveRecord that some (not all) columns are <code>Date</code>s and only <code>Date</code>s?</p> <p>UPDATE: more complaining...</p> <p>Yes, I could use to_date:</p> <pre><code>assert_equal test_date, MyDateOnlyModel.find(:first).effective_date.to_date </code></pre> <p>works fine. But that's what I'm trying to avoid. I asked AR to make me a date, I want a date back.</p> <p>And I could add a method to my class, effective_date_as_date - that works too. But surely it's not impossible to just get a date, dagnabbit.</p> <p><strong>PRE-ACCEPTANCE UPDATE</strong></p> <p>Eventually I realised why this was a particular problem with Oracle: there is no distinction between DATE and DATETIME, so ActiveRecord can't figure out unaided whether a time of zero means midnight (possibly with time zone corrections) or just the date. Bah. Stupid Oracle. So I'm going to have either to go down the plugin route, change my database (tempting, so very tempting) or continue with the to_date/to_time mess I have at present.</p>
[ { "answer_id": 349863, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 1, "selected": false, "text": "@BeforeSuite" }, { "answer_id": 352576, "author": "Dan Vinton", "author_id": 21849, "author_profile": "h...
2008/12/08
[ "https://Stackoverflow.com/questions/349845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1060/" ]
349,852
<p>I'm extracting an interface that I would like to retain the original name. The actual class will get a "Impl" suffix, in accordance with our naming conventions. I want to know how to best reflect that in subversion so that the history "AppPropertiesImpl.java" covers its life as "AppProperties.java". As for the new "AppProperties.java", I'm thinking it could be either a new file or a copy of the old. Any idea how to pull this off?</p> <p>Here's what I have now:</p> <p>AppProperties.java</p> <pre><code>public class AppProperties { public static final CONSTANT_ONE = "CONSTANT_ONE"; private String propertyOne; public String getPropertyOne() { return propertyOne; } public String setPropertyOne(String propertyOne) { this.propertyOne = propertyOne; } } </code></pre> <p>And I want to end up with:</p> <p>AppProperties.java</p> <pre><code>public interface AppProperties { public static final CONSTANT_ONE = "CONSTANT_ONE"; String getPropertyOne(); String setPropertyOne(String propertyOne); } </code></pre> <p>AppPropertiesImpl.java</p> <pre><code>public class AppPropertiesImpl implements AppProperties { private String propertyOne; public String getPropertyOne() { return propertyOne; } public String setPropertyOne(String propertyOne) { this.propertyOne; } } </code></pre>
[ { "answer_id": 349863, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 1, "selected": false, "text": "@BeforeSuite" }, { "answer_id": 352576, "author": "Dan Vinton", "author_id": 21849, "author_profile": "h...
2008/12/08
[ "https://Stackoverflow.com/questions/349852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
349,855
<p>I want to automate the process of gathering code metrics on a .NET solution. Is there any way of getting msbuild to run the Code Metrics feature included in VS2008 Development Edition? </p> <p>I may end up using <a href="http://www.campwoodsw.com/sourcemonitor.html" rel="noreferrer">SourceMonitor</a>, but I would like to know if there is a way to use the VS code metrics engine from the command line.</p>
[ { "answer_id": 422171, "author": "shackett", "author_id": 52194, "author_profile": "https://Stackoverflow.com/users/52194", "pm_score": 3, "selected": false, "text": "" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7532/" ]
349,858
<p>I'm trying to get a UIDatePicker with a UIButton to show up in a UIActionSheet. Unfortunately it gets cropped off and the entire Date Picker is not visible. I have not even attempted to add the UIButton yet. Can anyone suggest on getting the entire view to fit properly? I'm not sure how to add the proper dimensions as UIActionSheet seems to lack an <code>-initWithFrame:</code> type constructor.</p> <pre><code>UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:nil]; // Add the picker UIDatePicker *pickerView = [[UIDatePicker alloc] init]; pickerView.datePickerMode = UIDatePickerModeDate; [menu addSubview:pickerView]; [menu showInView:self.view]; [pickerView release]; [menu release]; </code></pre> <p>I've also tried with something similar to:</p> <pre><code>UIActionSheet *menu = [[UIActionSheet alloc] initWithFrame:CGRectMake(200.0, 200.0, 100.0f, 100.0f)]; </code></pre> <p>The coords are ofcourse not realistic, but they don't seem to affect the position/size of the UIActionSheet.</p>
[ { "answer_id": 353779, "author": "thbonk", "author_id": 44123, "author_profile": "https://Stackoverflow.com/users/44123", "pm_score": 6, "selected": true, "text": " UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@\"Date Picker\" \n ...
2008/12/08
[ "https://Stackoverflow.com/questions/349858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
349,861
<p>I have a script that animates a small DIV popping up on the page. It all works fine in IE, and in FF if I remove the DOCTYPE, but when the DOCTYPE is XHTML/Transitional, in Firefox, the width does not change. </p> <pre><code>this.container.style.visibility = "visible"; alert("this.container.style.width before = " + this.container.style.width) this.container.style.width = this.width; alert("this.container.style.width after = " + this.container.style.width); this.container.style.height = this.height; </code></pre> <p>In IE, and in FF with no DOCTYPE, the first alert says 0, and the second says 320 (which is the width set elsewhere in the code) </p> <p>in FF, with the DOCTYPE to XHTML/Transitional, both alerts show 0. Any idea what's going on here? I'm thinking I may need to explicitly set positions on the DIVs in Transitional, but I'm not sure. </p>
[ { "answer_id": 349900, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 5, "selected": true, "text": "this.container.style.visibility = \"visible\";\nalert(\"this.container.style.width before = \" + this.container.style.width...
2008/12/08
[ "https://Stackoverflow.com/questions/349861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8349/" ]
349,875
<p>Is it possible to display the text in a TextBlock vertically so that all letters are stacked upon each other (not rotated with LayoutTransform)?</p>
[ { "answer_id": 349954, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 4, "selected": false, "text": "<TextBlock TextAlignment=\"Center\" FontSize=\"14\" FontWeight=\"Bold\" Width=\"10\" TextWrapping=\"Wrap\">THIS IS A TEST</T...
2008/12/08
[ "https://Stackoverflow.com/questions/349875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11499/" ]
349,878
<p>OK since I am in a holding pattern on this issue perhaps someone has seen these symptoms and can provide some sage advice. (Note: I have learned only enough Active Directory information to build this feature and I only have read access to the Active Directory.)</p> <p>I updated the company intranet to allow the automatic entry/modification of employee phone/address information; it uses a web service to connect to the company Active Directory so I can call it from multiple locations in the main application. </p> <p>The AD has two domains (A and B) in the same forest. Each domain has an ‘ADS update user’ group and an ‘ADSupdate’ account (which belongs to ‘ADS update user’).</p> <p>Problem: Entries in Domain A update fine for Local Development Servers, Test Servers, and Production Servers. Entries in Domain B update only when run from Local Development Servers. When you run the same code (verified multiple times) on either Test or Production you get a (General access denied error).</p> <p>The domain name is stored in the employee record so the exact same code is called for all employees.</p> <p>All Local Development Servers, Test, and Production servers reside in Domain A.</p> <p>This has the Active Directory Admin for Domain B stumped and to be honest I am thankful that the Local Development Servers are able to update the Active Directory entries in domain B. It proves that the code works at least in one location</p> <p>I have looked at machine permissions, permissions on the group and user, and IIS and I can spot no significant differences. Any help would be appreciated…</p>
[ { "answer_id": 349954, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 4, "selected": false, "text": "<TextBlock TextAlignment=\"Center\" FontSize=\"14\" FontWeight=\"Bold\" Width=\"10\" TextWrapping=\"Wrap\">THIS IS A TEST</T...
2008/12/08
[ "https://Stackoverflow.com/questions/349878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30934/" ]
349,884
<p>I need to simple way to allow an end user to restart tomcat from a web page served from apache on the same box.</p> <p>We're trying to make it easy for our QC department to deploy a new version of our webapp to apache. We're using samba, but we need an easy way for them to stop / start the tomcat server before/after the deployment.</p> <p>This would only be for internal qc boxes. Is there an existing solution for this? or would it be easier to write a few quick php application to handle this?</p>
[ { "answer_id": 351676, "author": "derobert", "author_id": 27727, "author_profile": "https://Stackoverflow.com/users/27727", "pm_score": 4, "selected": true, "text": "/etc/init.d/tomcat restart" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1310/" ]
349,886
<p>So I have an Oracle instance, and I know it's running on this system, I've su'd to the oracle user, and I'm trying to connect using "/ as sysdba". However, when I do connect, it says the instance is idle. I know the database is up and opened, because my application's talking to it. My paths (ORACLE_HOME, etc.) might be incorrect: any idea which incorrect setting might result in this?</p> <pre><code>% sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.3.0 - Production on Mon Dec 8 09:23:22 2008 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to an idle instance. 09:23:22 SQL&gt; Disconnected % ps -ef | grep smon oracle 6961 1 0 Nov 05 ? 1:24 ora_smon_ORA003 % </code></pre>
[ { "answer_id": 350432, "author": "Leigh Riffel", "author_id": 27010, "author_profile": "https://Stackoverflow.com/users/27010", "pm_score": 2, "selected": false, "text": "sqlplus \"/@ConnectIdentifier as sysdba\"\n" }, { "answer_id": 351521, "author": "Matthew Watson", "a...
2008/12/08
[ "https://Stackoverflow.com/questions/349886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,889
<p>I just wrote the following C++ function to programmatically determine how much RAM a system has installed. It works, but it seems to me that there should be a simpler way to do this. Am I missing something?</p> <pre><code>getRAM() { FILE* stream = popen(&quot;head -n1 /proc/meminfo&quot;, &quot;r&quot;); std::ostringstream output; int bufsize = 128; while( !feof(stream) &amp;&amp; !ferror(stream)) { char buf[bufsize]; int bytesRead = fread(buf, 1, bufsize, stream); output.write(buf, bytesRead); } std::string result = output.str(); std::string label, ram; std::istringstream iss(result); iss &gt;&gt; label; iss &gt;&gt; ram; return ram; } </code></pre> <p>First, I'm using <code>popen(&quot;head -n1 /proc/meminfo&quot;)</code> to get the first line of the meminfo file from the system. The output of that command looks like</p> <blockquote> <p>MemTotal: 775280 kB</p> </blockquote> <p>Once I've got that output in an <code>istringstream</code>, it's simple to tokenize it to get at the information I want. Is there a simpler way to read in the output of this command? Is there a standard C++ library call to read in the amount of system RAM?</p>
[ { "answer_id": 349970, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 1, "selected": false, "text": "top" }, { "answer_id": 350039, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https:...
2008/12/08
[ "https://Stackoverflow.com/questions/349889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
349,892
<p>I have a logging table which has three columns. One column is a unique identifier, One Column is called "Name" and the other is "Status".<br> Values in the Name column can repeat so that you might see Name "Joe" in multiple rows. Name "Joe" might have a row with a status "open", another row with a status "closed", another with "waiting" and maybe one for "hold". I would like to, using a defined precedence in this highest to lowest order:("Closed","Hold","Waiting" and "Open") pull the highest ranking row for each Name and ignore the others. Anyone know a simple way to do this? </p> <p>BTW, not every Name will have all status representations, so "Joe" might only have a row for "waiting" and "hold", or maybe just "waiting".</p>
[ { "answer_id": 349903, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 3, "selected": true, "text": "Status | Order\n---------------\nClosed | 1\nHold | 2\nWaiting | 3\nOpen | 4\n" }, { "answer_id": 349926, ...
2008/12/08
[ "https://Stackoverflow.com/questions/349892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13954/" ]
349,896
<p>I'm trying to make a function that has a list of lists, it multiplies the sum of the inner list with the outer list. So far i can sum a list, i've made a function sumlist([1..n],X) that will return X = (result). But i cannot get another function to usefully work with that function, i've tried both is and = to no avail.</p>
[ { "answer_id": 351501, "author": "mweerden", "author_id": 4285, "author_profile": "https://Stackoverflow.com/users/4285", "pm_score": 1, "selected": false, "text": "[L1,...,Ln]" }, { "answer_id": 353572, "author": "Kaarel", "author_id": 12547, "author_profile": "https...
2008/12/08
[ "https://Stackoverflow.com/questions/349896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42789/" ]
349,904
<p>Recently I used a class that inherits from a collection instead of having the collection instantiated within the class, is this acceptable or does it create unseen problems further down the road? Examples below for the sake of clarity:</p> <pre><code>public class Cars : List&lt;aCar&gt; </code></pre> <p>instead of something like:</p> <pre><code>public class Cars { List&lt;aCar&gt; CarList = new List&lt;aCar&gt;(); } </code></pre> <p>Any thoughts?</p>
[ { "answer_id": 349950, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "IEnumerable<T>" }, { "answer_id": 350257, "author": "TcKs", "author_id": 20382, "author_profile": "h...
2008/12/08
[ "https://Stackoverflow.com/questions/349904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4098/" ]
349,918
<p>I am using a third-party DLL. For some particular cases, a function in the DLL is throwing an exception. Is it possible to debug the DLL in the Visual Studio?</p> <p>After <a href="https://stackoverflow.com/questions/349918/debugging-a-third-party-dll-in-visual-studio/349925#349925">the answer from Andrew Rollings</a>, I am able to view the code, but is there any easy way to debug through the code in Visual Studio?</p>
[ { "answer_id": 350332, "author": "Robert Gowland", "author_id": 20570, "author_profile": "https://Stackoverflow.com/users/20570", "pm_score": 2, "selected": false, "text": "Trace.WriteLine" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41968/" ]
349,927
<p>According to <em>Cocoa Programming for Mac OS X, 3rd Edition</em>, on page 245 (chapter 17), you will usually create views in Interface Builder. However, it is possible to create them in code, a la:</p> <pre><code>NSView *superview = [window contentView]; NSRect frame = NSMakeRect(10, 10, 200, 100); NSButton *button = [[NSButton alloc] initWithFrame:frame]; [button setTitle:@"Click me!"]; [superview addSubview:button]; [button release]; </code></pre> <p>That’s all well and good, but how would I wire up said control’s outlets to actions in code? (In .NET, this is an easy thing; add a delegate ... I’m hoping it’s similarly easy in Cocoa/Obj-C.)</p>
[ { "answer_id": 350104, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 6, "selected": true, "text": "[button setTarget: self];\n[button setAction: @selector(myButtonWasHit:)];\n" }, { "answer_id": 350910, "aut...
2008/12/08
[ "https://Stackoverflow.com/questions/349927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14048/" ]
349,931
<p>Please tell me how do I print a bit, like <code>printf("%d",bit);</code>.</p>
[ { "answer_id": 349937, "author": "Herms", "author_id": 1409, "author_profile": "https://Stackoverflow.com/users/1409", "pm_score": 4, "selected": false, "text": "printf(\"%d\", bit & 0x1);\n" }, { "answer_id": 349960, "author": "Keltia", "author_id": 16143, "author_pr...
2008/12/08
[ "https://Stackoverflow.com/questions/349931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
349,933
<p>I have a user table like this</p> <pre><code>user_id | community_id | registration_date -------------------------------------------- 1 | 1 | 2008-01-01 2 | 1 | 2008-05-01 3 | 2 | 2008-01-28 4 | 2 | 2008-07-22 5 | 3 | 2008-01-11 </code></pre> <p>For each community, I would like to get the time that the 3rd user registered. I can easily do this for a single community using MySql's 'limit' SQL extension. For example, for community with ID=2</p> <pre><code>select registration_date from user order by registration_date where community_id = 2 limit 2, 1 </code></pre> <p>Alternatively, I can get the date that the first user registered for all communities via:</p> <pre><code>select community_id, min(registration_date) from user group by 1 </code></pre> <p>But I can't figure out how to get the registration date of the 3rd user for <em>all</em> communities in a single SQL statement.</p> <p>Cheers, Don</p>
[ { "answer_id": 350001, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 2, "selected": false, "text": "select \n registration_date, community_id \nfrom \n user outer \nwhere \n user_id IN (\n select \n user_i...
2008/12/08
[ "https://Stackoverflow.com/questions/349933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
349,938
<p>Is there a programmatic way to extract equations (and possibly images) from an MS Word document? I've googled all over, but have yet to find anything that I can sink my teeth into and work from. If possible, I'd like to be able to do this with VB.NET or C#, but I can pick up enough of any language to hack out a DLL. Thanks!</p> <p><strong>EDIT:</strong> Right now I'm looking at extracting the equations from Word 2003, but if converting it to 2007/Open XML is required, that's fine.</p>
[ { "answer_id": 350030, "author": "Dirk Vollmar", "author_id": 40347, "author_profile": "https://Stackoverflow.com/users/40347", "pm_score": 3, "selected": false, "text": "\"C:\\Program Files\\Microsoft Office\\Office12\\wordconv.exe\" -oice -nme input\\_file output_file" }, { "an...
2008/12/08
[ "https://Stackoverflow.com/questions/349938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4252/" ]
349,948
<p>I had a class with some common error handling code, and I wanted to pass in the method and arguments to call, but I couldn't quite come up with the syntax. What I want to do is roughly this:</p> <pre><code>private void InvokeHelper(Delegate method, params object[] args) { bool retry = false; do { try { method.DynamicInvoke(args); retry = false; } catch (MyException ex) { retry = HandleException(ex); } } while (retry); } </code></pre> <p>and then be able to do things like:</p> <pre><code>InvokeHelper(foo.MethodA, a, b, c); InvokeHelper(foo.MethodB, x, y ); </code></pre> <p>This gets a compiler error converting foo.MethodA and foo.MethodB into System.Delegate. I came up with the workaround below (and I actually like it better because then I get type checking on my arguments to my methods), but I'm curious if there's a way to do what I was originally trying to do? I know I could use <code>foo.GetType().GetMethod("MethodA")</code> and invoke that, but I was trying to avoid reflection. I mainly just want to understand how methods are dynamically invoked in .net.</p> <p>Workaround:</p> <pre><code>private delegate void EmptyDelegate(); private void InvokeHelper(EmptyDelegate method) { bool retry = false; do { try { method.Invoke(); retry = false; } catch (MyException ex) { retry = HandleException(ex); } } while (retry); } </code></pre> <p>then call:</p> <pre><code>InvokeHelper(delegate() { foo.MethodA(a, b, c); }); InvokeHelper(delegate() { foo.MethodB(x, y); }); </code></pre>
[ { "answer_id": 350043, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": true, "text": "private void InvokeHelper(Delegate method, params object[] args)\n" }, { "answer_id": 350062, "author": "Amy B", ...
2008/12/08
[ "https://Stackoverflow.com/questions/349948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9323/" ]
349,951
<p>We have a stored procedure that runs nightly that in turn kicks off a number of other procedures. Some of those procedures could logically be run in parallel with some of the others. </p> <ul> <li>How can I indicate to SQL Server whether a procedure should be run in parallel or serial &mdash; ie: kicked off of asynchronously or blocking? </li> <li>What would be the implications of running them in parallel, keeping in mind that I've already determined that the processes won't be competing for table access or locks- just total disk io and memory. For the most part they don't even use the same tables.</li> <li>Does it matter if some of those procedures are the <em>same</em> procedure, just with different parameters?</li> <li>If I start a pair or procedures asynchronously, is there a good system in SQL Server to then wait for both of them to finish, or do I need to have each of them set a flag somewhere and check and poll the flag periodically using <code>WAITFOR DELAY</code>?</li> </ul> <p>At the moment we're still on SQL Server 2000.</p> <p>As a side note, this matters because the main procedure is kicked off in response to the completion of a data dump into the server from a mainframe system. The mainframe dump takes all but about 2 hours each night, and we have no control over it. As a result, we're constantly trying to find ways to reduce processing times.</p>
[ { "answer_id": 4648502, "author": "BradC", "author_id": 21398, "author_profile": "https://Stackoverflow.com/users/21398", "pm_score": 5, "selected": true, "text": "sp_start_job" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/349951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
349,953
<p>I am converting a linux script from <a href="http://www.perlmonks.org/index.pl?node_id=217166" rel="nofollow noreferrer">http://www.perlmonks.org/index.pl?node_id=217166</a> specifically this:</p> <pre><code>#!/usr/bin/perl -w use strict; use Getopt::Std; use File::Find; @ARGV &gt; 0 and getopts('a:', \my %opt) or die &lt;&lt; "USAGE"; # Deletes any old files from the directory tree(s) given and # removes empty directories en passant. usage: $0 [-a maxage] directory [directory ...] -a maximum age in days, default is 120 USAGE my $max_age_days = $opt{a} || 120; find({ wanted =&gt; sub { unlink if -f $_ and -M _ &gt; $max_age_days }, postprocess =&gt; sub { rmdir $File::Find::dir }, }, @ARGV); </code></pre> <p>my attempt is:</p> <pre><code>#!/usr/bin/perl -w use strict; use Getopt::Std; use File::Find; @ARGV &gt; 0 and getopts('a:', \my %opt) or die &lt;&lt; "USAGE"; # Deletes any old files from the directory tree(s) given and # removes empty directories en passant. usage: $0 [-a maxage] directory [directory ...] -a maximum age in days, default is 120 USAGE my $max_age_days = $opt{a} || 120; find({ wanted =&gt; sub { unlink if -f $_ and -M _ &gt; $max_age_days }, # postprocess =&gt; sub { rmdir $File::Find::dir }, postprocess =&gt; sub { my $expr = "$File::Find::dir"; $expr =~ s/\//\\/g; # replace / with \ print "rmdir $expr\n"; `rmdir $expr`; }, }, @ARGV); </code></pre> <p>However I get an error when the script tries to remove a directory saying that the directory is in use by another process (when it isn't). Any ideas? I'm running the script on Windows Server 2003 SP2 64-bit using ActiveState 5.10.</p> <p>Thanks!</p>
[ { "answer_id": 349998, "author": "dsm", "author_id": 7780, "author_profile": "https://Stackoverflow.com/users/7780", "pm_score": 5, "selected": true, "text": "no_chdir" }, { "answer_id": 359798, "author": "Mark Allison", "author_id": 38211, "author_profile": "https://...
2008/12/08
[ "https://Stackoverflow.com/questions/349953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38211/" ]
349,957
<p>I'm having an issue with an ObservableCollection getting new items but not reflecting those changes in a ListView. I have enough quirks in the way I'm implementing this that I'm having a hard time determining what the problem is.</p> <p>My ObservableCollection is implemented thusly:</p> <pre><code>public class MessageList : ObservableCollection&lt;LobbyMessage&gt; { public MessageList(): base() { Add(new LobbyMessage() { Name = "System", Message = "Welcome!" }); } } </code></pre> <p>I store the collection in a static property (so that its easily accessible from multiple user controls):</p> <pre><code>static public MessageList LobbyMessages { get; set; } </code></pre> <p>In the OnLoad event of my main NavigationWindow I have the following line:</p> <pre><code>ChatHelper.LobbyMessages = new MessageList(); </code></pre> <p>My XAML in the UserControl where the ListView is located reads as:</p> <pre><code> &lt;ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Mode=OneWay}" x:Name="ListBoxChatMessages" d:UseSampleData="True" ItemTemplate="{DynamicResource MessageListTemplate}" IsEnabled="True"&gt; &lt;ListBox.DataContext&gt; &lt;Magrathea_Words_Tools:MessageList/&gt; &lt;/ListBox.DataContext&gt; &lt;/ListBox&gt; </code></pre> <p>The initial message that I added in the constructor appears in the UI just fine.</p> <p>Now, the way I add new items to the collection is from a CallBack coming from a WCF service. I had this code working in a WinForms application and it was neccessary to marshall the callback to the UI thread so I left that code in place. Here is an abbreviated version of the method:</p> <pre><code>Helper.Context = SynchronizationContext.Current; #region IServiceMessageCallback Members /// &lt;summary&gt; /// Callback handler for when the service has a message for /// this client /// &lt;/summary&gt; /// &lt;param name="serviceMessage"&gt;&lt;/param&gt; public void OnReceivedServiceMessage(ServiceMessage serviceMessage) { // This is being called from the WCF service on it's own thread so // we have to marshall the call back to this thread. SendOrPostCallback callback = delegate { switch (serviceMessage.MessageType) { case MessageType.ChatMessage: ChatHelper.LobbyMessages.Add( new LobbyMessage() { Name = serviceMessage.OriginatingPlayer.Name, Message = serviceMessage.Message }); break; default: break; } }; Helper.Context.Post(callback, null); } </code></pre> <p>While debugging I can see the collection getting updated with messages from the service but the UI is not reflecting those additions.</p> <p>Any ideas about what I'm missing to get the ListView to reflect those new items in the collection?</p>
[ { "answer_id": 352879, "author": "Sailing Judo", "author_id": 42620, "author_profile": "https://Stackoverflow.com/users/42620", "pm_score": 3, "selected": true, "text": "ListBoxChatMessages.ItemsSource = ChatHelper.LobbyMessages.Messages;\n" }, { "answer_id": 22963753, "autho...
2008/12/08
[ "https://Stackoverflow.com/questions/349957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42620/" ]
349,978
<p>I have just imported a WAR file from an external site, which is basically a servlet into Eclipse IDE (the project runs on Apache-Tomcat). </p> <p>When I import it it has a folder called <strong>Web App Libraries</strong>. So here are a few of my newbie questions:</p> <ol> <li><p>I am unsure about what the exact purpose is of this folder is? What does it do, why would you choose to have it in your project? </p></li> <li><p>I see that it has a folder called <strong>Improted Classes</strong> and foobar.class files inside it - why?<br> <em>(These seemed to be mirrored in <strong>Web Content</strong> folder - although here you can modify the code as they are foobar.java.)</em></p></li> <li><p>There are references to foobar.jar files too - these are also mirrored in <strong>WEB-INF/lib</strong> folder too - why?</p></li> </ol> <p>I know these are basic type questions but I'm just getting to grips with Java and website dev, so apologies if they sound a bit dumb! - BTW if anyone knows any good online resource to understand more about project file structures like this, then let me know. I just need to get to grips with this stuff asap - as the project deadline is fairly soon.</p> <p>Cheers.</p> <p>Here's a screenshot just to help you visualise:</p> <p><img src="https://rantincsharp.files.wordpress.com/2008/12/eclipserestlet.gif" alt="alt text"></p>
[ { "answer_id": 350076, "author": "JeeBee", "author_id": 17832, "author_profile": "https://Stackoverflow.com/users/17832", "pm_score": 1, "selected": false, "text": "Project Name/\n JavaSource/ or src/ // holds all the Java Source Files, Servlets, Struts Actions\n WebContent/ ...
2008/12/08
[ "https://Stackoverflow.com/questions/349978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175/" ]
349,980
<p>I need to format an integer representation of bytes into something friendly, and I'm hoping that there's a utility function in Ruby or in Rails that will do that formatting for me (to perpetuate my laziness, of course.)</p> <p>I'm looking for something that would look like:</p> <pre><code>format_bytes(1024) -&gt; "1 KB" format_bytes(1048576) -&gt; "1 MB" </code></pre> <p>Looks like there's some stuff in ActiveSupport to do it the other way around, but I haven't found a way to do it in this direction.</p> <p>If there isn't one that exists, does anyone have a particularly elegant solution?</p>
[ { "answer_id": 350083, "author": "mwilliams", "author_id": 23909, "author_profile": "https://Stackoverflow.com/users/23909", "pm_score": 6, "selected": true, "text": "require 'action_view'\ninclude ActionView::Helpers::NumberHelper\nnumber_to_human_size(123) ...
2008/12/08
[ "https://Stackoverflow.com/questions/349980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/650/" ]
349,997
<pre><code>$pee = preg_replace( '|&lt;p&gt;|', "$1&lt;p&gt;", $pee ); </code></pre> <p>This regular expression is from the Wordpress source code (formatting.php, wpautop function); I'm not sure what it does, can anyone help?</p> <p>Actually I'm trying to port this function to Python...if anyone knows of an existing port already, that would be much better as I'm really bad with regex.</p>
[ { "answer_id": 350026, "author": "Powerlord", "author_id": 15880, "author_profile": "https://Stackoverflow.com/users/15880", "pm_score": 2, "selected": false, "text": "<p>" }, { "answer_id": 350033, "author": "Patrick Desjardins", "author_id": 13913, "author_profile":...
2008/12/08
[ "https://Stackoverflow.com/questions/349997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18494/" ]
350,018
<p>What is the best way to combine both hashes into %hash1? I always know that %hash2 and %hash1 always have unique keys. I would also prefer a single line of code if possible. </p> <pre><code>$hash1{'1'} = 'red'; $hash1{'2'} = 'blue'; $hash2{'3'} = 'green'; $hash2{'4'} = 'yellow'; </code></pre>
[ { "answer_id": 350038, "author": "dreftymac", "author_id": 42223, "author_profile": "https://Stackoverflow.com/users/42223", "pm_score": 9, "selected": true, "text": "undef" }, { "answer_id": 350190, "author": "brian d foy", "author_id": 2766176, "author_profile": "ht...
2008/12/08
[ "https://Stackoverflow.com/questions/350018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2356/" ]
350,027
<p>I'm trying to set a WPF image's source in code. The image is embedded as a resource in the project. By looking at examples I've come up with the below code. For some reason it doesn't work - the image does not show up. </p> <p>By debugging I can see that the stream contains the image data. So what's wrong?</p> <pre><code>Assembly asm = Assembly.GetExecutingAssembly(); Stream iconStream = asm.GetManifestResourceStream("SomeImage.png"); PngBitmapDecoder iconDecoder = new PngBitmapDecoder(iconStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); ImageSource iconSource = iconDecoder.Frames[0]; _icon.Source = iconSource; </code></pre> <p>The icon is defined something like this: <code>&lt;Image x:Name="_icon" Width="16" Height="16" /&gt;</code></p>
[ { "answer_id": 350059, "author": "Arcturus", "author_id": 900, "author_profile": "https://Stackoverflow.com/users/900", "pm_score": 3, "selected": false, "text": "VisualBrush brush = new VisualBrush { TileMode = TileMode.None };\n\nbrush.Visual = frame;\n\nbrush.AlignmentX = AlignmentX.C...
2008/12/08
[ "https://Stackoverflow.com/questions/350027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22621/" ]
350,047
<p>I would like to run a job through cron that will be executed every second Tuesday at given time of day. For every Tuesday is easy:</p> <pre><code>0 6 * * Tue </code></pre> <p>But how to make it on "every second Tuesday" (or if you prefer - every second week)? I would not like to implement any logic in the script it self, but keep the definition only in cron.</p>
[ { "answer_id": 350061, "author": "xahtep", "author_id": 42184, "author_profile": "https://Stackoverflow.com/users/42184", "pm_score": 7, "selected": true, "text": "crontab" }, { "answer_id": 15022838, "author": "jimmyb", "author_id": 1279587, "author_profile": "https:...
2008/12/08
[ "https://Stackoverflow.com/questions/350047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42201/" ]
350,081
<p>In the application I'm working on porting to the web, we currently dynamically access different tables at runtime from run to run, based on a "template" string that is specified. I would like to move the burden of doing that back to the database now that we are moving to SQL server, so I don't have to mess with a dynamic GridView. I thought of writing a Table-valued UDF with a parameter for the table name and one for the query WHERE clause.</p> <p>I entered the following for my UDF but obviously it doesn't work. Is there any way to take a varchar or string of some kind and get a table reference that can work in the FROM clause?</p> <pre><code>CREATE FUNCTION TemplateSelector ( @template varchar(40), @code varchar(80) ) RETURNS TABLE AS RETURN ( SELECT * FROM @template WHERE ProductionCode = @code ) </code></pre> <p>Or some other way of getting a result set similar in concept to this. Basically all records in the table indicated by the varchar @template with the matching ProductionCode of the @code.</p> <p>I get the error "Must declare the table variable "@template"", so SQL server probably things I'm trying to select from a table variable.</p> <p>On Edit: Yeah I don't need to do it in a function, I can run Stored Procs, I've just not written any of them before.</p>
[ { "answer_id": 350107, "author": "Harper Shelby", "author_id": 21196, "author_profile": "https://Stackoverflow.com/users/21196", "pm_score": 3, "selected": true, "text": "CREATE PROCEDURE TemplateSelector \n( \n @template varchar(40),\n @code varchar(80)\n)\n\nAS\nEXEC('SELECT * ...
2008/12/08
[ "https://Stackoverflow.com/questions/350081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26140/" ]
350,095
<p>Is there a way to programmatically, through a batch file (or powershell script), put all folders in <code>c:\Program Files</code> into the system variable <code>PATH</code>? I'm dependent on the command line and really want to just start a program from the command line.</p> <p>Yes, I'm jealous of Linux shells.</p>
[ { "answer_id": 350121, "author": "Greg Hurlman", "author_id": 35, "author_profile": "https://Stackoverflow.com/users/35", "pm_score": 3, "selected": false, "text": "@echo off\n\nFOR /D %%G IN (%1\\*) DO PATH \"%%G\";%path%\n" }, { "answer_id": 350273, "author": "Rob Williams"...
2008/12/08
[ "https://Stackoverflow.com/questions/350095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
350,101
<p>Ok time to show my complete lack of knowladge for all things web forms but here goes. I am extending the Panel control and OnPreRender sticking some additional controls inside of it (lets just say 1 textbox for simplicity). From here I am just letting the Panels Render method do its thing. </p> <p>The issue I am having is that obviously every time this control is rerendered it is just sticks that same TextBox in the panel again with the value I am coding in the OnPreRender method. Now I dont actually want to repopulate the panel every time, </p> <p>I want to stick the textbox contorl in there on first load and have them reloaded from the control/viewstate caches. In this case with my example of just sticking a single textbox in the panel, if the value of the textbox changes and a postback occurs I want that value to to remain the changed value. </p> <p>Really basic webforms stuff I know, but I have never had to create custom controls in my time. ANy help appreciated. </p> <p>Chris. </p>
[ { "answer_id": 350197, "author": "Programmin Tool", "author_id": 21691, "author_profile": "https://Stackoverflow.com/users/21691", "pm_score": 1, "selected": false, "text": "public class SomeControl : WebControl, INamingContainer\n{\n private TextBox someTextBox;\n\n protected override...
2008/12/08
[ "https://Stackoverflow.com/questions/350101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425/" ]
350,120
<p>Does someone knows if it's possible to dynamically create a call chain and invoke it?</p> <p>Lets say I have two classes A &amp; B:</p> <pre><code>public class A public function Func() as B return new B() end function end class public class B public function Name() as string return "a string"; end function end class </code></pre> <p>I want to be able to get <em>MethodInfo</em> for both <em>Func()</em> &amp; <em>Name()</em> and invoke them dynamically so that I can get a call similar to <em>A.Func().Name()</em>.</p> <p>I know I can use <em>Delegate.CreateDelegate</em> to create a delegate I can invoke from the two <em>MethodInfo</em> objects but this way I can only call the two functions separately and not as part of a call chain.</p> <p>I would like two solutions one for .NET 3.5 using expression tree and if possible a solution that is .NET 2.0 compatible as well</p>
[ { "answer_id": 350178, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "// I assume you've already got fMethodInfo and nameMethodInfo.\nExpression fCall = Expression.Call(null, fMethodInfo);\nE...
2008/12/08
[ "https://Stackoverflow.com/questions/350120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11361/" ]
350,124
<p>I'm looking to write an automated monitor script to programmatically retrieve information from another user's Exchange 2003 inbox. I have working C++ code to log into MAPI and connect to my own inbox. I can also use the Control Panel->Mail applet to configure another user's mailbox into my profile, and my code can access that way. However, this was done on my desktop with Outlook installed, which provides a richer mail profile editor.</p> <p>Since this will run on a server, I'd prefer not to install Outlook at all. Instead, I can install the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=E17E7F31-079A-43A9-BFF2-0A110307611E&amp;displaylang=en" rel="nofollow noreferrer">MAPI client</a>. I then create a simple MAPI app that pops up the mail profile wizard using <code>MAPILogonEx()</code> with the <code>MAPI_LOGON_UI</code> flag. However, the basic MAPI client doesn't have the features to configure another user's mailbox. As a requirement, I can only run this script as the service account of the monitoring application, so I cannot tell it to run as the account whose mailbox I want.</p> <p>Is it still possible to connect to another user's mailbox (assuming permissions are already granted) using the basic MAPI client? Or is it absolutely necessary to install Outlook for this functionality?</p>
[ { "answer_id": 350581, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "CreateStoreEntryID" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/350124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3347/" ]
350,126
<p>I am trying to write a textbox that will search on 5 DB columns and will return every result of a given search, ex. "Red" would return: red ball, Red Williams, etc. Any examples or similar things people have tried. My example code for the search.</p> <p>Thanks.</p> <pre><code> ItemMasterDataContext db = new ItemMasterDataContext(); string s = txtSearch.Text.Trim(); var q = from p in db.ITMSTs where p.IMITD1.Contains(s) || p.IMITD2.Contains(s) || p.IMMFNO.Contains(s) || p.IMITNO.Contains(s) || p.IMVNNO.Contains(s) select p; lv.DataSource = q; lv.DataBind(); </code></pre>
[ { "answer_id": 350189, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 1, "selected": false, "text": "IQueryable<ITMST>" }, { "answer_id": 357340, "author": "Perpetualcoder", "author_id": 37494, "aut...
2008/12/08
[ "https://Stackoverflow.com/questions/350126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37126/" ]
350,129
<p>How do I check to see if a particular value has already been assigned to Smarty and if not assign a (default) value?</p> <p>Answer:</p> <pre><code>if ($this-&gt;cismarty-&gt;get_template_vars('test') === null) { $this-&gt;cismarty-&gt;assign('test', 'Default value'); } </code></pre>
[ { "answer_id": 350162, "author": "Andy", "author_id": 26693, "author_profile": "https://Stackoverflow.com/users/26693", "pm_score": 5, "selected": true, "text": "if ($smarty->get_template_vars('foo') === null) \n{\n $smarty->assign('foo', 'some value');\n}\n" }, { "answer_id": ...
2008/12/08
[ "https://Stackoverflow.com/questions/350129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3238/" ]
350,131
<p>Are there any performance benefits to me not using the gridview in asp.net for simple tables querying from a stored procedure and instead writing the html in server code myself. I'm sure my code would certainly be more concise in output.</p>
[ { "answer_id": 350206, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 0, "selected": false, "text": "Dim tab As New Table\nFor Each row In DataTable.Rows\n Dim tabRow as New TableRow\n For Each col In row.Columns\n...
2008/12/08
[ "https://Stackoverflow.com/questions/350131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16989/" ]
350,140
<p>So I'm basically a beginner when it comes to Vim, nonetheless I do know the basic things (open files, edit, move around, basic grep, .vimrc, etc)</p> <p>I would submit this link first</p> <p><a href="http://weblog.jamisbuck.org/2008/11/17/vim-follow-up" rel="nofollow noreferrer">http://weblog.jamisbuck.org/2008/11/17/vim-follow-up</a></p> <p>If you scroll down to where it says "NERD___tree", it explains what it is and gives a link to the home page. I have already gotten NERD_tree installed, so far so good.</p> <p>Only thing is, this guy (JamisBuck) adds a line to the .vimrc file to streamline it's usage (I'm guessing to toggle between NERD_tree and the actual file, because as far as I can tell, there is no quick way to do it other than typing in:</p> <pre><code>:NERDTree </code></pre> <p>Every time which is less than desirable. The follwing is the code he adds to the .vimrc file:</p> <pre><code>map &lt;leader&gt;d :execute 'NERDTreeToggle ' . getcwd()&lt;CR&gt; </code></pre> <p>He doesn't explain exactly what is is and/or how to use it, so If someone could give me a short explanation and/or point me towards a resource to learn more about this, that would be appreciated.</p>
[ { "answer_id": 350159, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 4, "selected": true, "text": ":help leader" }, { "answer_id": 350171, "author": "Jay", "author_id": 20840, "author_profile": "https://Sta...
2008/12/08
[ "https://Stackoverflow.com/questions/350140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44346/" ]
350,141
<p>In Unix/Linux, how do you find out what group a given user is in via command line?</p>
[ { "answer_id": 350144, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 10, "selected": true, "text": "groups\n" }, { "answer_id": 350145, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "http...
2008/12/08
[ "https://Stackoverflow.com/questions/350141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5885/" ]
350,150
<p>I am trying to run some Perl CGI scripts under IIS. I get the following message :</p> <pre> <code> CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), LANG = (unset) are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). </code> </pre> <p>I found out that the problem occurs only when I "use" an internal library of ours but it's really a big one (using many other stuff) so I would prefer to know where to look. When I run the same script from the command line, the script runs just fine. I tried to set "LANG" to "C", then "LC_ALL" to "C" but it had no effect.</p> <p>Any pointers welcome!</p>
[ { "answer_id": 350165, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 0, "selected": false, "text": "use CGI::CARP qw(fatalsToBrowser)" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/350150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35273/" ]
350,181
<p>What is the best was to evaluate an expression like the following: <br /> (A And B) Or (A And C) Or (Not B And C)<br /> or<br /> (A &amp;&amp; B) || (A &amp;&amp; C) || (!B &amp;&amp; C)<br /></p> <p>At runtime, I was planning on converting the above expressions to the following:<br /> (True And False) Or (True And False) Or (Not False And True)<br /> or<br /> (True &amp;&amp; False) || (True &amp;&amp; False) || (! False &amp;&amp; True)<br /></p> <p>Conditions: 1) The logical expression is not known until runtime. 2) The number variable and their values are not known until runtime. 3) Variable values are never null.</p> <p>I know I could create a simple assemble with a class and a method that I generate at runtime based on the inputs, but is there a better way. I have done this before. Use a string builder to write the code, then call the compiler. After that, you load the assembly and call the method. </p> <p>Suggestions?</p> <p>Thanks.</p>
[ { "answer_id": 350211, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 3, "selected": false, "text": "And" }, { "answer_id": 350784, "author": "hughdbrown", "author_id": 10293, "author_profile": "http...
2008/12/08
[ "https://Stackoverflow.com/questions/350181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25843/" ]
350,202
<p>The following VBA code works great in Excel 2003, but results in a <em>Stack Overflow Error</em> in Excel 2007. The code is required to either unlock or lock certain cells based on a drop-down menu selection. I need to be able to run the code in both Excel 2003 and 2007. Please help.</p> <pre><code>Private Sub Worksheet_Change(ByVal Target As Range) If [E28] = "NO" Then ActiveSheet.Unprotect ("PASSWORD") [K47:K53].Locked = False [K47:K53].Interior.ColorIndex = 16 [K47:K53].ClearContents ActiveSheet.Protect ("PASSWORD") Else ActiveSheet.Unprotect ("PASSWORD") [K47:K53].Interior.ColorIndex = 0 'Next line is optional, remove preceding apostrophe if protection should stay on. ActiveSheet.Protect ("PASSWORD") End If End Sub </code></pre>
[ { "answer_id": 350246, "author": "Joe", "author_id": 13087, "author_profile": "https://Stackoverflow.com/users/13087", "pm_score": 2, "selected": false, "text": "Private m_bInChange As Boolean\n\nPrivate Sub Worksheet_Change(ByVal Target As Range)\nIf m_bInChange Then Exit Sub\nOn Error ...
2008/12/08
[ "https://Stackoverflow.com/questions/350202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
350,207
<p>I have an ASP.NET page that uses a menu based on <code>asp:LinkButton</code> control in a Master page. When a user selects a menu item, an <code>onclick</code> handler calls a method in my C# code. The method it calls just does a <code>Server.Transfer()</code> to a new page. From what I have read, this is not supposed to change the URL displayed in the browser.</p> <p>The problem is it that the URL changes in the browser as the user navigates the menu to different pages.</p> <p>Here is an item in the menu:</p> <pre><code>&lt;asp:LinkButton id="foo" runat="server" onclick="changeToHelp"&gt;&lt;span&gt;Help&lt;/span&gt; &lt;/asp:LinkButton&gt; </code></pre> <p>In my C# code, I handle the event with a method like:</p> <pre><code>protected void changeToHelp(object sender, EventArgs e) { Server.Transfer("Help.aspx"); } </code></pre> <p>Any ideas how I can navigate through the menu without the browser's URL bar changing?</p>
[ { "answer_id": 350216, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 0, "selected": false, "text": "Server.Execute(\"Help.aspx\")" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/350207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16148/" ]
350,214
<p>I have a ListBox whose ItemSource is an ObjectDataProvider that is an instance of an ObservableCollection. The ObservableCollection is a collection of ObservableCollections. The ItemTemplate of the ListBox is a DataTemplate that creates a ListBox for each item of the listbox. To illustrate this better I'm trying to recreate a card game in WPF. Basically, from a hand of cards you can create books. After you have a valid book, you can elect to make it a book which will go into the ObservableCollection of Books. The problem that I'm having is that each item of the ListBox is a ListBox that has an ItemSource that is a Book, that is an ObservableCollection of Cards. I don't think I'm having a problem with the source or the template of the outer ListBox, but I'm having a hard time understanding how I'm going to set the source of the ListBox items to the collection of cards for each book. Essentially, my question may be confusing and a difficult concept to grasp, but essentially I'm trying to figure out how to use a ListBox in a template that will be the template of another ListBox. If anyone has any idea of how to approach this, I would greatly appreciate hearing it.</p>
[ { "answer_id": 351392, "author": "Donnelle", "author_id": 28074, "author_profile": "https://Stackoverflow.com/users/28074", "pm_score": 3, "selected": true, "text": " public class Card\n{\n\n private string _name;\n\n public Card(string name)\n {\n _name = name;\n }\n\...
2008/12/08
[ "https://Stackoverflow.com/questions/350214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42858/" ]
350,227
<p>I've encountered a very strange bug in VBA and wondered if anyone could shed some light?</p> <p>I'm calling a worksheet function like this: </p> <pre><code>Dim lMyRow As Long lMyRow = WorksheetFunction.Match(vItemID, rngMyRange.Columns(1), 0) </code></pre> <p>This is intended to get the row of the item I pass in. Under certain circumstances (although I can't pin down exactly when), odd things happen to the call to the Match function.</p> <p>If I execute that line in the immediate window, I get the following:</p> <pre><code>lMyRow = WorksheetFunction.Match(vItemID, rngMyRange.Columns(1), 0) ?lMyRow 10 </code></pre> <p>i.e. the lookup works, and lMyRow gets a value assigned to it. If I let that statement execute in the actual code, I lMyRow gets a value of 0.</p> <p>This seems very odd! I don't understand how executing something in the immediate window can succeed in assigning a value, where the same call, at the same point in program execution can give a value of 0 when it runs normally in code!</p> <p>The only thing I can think of is that it's some odd casting thing, but I get the same behaviour taking if the variable to which I'm assigning is an int, a double, or even a string.</p> <p>I don't even know where to begin with this - help!!</p>
[ { "answer_id": 350351, "author": "Dirk Vollmar", "author_id": 40347, "author_profile": "https://Stackoverflow.com/users/40347", "pm_score": 0, "selected": false, "text": "Sub test()\n\nDim vItemID As Variant\nDim lMyRow As Long\nDim rngMyRange As Range\n\n Set rngMyRange = ActiveWorkb...
2008/12/08
[ "https://Stackoverflow.com/questions/350227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4019/" ]
350,240
<p>I am doing some float manipulation and end up with the following numbers:</p> <pre><code>-0.5 -0.4 -0.3000000000000000004 -0.2000000000000000004 -0.1000000000000000003 1.10E-16 0.1 0.2 0.30000000000000000004 0.4 0.5 </code></pre> <p>The algorithm is the following:</p> <pre><code>var inc:Number = nextMultiple(min, stepSize); trace(String(inc)); private function nextMultiple(x:Number, y:Number) { return Math.ceil(x/y)*y; } </code></pre> <p>I understand the fact the float cannot always be represented accurately in a byte. e.g 1/3. I also know my stepsize <strong>being 0.1</strong>. If I have the stepsize how could I get a proper output?</p> <p>The strange thing is that its the first time I've encountered this type of problem. Maybe I dont play with float enough.</p>
[ { "answer_id": 350258, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 1, "selected": false, "text": "float value = 1.0F;\n\nfor (int i = 0; i < 20; i++)\n{\n value -= 0.1F;\n Console.WriteLine(Math.Round(value, 1).ToStr...
2008/12/08
[ "https://Stackoverflow.com/questions/350240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32032/" ]
350,250
<p>I need a RegEx pattern for extracting all the properties of an image tag.</p> <p>As we all know, there are lots of malformed HTML out there, so the pattern has to cover those possibilities.</p> <p>I was looking at this solution <a href="https://stackoverflow.com/questions/138313/how-to-extract-img-src-title-and-alt-from-html-using-php" title="How to Extract img src title and alt">https://stackoverflow.com/questions/138313/how-to-extract-img-src-title-and-alt-from-html-using-php</a> but it didn't quite get it all:</p> <p>I come up something like:</p> <pre><code>(alt|title|src|height|width)\s*=\s*["'][\W\w]+?["'] </code></pre> <p>Is there any possibilities I'll be missing or a more efficient simple pattern?</p> <p>EDIT: <br>Sorry, I will be more specific, I'm doing this using .NET so it's on the server side. <br>I've already a list of img tags, now I just need to parse the properties.</p>
[ { "answer_id": 350274, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 0, "selected": false, "text": "element.attributes" }, { "answer_id": 1994371, "author": "Tor Valamo", "author_id": 228936, "author_prof...
2008/12/08
[ "https://Stackoverflow.com/questions/350250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41385/" ]
350,255
<p>Heres my link:</p> <p><a href="http://tinyurl.com/6j727e" rel="noreferrer">http://tinyurl.com/6j727e</a></p> <p>If you click on the link in test.php, it opens in a modal box which is using the jquery 'facebox' script.</p> <p>I'm trying to act upon a click event in this box, and if you view source of test.php you'll see where I'm trying to loacte the link within the modal box.</p> <pre><code> $('#facebox .hero-link').click(alert('click!')); </code></pre> <p>However, it doesn't detect a click and oddly enough the click event runs when the page loads.</p> <p>The close button DOES however have a click event built in that closes the box, and I suspect my home-grown click event is being prevented somehow, but I can't figure it out.</p> <p>Can anyone help? Typically its the very last part of a project and its holding me up, as is always the way ;)</p>
[ { "answer_id": 350289, "author": "Ryan McGeary", "author_id": 8985, "author_profile": "https://Stackoverflow.com/users/8985", "pm_score": 4, "selected": true, "text": "#click" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/350255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
350,264
<p>I have an Excel spreadsheet containing a list of strings. Each string is made up of several words, but the number of words in each string is different.</p> <p>Using built in Excel functions (no VBA), is there a way to isolate the last word in each string?</p> <p>Examples:</p> <pre> Are you classified as human? -> human? Negative, I am a meat popsicle -> popsicle Aziz! Light! -> Light!</pre>
[ { "answer_id": 350296, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "=RIGHT(A1,LEN(A1)-FIND(\"`*`\",SUBSTITUTE(A1,\" \",\"`*`\",LEN(A1)-LEN(SUBSTITUTE(A1,\" \",\"\"))))) \n" }, { "answer_...
2008/12/08
[ "https://Stackoverflow.com/questions/350264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33686/" ]
350,278
<p>I have problem with starting processes in impersonated context in ASP.NET 2.0.</p> <p>I am starting new Process in my web service code. IIS 5.1, .NET 2.0</p> <pre><code>[WebMethod] public string HelloWorld() { string path = @"C:\KB\GetWindowUser.exe"; ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = Path.GetDirectoryName(path); startInfo.FileName = path; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.ErrorDialog = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; Process docCreateProcess = Process.Start(startInfo); string errors = docCreateProcess.StandardError.ReadToEnd(); string output = docCreateProcess.StandardOutput.ReadToEnd(); } </code></pre> <p>The "C:\KB\GetWindowUser.exe" is console application containing following code:</p> <pre><code>static void Main(string[] args) { Console.WriteLine("Windows: " + WindowsIdentity.GetCurrent().Name); } </code></pre> <p>When I invoke web service without impersonation, everything works fine.</p> <p>When I turn on impersonation, following error is written in "errors" variable in web service code:</p> <p>Unhandled Exception: System.Security.SecurityException: Access is denied.\r\n\r\n at System.Security.Principal.WindowsIdentity.GetCurrentInternal(TokenAccessLevels desiredAccess, Boolean threadOnly)\r\n at System.Security.Principal.WindowsIdentity.GetCurrent()\r\n at ObfuscatedMdc.Program.Main(String[] args)\r\nThe Zone of the assembly that failed was:\r\nMyComputer</p> <p>Impersonated user is local administrator and has access to C:\KB\GetWindowUser.exe executable.</p> <p>When I specify window user explicitly in ProcesStartInfo properties Domain, User and Password, I got following message: <a href="http://img201.imageshack.us/img201/5870/pstartah8.jpg">http://img201.imageshack.us/img201/5870/pstartah8.jpg</a></p> <p>Is it possible to start process with different credentials than ASPNET from asp.net (IIS 5.1) ?</p>
[ { "answer_id": 850913, "author": "Jeow Li Huan", "author_id": 263003, "author_profile": "https://Stackoverflow.com/users/263003", "pm_score": 1, "selected": false, "text": "using (Impersonator person = new Impersonator(\"domainName\", \"userName\",\n\"password\")\n{\n // do something ...
2008/12/08
[ "https://Stackoverflow.com/questions/350278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43178/" ]
350,292
<p>Given the following classes and controller action method:</p> <pre><code>public School { public Int32 ID { get; set; } publig String Name { get; set; } public Address Address { get; set; } } public class Address { public string Street1 { get; set; } public string City { get; set; } public String ZipCode { get; set; } public String State { get; set; } public String Country { get; set; } } [Authorize(Roles = "SchoolEditor")] [AcceptVerbs(HttpVerbs.Post)] public SchoolResponse Edit(Int32 id, FormCollection form) { School school = GetSchoolFromRepository(id); UpdateModel(school, form); return new SchoolResponse() { School = school }; } </code></pre> <p>And the following form:</p> <pre><code>&lt;form method="post"&gt; School: &lt;%= Html.TextBox("Name") %&gt;&lt;br /&gt; Street: &lt;%= Html.TextBox("Address.Street") %&gt;&lt;br /&gt; City: &lt;%= Html.TextBox("Address.City") %&gt;&lt;br /&gt; Zip Code: &lt;%= Html.TextBox("Address.ZipCode") %&gt;&lt;br /&gt; Sate: &lt;select id="Address.State"&gt;&lt;/select&gt;&lt;br /&gt; Country: &lt;select id="Address.Country"&gt;&lt;/select&gt;&lt;br /&gt; &lt;/form&gt; </code></pre> <p>I am able to update both the School instance and the Address member of the school. This is quite nice! Thank you ASP.NET MVC team!</p> <p>However, how do I use jQuery to select the drop down list so that I can pre-fill it? I realize that I could do this server side but there will be other dynamic elements on the page that affect the list.</p> <p>The following is what I have so far, and it does not work as the selectors don't seem to match the IDs:</p> <pre><code>$(function() { $.getJSON("/Location/GetCountryList", null, function(data) { $("#Address.Country").fillSelect(data); }); $("#Address.Country").change(function() { $.getJSON("/Location/GetRegionsForCountry", { country: $(this).val() }, function(data) { $("#Address.State").fillSelect(data); }); }); }); </code></pre>
[ { "answer_id": 350300, "author": "bdukes", "author_id": 2688, "author_profile": "https://Stackoverflow.com/users/2688", "pm_score": 9, "selected": true, "text": "$(function() {\n $.getJSON(\"/Location/GetCountryList\", null, function(data) {\n $(\"#Address\\\\.Country\").fillSelect(d...
2008/12/08
[ "https://Stackoverflow.com/questions/350292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32588/" ]
350,298
<p>I have found the before_dispatch and after_dispatch in dispatcher.rb but I need to access something earlier. Like around when Rails.public_path is defined.</p>
[ { "answer_id": 445124, "author": "eelco", "author_id": 8293, "author_profile": "https://Stackoverflow.com/users/8293", "pm_score": 1, "selected": false, "text": "config/boot.rb" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/350298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
350,308
<p>I'm making a webpage with dynamic content that enters the view with AJAX polling. The page JS occasionally downloads updated information and renders it on the page while the user is reading other information. This sort of thing is costly to bandwidth and processing time. I would like to have the polling pause when the page is not being viewed.</p> <p>I've noticed most of the webpages I have open spend the majority of their time minimized or in a nonviewed tab. I'd like to be able to pause the scripts until the page is actually being viewed.</p> <p>I have no idea how to do it, and it seems to be trying to break out of the sandbox of the html DOM and reach into the user's system. It may be impossible, if the JS engine has no knowledge of its rendering environment. I've never even seen a different site do this (not that the user is intended to see it...)</p> <p>So it makes for an interesting question for discussion, I think. How would you write a web app that is CPU heavy to pause when not being used? Giving the user a pause button is not reliable, I'd like it to be automatic.</p>
[ { "answer_id": 350343, "author": "Pim Jager", "author_id": 35197, "author_profile": "https://Stackoverflow.com/users/35197", "pm_score": 3, "selected": true, "text": " var inactiveTimer;\n var active = true;\n function setTimer(){\n inactiveTimer = setTimeOut(\"stopAjaxUpdateFunction()\...
2008/12/08
[ "https://Stackoverflow.com/questions/350308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36093/" ]
350,314
<p>I have some XML in an XmlDocument, and I want to display it on an ASP.NET page. (The XML should be in a control; the page will have other content.) Right now, we're using the Xml control for that. Trouble is, the XML displays with no indentation. Ugly.</p> <p>It appears that I'm supposed to create an XSLT for it, but that seems kind of boring. I'd rather just throw it into a control and have it automagically parse the XML and indent correctly. Is there an easy way to do that?</p>
[ { "answer_id": 350324, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 2, "selected": false, "text": "< iframe runat=\"server\" id=\"myXMLFrame\" src=\"~/MyXmlFile.xml\" /></pre>\n" } ]
2008/12/08
[ "https://Stackoverflow.com/questions/350314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5486/" ]
350,318
<p>I have a single large table which I would like to optimize. I'm using MS-SQL 2005 server. I'll try to describe how it is used and if anyone has any suggestions I would appreciate it very much.</p> <p>The table is about 400GB, has 100 million rows and 1 million rows are inserted each day. The table has 8 columns, 1 data col and 7 columns used for lookups/ordering. </p> <pre><code> k1 k2 k3 k4 k5 k6 k7 d1 </code></pre> <p>where</p> <pre><code> k1: varchar(3), primary key - clustered index, 10 possible values k2: bigint, primary key - clustered index, total rows/10 possible values k3: int, 10 possible values k4: money, 100 possible values k5: bool k6: bool k7: DateTime </code></pre> <p>Only one select query is run which looks like this:</p> <pre><code> SELECT TOP(g) d1 FROM table WITH(NOLOCK) WHERE k1 = a AND k3 = c AND k4 = d AND k5 = e AND k6 = f ORDER BY k7 </code></pre> <p>where g = circa 1 million This query us ran about 10 times per day (often while inserts are happening) and takes about 5-30 minutes.</p> <p>So I currently only have a clustered index on the two primary key columns. My question is: what indexes should I add to improve this query's performance?</p> <p>Would separate indexes on every column be a good choice? I think a single index would take up about 5-8GB. The DB server has 8GB RAM total.</p> <p>Please do not say that the best thing is to experiment. This is akin to 'I don't know, work it out your self' :)</p> <p>Any tips much appreciated!</p> <p><hr> EDIT by doofledorfer--</p> <p>You've caused an outbreak of premature optimization here, if not outright suggestions that "the best thing is to experiment". You need to clarify a number of issues if you want useful help.</p> <p>-- doofledorfer <hr> EDIT: Comments on posts to date are now posted below along with query plan - Mr. Flibble</p> <hr> <blockquote> <p>You are probably I/O bound</p> </blockquote> <p>Yes, it is not CPU bound. Disk access is high. All available RAM seems to be used. Whether it is used wisely or not remains to be seen.</p> <blockquote> <p>You say you can't split the data because all the data is used: IMPOSSIBLE</p> </blockquote> <p>I mean that all data is used at some point - not that all data is used by each user in each query. I can certainly split the data but, so far, I don't understand why partitioning the table is any better than using a clustered index.</p> <blockquote> <p>Why did you choose these types VARCHAR probably should have been INT as it can only be a few values. The rest are sensible enough, Money represents a money value in real life and bigint is an ID, and the bools are onny, offy type things :)</p> <p>By any chance we could get have a look the insert statement, or TSQL or the bulkinsert </p> </blockquote> <p>TSQL. Its basically INSERT INTO table VALUES (k1,k2,k3,k4,k5,k6,d1). The only thing that is in any way interesting is that many duplicate inserts are attempted and the k1 &amp; k2 PK constraint is used to prevent duplicate data entering the database. I believed at design time (and now) that this was as quick a way as any to finter out duplicate data. </p> <blockquote> <p>Can you tell how often your insert happens Every 10 minutes or so inserts run (ADO.NET) maybe 10K at a time and take a few minutes. I estimate currently a full day's inserts take 40% of the time in the day. </p> <p>Does the DateTime field contains the date of insert No. There is actually another DateTime column which does but it is not retrieved in any SELECT query so I didn't mention it for the sake of simplicity.</p> <p>How did you came to this More one man day thinking. </p> <p>if you're interested only in the last data, deleting/archiving the useless data could make sense (start from scratch every morning)</p> </blockquote> <p>I am not interested in recent data only. A query may select some of the very first data that was inserted into the table all the way up to data inserted minutes ago. But as the data is filtered this does not mean that all the data in the DB is requested in that query.</p> <blockquote> <p>if there is only one "inserter" and only one "reader", you may want to switch to a specialised type (hashmap/list/deque/stack) or something more elaborated, in a programming language.</p> </blockquote> <p>I will probably stick with MSSQL for the moment. It's not broke yet, just a little slow.</p> <p>liggett78, do you suggest a clustered index on columns k1,k4,k5,k6,k3 or a non-clustered index on those columns?</p> <hr> <p>My main question right now is should I extend the current clustered index to contain k4 also (this is the col with next most possible values) or should I just add a non-clustered index to k4.</p> <p>Would adding all k1-k6 to a clustered index be an option? Then have a separate non-clustered index on the DateTime column for the ORDER BY? Am I correct in thinking that this would not cause any major increase in DB size but will only affect insert times. Can anyone guesstimate the effect this will have on inserts?</p> <p>I think that if adding indexes to all the columns will double the DB size then it is not viable without large (ie. hardware) changes. </p> <hr> <p>The following plan was run with an index (non clustered) on the DATE column.</p> <p>EDIT: Not sure if you can see the XML below so here is a link to it: <a href="http://conormccarthy.com/box/queryplan.sqlplan.txt" rel="nofollow noreferrer">http://conormccarthy.com/box/queryplan.sqlplan.txt</a></p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;ShowPlanXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0" Build="9.00.1399.06" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan"&gt; &lt;BatchSequence&gt; &lt;Batch&gt; &lt;Statements&gt; &lt;StmtSimple StatementCompId="1" StatementEstRows="11111" StatementId="1" StatementOptmLevel="FULL" StatementSubTreeCost="625.754" StatementText="SELECT TOP(11111) d1 FROM hands WITH (NOLOCK) &amp;#xD;&amp;#xA; WHERE k4 = '10' &amp;#xD;&amp;#xA; AND k6 = 1 &amp;#xD;&amp;#xA; AND k5 = 1 &amp;#xD;&amp;#xA; AND k1 = 'IPN' &amp;#xD;&amp;#xA; AND k3 BETWEEN 2 AND 10 &amp;#xD;&amp;#xA; ORDER BY k7 DESC&amp;#xD;&amp;#xA;&amp;#xD;&amp;#xA;" StatementType="SELECT"&gt; &lt;StatementSetOptions ANSI_NULLS="false" ANSI_PADDING="false" ANSI_WARNINGS="false" ARITHABORT="true" CONCAT_NULL_YIELDS_NULL="false" NUMERIC_ROUNDABORT="false" QUOTED_IDENTIFIER="false" /&gt; &lt;QueryPlan DegreeOfParallelism="1" CachedPlanSize="36"&gt; &lt;MissingIndexes&gt; &lt;MissingIndexGroup Impact="81.7837"&gt; &lt;MissingIndex Database="[MYDB]" Schema="[dbo]" Table="[Hands]"&gt; &lt;ColumnGroup Usage="EQUALITY"&gt; &lt;Column Name="[k1]" ColumnId="1" /&gt; &lt;Column Name="[k4]" ColumnId="7" /&gt; &lt;Column Name="[k5]" ColumnId="9" /&gt; &lt;Column Name="[k6]" ColumnId="10" /&gt; &lt;/ColumnGroup&gt; &lt;ColumnGroup Usage="INEQUALITY"&gt; &lt;Column Name="[k3]" ColumnId="6" /&gt; &lt;/ColumnGroup&gt; &lt;ColumnGroup Usage="INCLUDE"&gt; &lt;Column Name="[d1]" ColumnId="3" /&gt; &lt;Column Name="[k7]" ColumnId="4" /&gt; &lt;/ColumnGroup&gt; &lt;/MissingIndex&gt; &lt;/MissingIndexGroup&gt; &lt;/MissingIndexes&gt; &lt;RelOp AvgRowSize="75" EstimateCPU="0.0011111" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimateRows="11111" LogicalOp="Top" NodeId="0" Parallel="false" PhysicalOp="Top" EstimatedTotalSubtreeCost="625.754"&gt; &lt;OutputList&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="d1" /&gt; &lt;/OutputList&gt; &lt;RunTimeInformation&gt; &lt;RunTimeCountersPerThread Thread="0" ActualRows="11111" ActualEndOfScans="1" ActualExecutions="1" /&gt; &lt;/RunTimeInformation&gt; &lt;Top RowCount="false" IsPercent="false" WithTies="false"&gt; &lt;TopExpression&gt; &lt;ScalarOperator ScalarString="(11111)"&gt; &lt;Const ConstValue="(11111)" /&gt; &lt;/ScalarOperator&gt; &lt;/TopExpression&gt; &lt;RelOp AvgRowSize="83" EstimateCPU="135.557" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimateRows="11111" LogicalOp="Filter" NodeId="1" Parallel="false" PhysicalOp="Filter" EstimatedTotalSubtreeCost="625.753"&gt; &lt;OutputList&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="d1" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k7" /&gt; &lt;/OutputList&gt; &lt;RunTimeInformation&gt; &lt;RunTimeCountersPerThread Thread="0" ActualRows="11111" ActualEndOfScans="0" ActualExecutions="1" /&gt; &lt;/RunTimeInformation&gt; &lt;Filter StartupExpression="false"&gt; &lt;RelOp AvgRowSize="96" EstimateCPU="318.331" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimateRows="195691" LogicalOp="Inner Join" NodeId="2" Parallel="false" PhysicalOp="Nested Loops" EstimatedTotalSubtreeCost="625.404"&gt; &lt;OutputList&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="d1" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k7" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k3" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k4" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k5" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k6" /&gt; &lt;/OutputList&gt; &lt;RunTimeInformation&gt; &lt;RunTimeCountersPerThread Thread="0" ActualRows="341958" ActualEndOfScans="0" ActualExecutions="1" /&gt; &lt;/RunTimeInformation&gt; &lt;NestedLoops Optimized="false" WithOrderedPrefetch="true"&gt; &lt;OuterReferences&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k1" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="HandId" /&gt; &lt;ColumnReference Column="Expr1003" /&gt; &lt;/OuterReferences&gt; &lt;RelOp AvgRowSize="32" EstimateCPU="330.366" EstimateIO="790.88" EstimateRebinds="0" EstimateRewinds="0" EstimateRows="195691" LogicalOp="Index Scan" NodeId="4" Parallel="false" PhysicalOp="Index Scan" EstimatedTotalSubtreeCost="2.88444"&gt; &lt;OutputList&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k1" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="HandId" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k7" /&gt; &lt;/OutputList&gt; &lt;RunTimeInformation&gt; &lt;RunTimeCountersPerThread Thread="0" ActualRows="341958" ActualEndOfScans="0" ActualExecutions="1" /&gt; &lt;/RunTimeInformation&gt; &lt;IndexScan Ordered="true" ScanDirection="BACKWARD" ForcedIndex="false" NoExpandHint="false"&gt; &lt;DefinedValues&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k1" /&gt; &lt;/DefinedValue&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="HandId" /&gt; &lt;/DefinedValue&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k7" /&gt; &lt;/DefinedValue&gt; &lt;/DefinedValues&gt; &lt;Object Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Index="[ix_dateplayed]" /&gt; &lt;Predicate&gt; &lt;ScalarOperator ScalarString="[MYDB].[dbo].[Hands].[k1]=N'IPN'"&gt; &lt;Compare CompareOp="EQ"&gt; &lt;ScalarOperator&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k1" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Const ConstValue="N'IPN'" /&gt; &lt;/ScalarOperator&gt; &lt;/Compare&gt; &lt;/ScalarOperator&gt; &lt;/Predicate&gt; &lt;/IndexScan&gt; &lt;/RelOp&gt; &lt;RelOp AvgRowSize="88" EstimateCPU="0.0001581" EstimateIO="0.003125" EstimateRebinds="195691" EstimateRewinds="0" EstimateRows="1" LogicalOp="Clustered Index Seek" NodeId="6" Parallel="false" PhysicalOp="Clustered Index Seek" EstimatedTotalSubtreeCost="621.331"&gt; &lt;OutputList&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="d1" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k3" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k4" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k5" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k6" /&gt; &lt;/OutputList&gt; &lt;RunTimeInformation&gt; &lt;RunTimeCountersPerThread Thread="0" ActualRows="341958" ActualEndOfScans="0" ActualExecutions="341958" /&gt; &lt;/RunTimeInformation&gt; &lt;IndexScan Lookup="true" Ordered="true" ScanDirection="FORWARD" ForcedIndex="false" NoExpandHint="false"&gt; &lt;DefinedValues&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="d1" /&gt; &lt;/DefinedValue&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k3" /&gt; &lt;/DefinedValue&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k4" /&gt; &lt;/DefinedValue&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k5" /&gt; &lt;/DefinedValue&gt; &lt;DefinedValue&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k6" /&gt; &lt;/DefinedValue&gt; &lt;/DefinedValues&gt; &lt;Object Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Index="[PK_Hands]" TableReferenceId="-1" /&gt; &lt;SeekPredicates&gt; &lt;SeekPredicate&gt; &lt;Prefix ScanType="EQ"&gt; &lt;RangeColumns&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k1" /&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="HandId" /&gt; &lt;/RangeColumns&gt; &lt;RangeExpressions&gt; &lt;ScalarOperator ScalarString="[MYDB].[dbo].[Hands].[k1]"&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k1" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator ScalarString="[MYDB].[dbo].[Hands].[HandId]"&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="HandId" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;/RangeExpressions&gt; &lt;/Prefix&gt; &lt;/SeekPredicate&gt; &lt;/SeekPredicates&gt; &lt;/IndexScan&gt; &lt;/RelOp&gt; &lt;/NestedLoops&gt; &lt;/RelOp&gt; &lt;Predicate&gt; &lt;ScalarOperator ScalarString="[MYDB].[dbo].[Hands].[k4]=($10.0000) AND [MYDB].[dbo].[Hands].[k6]=(1) AND [MYDB].[dbo].[Hands].[k5]=(1) AND [MYDB].[dbo].[Hands].[k3]&amp;gt;=(2) AND [MYDB].[dbo].[Hands].[k3]&amp;lt;=(10)"&gt; &lt;Logical Operation="AND"&gt; &lt;ScalarOperator&gt; &lt;Compare CompareOp="EQ"&gt; &lt;ScalarOperator&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k4" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Const ConstValue="($10.0000)" /&gt; &lt;/ScalarOperator&gt; &lt;/Compare&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Compare CompareOp="EQ"&gt; &lt;ScalarOperator&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k6" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Const ConstValue="(1)" /&gt; &lt;/ScalarOperator&gt; &lt;/Compare&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Compare CompareOp="EQ"&gt; &lt;ScalarOperator&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k5" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Const ConstValue="(1)" /&gt; &lt;/ScalarOperator&gt; &lt;/Compare&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Compare CompareOp="GE"&gt; &lt;ScalarOperator&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k3" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Const ConstValue="(2)" /&gt; &lt;/ScalarOperator&gt; &lt;/Compare&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Compare CompareOp="LE"&gt; &lt;ScalarOperator&gt; &lt;Identifier&gt; &lt;ColumnReference Database="[MYDB]" Schema="[dbo]" Table="[Hands]" Column="k3" /&gt; &lt;/Identifier&gt; &lt;/ScalarOperator&gt; &lt;ScalarOperator&gt; &lt;Const ConstValue="(10)" /&gt; &lt;/ScalarOperator&gt; &lt;/Compare&gt; &lt;/ScalarOperator&gt; &lt;/Logical&gt; &lt;/ScalarOperator&gt; &lt;/Predicate&gt; &lt;/Filter&gt; &lt;/RelOp&gt; &lt;/Top&gt; &lt;/RelOp&gt; &lt;/QueryPlan&gt; &lt;/StmtSimple&gt; &lt;/Statements&gt; &lt;/Batch&gt; &lt;/BatchSequence&gt; &lt;/ShowPlanXML&gt; </code></pre>
[ { "answer_id": 350358, "author": "nicodemus13", "author_id": 26463, "author_profile": "https://Stackoverflow.com/users/26463", "pm_score": 2, "selected": false, "text": "SELECT TOP(g) d1 \nFROM table WITH(NOLOCK) \nWHERE k1 = a WHERE k2 = b WHERE k3 = c WHERE k4 = d WHERE k5 = e WH...
2008/12/08
[ "https://Stackoverflow.com/questions/350318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34632/" ]
350,323
<p>I have a utility (grep) that gives me a list of filenames and a line numbers. After I have determined that devenv is the correct program to open a file, I would like to ensure that it is opened at the indicated line number. In emacs, this would be:</p> <pre><code>emacs +140 filename.c </code></pre> <p>I have found nothing like this for Visual Studio (devenv). The closest I have found is:</p> <pre><code>devenv /Command "Edit.Goto 140" filename.c </code></pre> <p>However, this makes a separate instance of devenv for each such file. I would rather have something that uses an existing instance.</p> <p>These variations re-use an existing devenv, but don't go to the indicated line:</p> <pre><code>devenv /Command "Edit.Goto 140" /Edit filename.c devenv /Command /Edit filename.c "Edit.Goto 140" </code></pre> <p>I thought that using multiple "/Command" arguments might do it, but I probably don't have the right one because I either get errors or no response at all (other than opening an empty devenv).</p> <p>I could write a special macro for devenv, but I would like this utility to be used by others that don't have that macro. And I'm not clear on how to invoke that macro with the "/Command" option.</p> <p>Any ideas?</p> <hr> <p>Well, it doesn't appear that there is a way to do this as I wanted. Since it looks like I'll need to have dedicated code to start up Visual Studio, I've decided to use EnvDTE as shown below. Hopefully this will help somebody else.</p> <pre class="lang-cpp prettyprint-override"><code>#include "stdafx.h" //----------------------------------------------------------------------- // This code is blatently stolen from http://benbuck.com/archives/13 // // This is from the blog of somebody called "BenBuck" for which there // seems to be no information. //----------------------------------------------------------------------- // import EnvDTE #pragma warning(disable : 4278) #pragma warning(disable : 4146) #import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("8.0") lcid("0") raw_interfaces_only named_guids #pragma warning(default : 4146) #pragma warning(default : 4278) bool visual_studio_open_file(char const *filename, unsigned int line) { HRESULT result; CLSID clsid; result = ::CLSIDFromProgID(L"VisualStudio.DTE", &amp;clsid); if (FAILED(result)) return false; CComPtr&lt;IUnknown&gt; punk; result = ::GetActiveObject(clsid, NULL, &amp;punk); if (FAILED(result)) return false; CComPtr&lt;EnvDTE::_DTE&gt; DTE; DTE = punk; CComPtr&lt;EnvDTE::ItemOperations&gt; item_ops; result = DTE-&gt;get_ItemOperations(&amp;item_ops); if (FAILED(result)) return false; CComBSTR bstrFileName(filename); CComBSTR bstrKind(EnvDTE::vsViewKindTextView); CComPtr&lt;EnvDTE::Window&gt; window; result = item_ops-&gt;OpenFile(bstrFileName, bstrKind, &amp;window); if (FAILED(result)) return false; CComPtr&lt;EnvDTE::Document&gt; doc; result = DTE-&gt;get_ActiveDocument(&amp;doc); if (FAILED(result)) return false; CComPtr&lt;IDispatch&gt; selection_dispatch; result = doc-&gt;get_Selection(&amp;selection_dispatch); if (FAILED(result)) return false; CComPtr&lt;EnvDTE::TextSelection&gt; selection; result = selection_dispatch-&gt;QueryInterface(&amp;selection); if (FAILED(result)) return false; result = selection-&gt;GotoLine(line, TRUE); if (FAILED(result)) return false; return true; } </code></pre>
[ { "answer_id": 350401, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 1, "selected": true, "text": "devenv /command \"Macros.MyMacros.Module1.OpenFavoriteFiles\"\n" }, { "answer_id": 3678070, "author": "Four...
2008/12/08
[ "https://Stackoverflow.com/questions/350323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10574/" ]
350,345
<p>Is there a way run Emacs from a USB drive? I am a Windows user and I would like to be able use it on any PC without an Emacs install.</p>
[ { "answer_id": 350369, "author": "ShreevatsaR", "author_id": 4958, "author_profile": "https://Stackoverflow.com/users/4958", "pm_score": 6, "selected": true, "text": " (info \"(emacs) Windows HOME\")\n" }, { "answer_id": 6692788, "author": "sayth", "author_id": 461887, ...
2008/12/08
[ "https://Stackoverflow.com/questions/350345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]