qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
382,382
<p>Is there any way in JavaScript how to find out user clicked through the same domain 2 or more times? </p> <p>I need to popup a window after user clicked anywhere on the site for 3 times. I know how to do it after one click - with <code>document.referrer</code> or <code>addEventListener</code>, but then I'm lost.</p> <p>I need something that will capture all click events (not only links) and count them. </p>
[ { "answer_id": 382701, "author": "Adriana", "author_id": 46866, "author_profile": "https://Stackoverflow.com/users/46866", "pm_score": 0, "selected": false, "text": "var **allLinks** = document.getElementsByTagName(\"a\");\n\nvar **clicked** = 0;\n\n**doCookie**('popunder',clicked,1);\n\...
2008/12/19
[ "https://Stackoverflow.com/questions/382382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46866/" ]
382,383
<p>I am working on an ASP.NET page that we, in code impersonate the requesting user. We are using the following code to start impersonating.</p> <pre><code>Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity currentWindowsIdentity = CType(User.Identity, System.Security.Principal.WindowsIdentity) impersonationContext = currentWindowsIdentity.Impersonate() </code></pre> <p>After this we have validated that the application is running under the proper context by calling:</p> <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name </code></pre> <p>This returns the proper identity of the user, and file access and other items appear to be using their account. However when using the Microsoft Application Data Application Block SqlHelper class to call out to a database using a trusted connection authentication fails for the "NT AUTHORITY\ANONYMOUS LOGON" user.</p> <p>We can re-validate after the failure that the current identity is still our desired account and NOT the ANONYMOUS LOGIN account.</p> <p>Does anyone have an idea why this is? Or more specifically how we can get around it?</p> <p><strong>Edit</strong> Some additional information about how the calls from these pages work.</p> <p>We do the impersonate call from the .aspx page.</p> <p>After we impersonate we call out to a "business logic" assembly that is referecned.</p> <p>We know that the context identity is still correct here.</p> <p>After that, the "business logic" assembly calls another assembly that actually executes the trusted connection call. We cannot modify this "data access" assembly, the authentication exception is reported by this assembly as well.</p>
[ { "answer_id": 382436, "author": "Dan Esparza", "author_id": 19020, "author_profile": "https://Stackoverflow.com/users/19020", "pm_score": 0, "selected": false, "text": "Using impersonationContext = currentWindowsIdentity.Impersonate() \n' Logic here \nEnd Using\n" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13279/" ]
382,406
<p>We're on Team Foundation Server 2008 and I'm trying to find a way to report on the change in completed work from week to week at the task level. The MDX query below works pretty well, but I'd like to get rid of need to hard code last week's date. I've tried using prevmember and parallelperiod without success, but I'm no MDX expert. </p> <pre><code>WITH MEMBER [Measures].[Completed Work by WI on dt1] AS ( [Assigned To].[Person].CurrentMember, [Work Item].[System_Id].CurrentMember, [Date].[Year Week Date].[Week].&amp;[2008-12-07T00:00:00], [Measures].[Microsoft_VSTS_Scheduling_CompletedWork] ) MEMBER [Measures].[Completed Work by WI on dt2] AS ( [Assigned To].[Person].CurrentMember, [Work Item].[System_Id].CurrentMember, [Date].[Year Week Date].CurrentMember, [Measures].[Microsoft_VSTS_Scheduling_CompletedWork] ) MEMBER [Measures].[Completed Work] AS [Measures].[Completed Work by WI on dt2] - [Measures].[Completed Work by WI on dt1] SELECT NON EMPTY { [Measures].[Completed Work] } ON COLUMNS, NON EMPTY { Filter( ([Assigned To].[Person].[Person],[Work Item].[System_Id].[System_Id],[Work Item].[System_Title].[System_Title]), [Measures].[Completed Work] &gt;0 ) } ON ROWS FROM [Team System] </code></pre>
[ { "answer_id": 386400, "author": "Paul G", "author_id": 162, "author_profile": "https://Stackoverflow.com/users/162", "pm_score": 0, "selected": false, "text": "StrToMember(\"[Date].[Year Week Date].[Week].&[\" + Format(DATEADD(\"d\", -7, \"2008-12-21\"), \"s\") + \"]\")\n" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/162/" ]
382,416
<p>Im using YUI and am having alignment problems with YUI buttons inline with text input fields. The rendering problem is occuring in FF3 and is even present on YUI's own site.</p> <p><a href="http://developer.yahoo.com/yui/examples/button/btn_example09.html" rel="nofollow noreferrer">http://developer.yahoo.com/yui/examples/button/btn_example09.html</a></p> <p>As you can see the button sits higher than the text fields. Any ideas on how to get it all at the same height?</p>
[ { "answer_id": 386400, "author": "Paul G", "author_id": 162, "author_profile": "https://Stackoverflow.com/users/162", "pm_score": 0, "selected": false, "text": "StrToMember(\"[Date].[Year Week Date].[Week].&[\" + Format(DATEADD(\"d\", -7, \"2008-12-21\"), \"s\") + \"]\")\n" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37575/" ]
382,418
<p>I'm wondering if anyone knows how this happens? My website is down, but every computer on my internet connection/router can see it. I've cleared my cache etc, but another computer in the house shouldn't be seeing a site that's offline. How weird?</p> <p>It's hosted remotely, not on my network or anything. </p>
[ { "answer_id": 382714, "author": "oz10", "author_id": 14069, "author_profile": "https://Stackoverflow.com/users/14069", "pm_score": 2, "selected": true, "text": "telnet 255.255.255.255 80\n GET / HTTP/1.0\n GET / HTTP/1.1\nHost: www.yourservername.com\n" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42589/" ]
382,449
<p><strong>Closed as exact duplicate of <a href="https://stackoverflow.com/questions/228164/on-design-patterns-when-to-use-the-singleton">this question</a>. But reopened, as the other Singleton questions are for general use and not use for DB access</strong></p> <p>I was thinking of making an internal data access class a Singleton but couldn't convince myself on the choice mainly because the class has no state except for local variables in its methods. </p> <p>What is the purpose of designing such classes to be Singletons after all?<br> Is it warranting sequential access to the database which is not convincing since most modern databases could handle concurrency well?<br> Is it the ability to use a single connection repeatedly which could be taken care of through connection pooling? Or Is it saving memory by running a single instance? </p> <p>Please enlighten me on this one. </p>
[ { "answer_id": 382505, "author": "Limbic System", "author_id": 1274957, "author_profile": "https://Stackoverflow.com/users/1274957", "pm_score": 1, "selected": false, "text": "readResolve()" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46483/" ]
382,464
<p>When I upload a file to a site using the ASP:File control the FileName property is different in IE and Firefox. In Firefox, it just provides the name of the file, but IE provides the full path to the file.</p> <p>I have worked around this by adding the code:</p> <pre><code>Dim FileName As String = file.FileName If FileName.LastIndexOf("\") &gt; 0 Then FileName = FileName.Substring(FileName.LastIndexOf("\") + 1) End If </code></pre> <p>But I'm not sure why that would be different between the different browsers. Does anyone know the reason for this?</p> <p>Thanks.</p>
[ { "answer_id": 7751228, "author": "SeeNoWeevil", "author_id": 771698, "author_profile": "https://Stackoverflow.com/users/771698", "pm_score": 5, "selected": false, "text": "new FileInfo(myHttpPostedFileBase.FileName).Name\n" }, { "answer_id": 16769240, "author": "feeeper", ...
2008/12/19
[ "https://Stackoverflow.com/questions/382464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10420/" ]
382,466
<p>I never actually thought I'd run into speed-issues with python, but I have. I'm trying to compare really big lists of dictionaries to each other based on the dictionary values. I compare two lists, with the first like so</p> <pre><code>biglist1=[{'transaction':'somevalue', 'id':'somevalue', 'date':'somevalue' ...}, {'transactio':'somevalue', 'id':'somevalue', 'date':'somevalue' ...}, ...] </code></pre> <p>With 'somevalue' standing for a user-generated string, int or decimal. Now, the second list is pretty similar, except the id-values are always empty, as they have not been assigned yet.</p> <pre><code>biglist2=[{'transaction':'somevalue', 'id':'', 'date':'somevalue' ...}, {'transactio':'somevalue', 'id':'', 'date':'somevalue' ...}, ...] </code></pre> <p>So I want to get a list of the dictionaries in biglist2 that match the dictionaries in biglist1 for all other keys <em>except</em> id.</p> <p>I've been doing </p> <pre><code>for item in biglist2: for transaction in biglist1: if item['transaction'] == transaction['transaction']: list_transactionnamematches.append(transaction) for item in biglist2: for transaction in list_transactionnamematches: if item['date'] == transaction['date']: list_transactionnamematches.append(transaction) </code></pre> <p>... and so on, not comparing id values, until I get a final list of matches. Since the lists can be really big (around 3000+ items each), this takes quite some time for python to loop through.</p> <p>I'm guessing this isn't really how this kind of comparison should be done. Any ideas?</p>
[ { "answer_id": 382495, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 0, "selected": false, "text": "for item in biglist2:\n for transaction in biglist1:\n if (item['transaction'] == transaction['transaction'] ...
2008/12/19
[ "https://Stackoverflow.com/questions/382466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40372/" ]
382,471
<p>We have an issue with the way we are creating a <code>Mutex</code>. The problem line is: </p> <pre><code>MutexAccessRule rule = new MutexAccessRule("Everyone", MutexRights.FullControl, AccessControlType.Allow); </code></pre> <p>The hardcoded "Everyone" string only works on English OSes, how do we change this line so it works in all languages? </p>
[ { "answer_id": 382476, "author": "Sam Saffron", "author_id": 17174, "author_profile": "https://Stackoverflow.com/users/17174", "pm_score": 5, "selected": true, "text": " SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);\n MutexAccessRule rule = new Mutex...
2008/12/19
[ "https://Stackoverflow.com/questions/382471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
382,473
<p>I'm trying to write a Cucumber scenario that requires me to have a logged in user - that would normally be quite simple but I'm only using OpenID authentication (curtosy of the authentication plugin). However after digging through the open_id_authentication plugins guts I'm not sure how I could achieve this within Cucumber.</p>
[ { "answer_id": 382597, "author": "DEfusion", "author_id": 6432, "author_profile": "https://Stackoverflow.com/users/6432", "pm_score": 3, "selected": true, "text": "ActionController::Base.class_eval do\n private\n\n def begin_open_id_authentication(identity_url, options = {})\n yield...
2008/12/19
[ "https://Stackoverflow.com/questions/382473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6432/" ]
382,474
<p>Is there a version of JDE for emacs that supports the JDK 6.10? I haven't been able to find any information on this. While it runs, every time I attempt to compile files the JDE says that it doesn't recognize my JDK version and reverts to assuming it is a Java5 version. </p>
[ { "answer_id": 382842, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 1, "selected": false, "text": "M-x customize-variable jde-jdk-registry M-x customize-variable jde-jdk" }, { "answer_id": 384642, "auth...
2008/12/19
[ "https://Stackoverflow.com/questions/382474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41241/" ]
382,475
<p>I have an MFC wrapper over a COM object. There is a function that takes a large number of options, which are mostly optional. How do I pass some arguments but not others? </p> <p>For what it's worth, the optional arguments are listed as VARIANT*.</p> <p>Below is the code</p> <pre><code>CComVariant vFalse = false; CApplication application; { application.CreateDispatch(_T("Word.Application")); CDocuments documents = application.get_Documents(); CComVariant vFilename = _T("c:\\temp\\test.rtf"); CComVariant vNothing; CComVariant vEmpty = _T(""); CComVariant vOpenFormat = 0; application.put_Visible(TRUE); // // THIS FUNCTION has a number of optional arguments // LPDISPATCH pDocument = documents.Open(&amp;vFilename, &amp;vFalse, &amp;vFalse, &amp;vFalse, &amp;vEmpty, &amp;vEmpty, &amp;vFalse, &amp;vEmpty, &amp;vEmpty, &amp;vOpenFormat, &amp;vOpenFormat, &amp;vFalse, &amp;vFalse, &amp;vOpenFormat, &amp;vFalse, &amp;vFalse); } application.Quit(&amp;vFalse, NULL, NULL); </code></pre>
[ { "answer_id": 382670, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": -1, "selected": false, "text": "_variant_t vtEmpty(VT_EMPTY);\n" }, { "answer_id": 580644, "author": "m-sharp", "author_id": 28678...
2008/12/19
[ "https://Stackoverflow.com/questions/382475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
382,478
<p>I've read a lot recently about how writing multi-threaded apps is a huge pain in the neck, and have learned enough about the topic to understand, at least at some level, why it is so. </p> <p>I've read that using functional programming techniques can help alleviate some of this pain, but I've never seen a simple example of functional code that is concurrent. So, what are some alternatives to using threads? At least, what are some ways to abstract them away so you needn't think about things like locking and whether a particular library's objects are thread-safe.</p> <p>I know Google's MapReduce is supposed to help with the problem, but I haven't seen a succinct explanation of it.</p> <p>Although I'm giving a specific example below, I'm more curious of general techniques than solving this specific problem (using the example to help illustrate other techniques would be helpful though). </p> <p>I came to the question when I wrote a simple web crawler as a learning exercise. It works pretty well, but it is slow. Most of the bottleneck comes from downloading pages. It is currently single threaded, and thus only downloads a single page at a time. Thus, if the pages can be downloaded concurrently, it would speed things up dramatically, even if the crawler ran on a single processor machine. I looked into using threads to solve the issue, but they scare me. Any suggestions on how to add concurrency to this type of problem without unleashing a terrible threading nightmare?</p>
[ { "answer_id": 382547, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": true, "text": "void DownloadHTMLFiles(List<string> urls)\n{\n foreach(string url in urls)\n {\n DownlaodOneFile(url); /...
2008/12/19
[ "https://Stackoverflow.com/questions/382478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30529/" ]
382,479
<p>I am using log4net in my .NET 3.5 console application and would like the log messages I generate to be seen in both the console standard out and the RollingFileAppender. The file output is working like a charm, but I am seeing a stream of status messages flowing to the console standard out when I execute. I would like to skip all the status information and only see the same messages I am programmatically generating to the log file.</p> <p>Here is an example of what I see after I run my app:</p> <pre><code>log4net: XmlHierarchyConfigurator: Configuration update mode [Merge]. log4net: XmlHierarchyConfigurator: Logger [root] Level string is [DEBUG]. log4net: XmlHierarchyConfigurator: Logger [root] level set to [name="DEBUG",value=30000]. log4net: XmlHierarchyConfigurator: Loading Appender [Console] type: [log4net.Appender.ConsoleAppender] log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False] </code></pre> <p>and it keeps on going until it describes the whole instantiation of the logger object.</p> <p>How do I turn this off? Can I? I've tried all sorts of config file settings, but nothing makes these go away! Grrr...</p>
[ { "answer_id": 547888, "author": "JustinB", "author_id": 66288, "author_profile": "https://Stackoverflow.com/users/66288", "pm_score": 4, "selected": false, "text": "< >" }, { "answer_id": 3555508, "author": "Ash", "author_id": 407198, "author_profile": "https://Stack...
2008/12/19
[ "https://Stackoverflow.com/questions/382479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,480
<p>Given a variable <code>foo</code> of type <code>FooClass*</code> and a member variable in that class named <code>bar</code>, is the distance between <code>foo</code> and <code>&amp;(foo-&gt;bar)</code> the same in any situation with some constraints:</p> <ol> <li><p><code>FooClass</code> is a non-POD type.</p></li> <li><p>We know that <code>foo</code> will always point to an instance of <code>FooClass</code>, and not some subtype of it.</p></li> <li><p>We only care about behaviour under a single compiler and a single compilation; that is, the value this may result in under gcc is never used in code compiled with MSVC, and it is never saved to be re-used between compilations. It is computed in the binary and used in the binary, and that is it.</p></li> <li><p>We don't use a custom <code>new</code>, although some instances of the class may be stack-allocated and some heap-allocated.</p></li> <li><p>There is no explicit <code>ctor</code> for <code>FooClass</code>; it relies upon the compiler-generated one (and each of the fields in <code>FooClass</code> is either POD or default-constructable).</p></li> </ol> <p>I can't find a guarantee either way on this in the standard (nor did I expect to), but my rudimentary testing with gcc leads me to believe that it will always be the case there. I also know that this guarantee is made for POD-types, but let us assume this type can't be POD.</p> <p><strong>An update/clarification:</strong> this is just for a single compilation of a single binary; the calculated offsets will never leave that single execution. Basically, I want to be able to uniquely identify the fields of a class in a static map and then be able to lookup into that map for some macro/template/EVIL trickery. It is merely for my own amusement, and no life support machines will rely on this code.</p>
[ { "answer_id": 382516, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 2, "selected": false, "text": "private public protected -> ." }, { "answer_id": 382559, "author": "Joel", "author_id": 468...
2008/12/19
[ "https://Stackoverflow.com/questions/382480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5066/" ]
382,482
<p>what are the best practices for using the 'sqlserver 2005 database project' in visual studio 2008?</p> <p>I have created a project file. How to create the scripts for stored procedures, views and Tables? How would I generate scripts to populate some of the look up data? </p> <p>What would I do about modifications that may need to be run on the production server after the database has already been deployed to production. (I imagine that I would create folders named by the deploy <strong>date</strong> with all the change scripts )</p> <p>Is there a way to have Team Build tear down and rebuild a database in order to test that all the scripts work? </p> <p>I have not been able to find a walk threw on the web. If you could point me in the right direction, It would be greatly appreciated.</p> <p>Thanks </p>
[ { "answer_id": 382516, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 2, "selected": false, "text": "private public protected -> ." }, { "answer_id": 382559, "author": "Joel", "author_id": 468...
2008/12/19
[ "https://Stackoverflow.com/questions/382482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31470/" ]
382,485
<p>I'm looking for something like <code>break</code> for loops.</p> <p>Here's some example code (using Symfony's lime) where <code>stop()</code> would not let the class continue and <code>I_DONT_WANT_THIS_TO_RUN()</code> would not be executed.</p> <pre><code>$browser-&gt;isStatusCode(200) -&gt;isRequestParameter('module', 'home') -&gt;isRequestParameter('action', 'index') -&gt;click('Register') -&gt;stop() -&gt;I_DONT_WANT_THIS_TO_RUN(); $browser-&gt;thenThisRunsOkay(); </code></pre> <p>Calling <code>$this-&gt;__deconstruct();</code> from within <code>stop()</code> doesn't seem to do the trick. Is there a function I can call within <code>stop()</code> that would make that happen?</p>
[ { "answer_id": 382510, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 3, "selected": false, "text": "// This function would of course be declared in the class\nfunction stop() {\n throw new Exception('Stopped.');\n}\n\nt...
2008/12/19
[ "https://Stackoverflow.com/questions/382485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46443/" ]
382,488
<p>Is there a way to create an exlicit relationship between two posts in WordPress regarless of what categories those posts might be in?</p> <p>The idea is that within the post template it would be obtain and list the related posts for the current post.</p> <p>I'm guessing you could achieve this using tags to group posts together, but that seems to be a hi-jacking of the tag system for a purpose for which is wasn't designed.</p> <p>Any ideas?</p>
[ { "answer_id": 382521, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 1, "selected": false, "text": "digg_url related__post" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3187/" ]
382,527
<p>I run into this regularly, and am just looking for best practice/approach. I have a database / datamodule-containing app, and want to fire up the database/datasets on startup w/o having "active at runtime" set to true at design time (database location varies). Also run a web "check for updates" routine when the app starts up. </p> <p>Given TForm event sequences, and results from various trial and error, I'm currently using this approach:</p> <p>I use a "Globals" record set up in the main form to store all global vars, have one element of that called Globals.AppInitialized (boolean), and set it to False in the Initialization section of the main form. </p> <p>At the main form's OnShow event (all forms are created by then), I test Globals.AppInitialized; if it's false, I run my "Initialization" stuff, and then finish by setting Globals.AppInitialized := True.</p> <p>This seems to work pretty well, but is it the best approach? Looking for insight from others' experience, ideas and opinions. TIA..</p>
[ { "answer_id": 382667, "author": "utku_karatas", "author_id": 14716, "author_profile": "https://Stackoverflow.com/users/14716", "pm_score": 3, "selected": false, "text": "...\nApplication.CreateForm(TMainForm, MainForm); \n...\nMainForm.ApplicationLoaded; // loads options, etc..\nAppl...
2008/12/19
[ "https://Stackoverflow.com/questions/382527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32303/" ]
382,548
<p>If you go to my site: www.ryancoughlin.com - and if you see the Google, Yahoo, etc. RSS buttons on the right side of the page. I am trying to get them to align evenly, they are all the same image height and I have been trying to get them to evenly line up. But I have had no success.</p>
[ { "answer_id": 382574, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 4, "selected": true, "text": "class=\"feed-image\"" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,564
<p>The ProxyMetaClass and Iterceptor classes for intercepting arbitrary Groovy method calls is well documented. Is there also a way to intercept property accesses? When I try to do this by intercepting "getProperty", I still get the error message:</p> <p>groovy.lang.MissingPropertyException: No such property: foo</p>
[ { "answer_id": 384081, "author": "Ted Naleid", "author_id": 8912, "author_profile": "https://Stackoverflow.com/users/8912", "pm_score": 1, "selected": false, "text": "class Person {\n def name = \"Ted\"\n def propertyMissing(String name) { \"my $name\" }\n}\n\ndef p = new Person()\...
2008/12/19
[ "https://Stackoverflow.com/questions/382564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33897/" ]
382,576
<p>I have a .xib file containing a UIView and 2 UILabel subviews linked to a class named Note with outlets assigned to each label appropriately, the definition for this class contains the following.</p> <pre><code>@interface Note : UIView { IBOutlet UILabel *time; IBOutlet UILabel *content; } </code></pre> <p>I'm constructing this with the following code</p> <pre><code>NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"Note" owner:self options:nil]; note = [nibViews lastObject]; [self addSubview:note]; </code></pre> <p>Now, in my Note class dealloc phase, I'm not releasing either time or content, but I'm wondering if I should? </p> <pre><code>- (void)dealloc { [super dealloc]; } </code></pre> <p>I'm assuming I don't because I'm not explicitly retaining these objects anywhere in my code, and I don't synthesize these into getter/setters. But I don't know enough about nib unarchiving to know whether I should be releasing these in my dealloc phase or not?</p>
[ { "answer_id": 385472, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 0, "selected": false, "text": "self.outletName = nil;\n outletName = nil;\n" }, { "answer_id": 10507580, "author": "Nate Symer", "a...
2008/12/19
[ "https://Stackoverflow.com/questions/382576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26986/" ]
382,587
<p>Further to <a href="https://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-in-batch-file">How to Pass Command Line Parameters in batch file</a> how does one get the rest of the parameters with specifying them exactly? I don't want to use SHIFT because I don't know how many parameters there might be and would like to avoid counting them, if I can.</p> <p>For example, given this batch file:</p> <pre><code>@echo off set par1=%1 set par2=%2 set par3=%3 set therest=%??? echo the script is %0 echo Parameter 1 is %par1% echo Parameter 2 is %par2% echo Parameter 3 is %par3% echo and the rest are %therest% </code></pre> <p>Running <code>mybatch opt1 opt2 opt3 opt4 opt5 ...opt20</code> would yield:</p> <pre><code>the script is mybatch Parameter 1 is opt1 Parameter 2 is opt2 Parameter 3 is opt3 and the rest are opt4 opt5 ...opt20 </code></pre> <p>I know <code>%*</code> gives all the parameters, but I don't wan't the first three (for example).</p>
[ { "answer_id": 382785, "author": "Patrick Cuff", "author_id": 7903, "author_profile": "https://Stackoverflow.com/users/7903", "pm_score": 6, "selected": true, "text": "SHIFT @echo off\n\nfor /f \"tokens=1-3*\" %%a in (\"%*\") do (\n set par1=%%a\n set par2=%%b\n set par3=%%c\n ...
2008/12/19
[ "https://Stackoverflow.com/questions/382587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14420/" ]
382,590
<p>Working with a latex document with eps images as in the example below...</p> <pre><code>\documentclass[11pt]{paper} \usepackage[dvips]{graphicx} \usepackage{fullpage} \usepackage{hyperref} \usepackage{amsmath} \DeclareMathSizes{8}{8}{8}{8} \author{Matt Miller} \title{my paper} \begin{document} \begin{figure}[!ht] \begin{center} \includegraphics[width=2in] {Figuer.eps} \end{center} \caption{Figure\label{fig:myFig}} \end{figure} \end{document} </code></pre> <p>When I got to build my latex document the time it takes to build the document increases with time. Are there any tips or tricks to help speed up this process?</p> <pre><code>latex paper.tex; dvipdf paper.dvi </code></pre>
[ { "answer_id": 413683, "author": "sastanin", "author_id": 25450, "author_profile": "https://Stackoverflow.com/users/25450", "pm_score": 2, "selected": false, "text": "pdflatex paper.tex\n pdflatex epstopdf Figuer.eps\n Figuer.pdf pdflatex dvipdf \\usepackage[pdftex]{graphicx} % not [dvip...
2008/12/19
[ "https://Stackoverflow.com/questions/382590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17712/" ]
382,591
<p>Trying to rotate a div element...This might be DOM blasphemy, could it work possibly with a canvas element? I'm not sure - if anybody has any ideas of how this could work or why it doesn't, I'd love to know. Thanks.</p>
[ { "answer_id": 3792085, "author": "Peter Ajtai", "author_id": 186636, "author_profile": "https://Stackoverflow.com/users/186636", "pm_score": 5, "selected": false, "text": "WebkitTransform / -moz-transform: rotate(Xdeg) canvas setTimeout() .animate() $(function() {\n var $elie = $(sel...
2008/12/19
[ "https://Stackoverflow.com/questions/382591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43889/" ]
382,602
<p>Quick design question.</p> <p>ClassA has a method called DoSomething(args)</p> <p>In DoSomething(), before it can actually do something, it needs to do some preparatory work with args. I believe this should be encapsulated within ClassA, (as opposed to doing the prep work outside and passing it in) as nothing else needs to know that this prep work is required to DoSomething.</p> <p>However, it's where the actual preparatory work code belongs that is making me think.</p> <p>The preparatory work in my particular example is to create a list of items, which satisfy a certain condition, from args.</p> <p>My hunch is that I should create a new class, ListOfStuff, which takes args in its constructor and put this preparatory work here.</p> <p>From a TDD-perspective, I think this is the right choice. We can then unit test ListOfStuff til our heart is content. If we had put the preparatory work in a private method of ClassA, we'd have only been able to indirectly test it through testing DoSomething().</p> <p>But is this overkill? Since adopting the TDD and DI approach, I've seen the number of classes that I write multiply - should I be worried?</p> <p>Ta.</p>
[ { "answer_id": 394729, "author": "Imran.Fanaswala", "author_id": 2117360, "author_profile": "https://Stackoverflow.com/users/2117360", "pm_score": 1, "selected": false, "text": "private" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7140/" ]
382,603
<p>So in Ruby there is a trick to specify infinity:</p> <pre><code>1.0/0 =&gt; Infinity </code></pre> <p>I believe in Python you can do something like this</p> <pre><code>float('inf') </code></pre> <p>These are just examples though, I'm sure most languages have infinity in some capacity. When would you actually use this construct in the real world? Why would using it in a range be better than just using a boolean expression? For instance</p> <pre><code>(0..1.0/0).include?(number) == (number &gt;= 0) # True for all values of number =&gt; true </code></pre> <p>To summarize, what I'm looking for is a real world reason to use Infinity.</p> <p><strong>EDIT</strong>: I'm looking for real world code. It's all well and good to say this is when you "could" use it, when have people <em>actually</em> used it.</p>
[ { "answer_id": 382605, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 5, "selected": false, "text": "min = float('inf')\n\nfor x in somelist:\n if x<min: \n min=x\n min somelist" }, { "answer_id": 382642, ...
2008/12/19
[ "https://Stackoverflow.com/questions/382603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42413/" ]
382,608
<p>My colleague suggests that texniscope is somehow to blame and that I should try purging it from my system. I really hope not to have to resort to that!</p> <p>Possible clues:</p> <ul> <li><p>This wasn't an issue till I upgraded to Leopard.</p></li> <li><p>When I say the fonts are screwed up, I mean the main text looks like maybe it's the default mac system font, and all math is completely unreadable. Basically all special symbols are completely garbled.</p></li> <li><p>I installed latex from here: <a href="http://www.tug.org/mactex/" rel="nofollow noreferrer">http://www.tug.org/mactex/</a>. I had already had texniscope installed. </p></li> <li><p>When I run <code>/usr/texbin/pdflatex foo.tex</code>, it seems to work:</p></li> </ul> <pre> This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode ... </pre> <p>but the resulting pdf file has screwed up fonts.</p> <ul> <li>The same thing happens both with pdflatex on the command line, or using TeXShop.</li> </ul>
[ { "answer_id": 382693, "author": "dreeves", "author_id": 4234, "author_profile": "https://Stackoverflow.com/users/4234", "pm_score": 1, "selected": false, "text": "sudo rm -rf `lsof | grep com.apple.ATS/annex.aux | grep Finder | cut -c 66-139`\n lsof /usr/sbin/lsof /usr/sbin sudo rm -rf ...
2008/12/19
[ "https://Stackoverflow.com/questions/382608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
382,624
<p>In <a href="http://abstracthack.wordpress.com/2007/09/05/multi-threaded-map-for-python/" rel="nofollow noreferrer">this blog article</a> they use the construct:</p> <pre><code> @measured def some_func(): #... # Presumably outputs something like "some_func() is finished in 121.333 s" somewhere </code></pre> <p>This <code>@measured</code> directive doesn't seem to work with raw python. What is it?</p> <p>UPDATE: I see from Triptych that <code>@something</code> is valid, but is where can I find <code>@measured</code>, is it in a library somewhere, or is the author of this blog using something from his own private code base?</p>
[ { "answer_id": 382627, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 2, "selected": false, "text": "@classmethod @staticmethod" }, { "answer_id": 382666, "author": "dbr", "author_id": 745, "author_p...
2008/12/20
[ "https://Stackoverflow.com/questions/382624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30529/" ]
382,626
<p>I have a HashMap relating Keys to Strings, and I need to compare some of the Strings against each other. However, some of the Strings may or may not be in the HashMap.</p> <p>Example: Let's say I have 4 Strings that I plan to compare to each other if possible, but only 3 of them end up in the HashMap. How can I compare the Strings that are present without trying to compare them to the String that isn't, and without doing a bunch of nested ifs and elses?</p> <p>edit: Alohci's solution was easy and fast, and it worked.</p>
[ { "answer_id": 382856, "author": "Milhous", "author_id": 17712, "author_profile": "https://Stackoverflow.com/users/17712", "pm_score": 0, "selected": false, "text": "Map<Key,Value> forwardMap;\nMap<Value, Set<Key> reverseMap;\n" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/382626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47923/" ]
382,629
<p>Ok I'm at my work this friday setting up a table that will have data in it that will come from a separate file called values.php. When I write it like this, the divs turn up blank. I think I have the "include" written wrong, does an absolute path not work?</p> <pre><code>&lt;?php include('http://www.nextadvisor.com/credit_report_services/values.php'); ?&gt; &lt;div class="box_text"&gt; &lt;div class="box_image"&gt; &lt;a href="&lt;?php echo $offer1link ?&gt;" target="blank"&gt;&lt;img src="&lt;?php echo $offer1logo ?&gt;" alt="&lt;?php echo $offer1name ?&gt;"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="box_rating"&gt; Rating:&lt;span class="star_rating"&gt;&lt;img src="&lt;?php echo $offer1star1 ?&gt;" alt=""&gt;&lt;/span&gt;&lt;br&gt; &lt;div class="rating_review"&gt;&lt;a href="&lt;?php echo $offer1link ?&gt;" target="blank"&gt;Go to Site&lt;/a&gt; | &lt;a href="&lt;?php echo $offer1anchor ?&gt;"&gt;Review&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;br style="clear: both;"&gt; &lt;/div&gt; </code></pre> <p>Oh and thanks in advance for any help you can give. Anyone who has helps me is the greatest. I feel bad cause sometimes two people answer the question and I can't give the green check to both.</p>
[ { "answer_id": 382652, "author": "lbrandao", "author_id": 47883, "author_profile": "https://Stackoverflow.com/users/47883", "pm_score": 3, "selected": true, "text": "allow_url_fopen = 1\nallow_url_include = 1\n" }, { "answer_id": 382653, "author": "OIS", "author_id": 3617...
2008/12/20
[ "https://Stackoverflow.com/questions/382629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43035/" ]
382,633
<p>We are using <a href="http://checkstyle.sourceforge.net/index.html" rel="nofollow noreferrer">CheckStyle</a> to enforce our style standards. One of the style rules we opted to include was the <em>NeedBraces</em> module.</p> <p><em><a href="http://checkstyle.sourceforge.net/config_blocks.html#NeedBraces" rel="nofollow noreferrer">NeedBraces</a></em> specifies that every block type statement (such as <code>if</code>, <code>else</code>, <code>for</code>) must have opening and closing curly braces. However, as far as I can tell it isn't working entirely correctly.</p> <p>This example will trigger a CheckStyle error.</p> <pre><code> if (true) { System.out.println("20"); } else System.out.println("30"); </code></pre> <p>Because the else case doesn't have braces. However, the next example fails to trigger a CheckStyle error.</p> <pre><code> if (true) { System.out.println("20"); } else if (true) { System.out.println("30"); } </code></pre> <p>This should have failed because of the missing braces on the else case, but checkstyle lets it pass. After double checking the documentation, I can't find any reason why this isn't working right. </p> <p>So... <strong>Can the CheckStyle module "NeedBraces" work with nested if/else blocks?</strong> Any ideas?</p> <hr> <p>The answer to this question begs <a href="https://stackoverflow.com/questions/387008/is-there-a-checkstyle-rule-to-force-if-else-keywords-to-be-on-the-same-line-in">another question</a>: is there a rule to flag the above undesirable code as a violation?</p>
[ { "answer_id": 382695, "author": "Lawrence Dol", "author_id": 8946, "author_profile": "https://Stackoverflow.com/users/8946", "pm_score": 4, "selected": true, "text": "if (true)\n{\n System.out.println(\"20\"); \n}\nelse if (true)\n{\n System.out.println(\"30\");\n}\n" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/382633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92/" ]
382,662
<p>I have been reading up on this, and it seems that if you use ajax you can only bring in content that resides on the same domain whereas with an iframe you can bring in content from any domain. Is that the case? What other differences are there?</p>
[ { "answer_id": 40757121, "author": "Vijay Srinivas", "author_id": 5018482, "author_profile": "https://Stackoverflow.com/users/5018482", "pm_score": 0, "selected": false, "text": "<html> <head> <body> <!doctype html>\n<html>\n<head>\n<style>\n .gappu {background-color:black;color:red;}...
2008/12/20
[ "https://Stackoverflow.com/questions/382662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47880/" ]
382,665
<p>While I see the relevance of "web" in the phrase "web stack," I'm left wondering what "stack" refers to in this context. </p>
[ { "answer_id": 382691, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 4, "selected": false, "text": "Your Application Presentation\nYour Application Controls\nYour Application Models\nHTTP Server (Apache, IIS, etc.)\nDatabas...
2008/12/20
[ "https://Stackoverflow.com/questions/382665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51518/" ]
382,675
<p>I am looking for a way to position a div (it would be a pop-up that would be activated by a user hovering and/or clicking much like lightbox) over an a split iframe where the top iframe is content from my server and the bottom iframe is content from another server. Like this:</p> <pre> ---------------------------------------- | | | Upper | | | | ------------------- | | | DIV | | --------- -------| | | | | | -------------------- | | | | Lower | | | ---------------------------------------- </pre> <p>Basically it looks like a box that is split horizontally between the top (upper) and bottom (lower; the external content) and a DIV that hovers over the two so there is overlap on both the top and the bottom.</p> <p>By the way, I also posted another question re: ajax versus iframes for external content and what I should use in this instance. So the lower (external content) doesn't necessarily have to be an iframe depending on the answer to that.</p>
[ { "answer_id": 382699, "author": "Soviut", "author_id": 46914, "author_profile": "https://Stackoverflow.com/users/46914", "pm_score": 2, "selected": false, "text": ".overlapper\n{\n position: absolute;\n z-index: 9000; /* some very high value to ensure its always on top */\n to...
2008/12/20
[ "https://Stackoverflow.com/questions/382675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47880/" ]
382,676
<p>I'm looking for a simple NumericUpDown (a.k.a. number spinner) control in WPF. This seems to be another lacking control in WPF. There must be some existing ones out there and I don't like to re-invent the wheel.</p>
[ { "answer_id": 1421152, "author": "Simon D.", "author_id": 70060, "author_profile": "https://Stackoverflow.com/users/70060", "pm_score": 1, "selected": false, "text": "<WpfElements:SpinDecorator>\n <WpfElements:IntegerTextBox Text=\"{Binding Foo}\" />\n</WpfElements:SpinDecorator>\n" ...
2008/12/20
[ "https://Stackoverflow.com/questions/382676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238948/" ]
382,678
<p>Any suggestion to detect flaws in VB6 components running under IIS. IIS becomes unstable and after some time enter in a state of hang. The problems occur in the most part only in the production environment. We have many modules running. Probably there are components with bugs and need to identify them. Thanks in advance.</p>
[ { "answer_id": 1421152, "author": "Simon D.", "author_id": 70060, "author_profile": "https://Stackoverflow.com/users/70060", "pm_score": 1, "selected": false, "text": "<WpfElements:SpinDecorator>\n <WpfElements:IntegerTextBox Text=\"{Binding Foo}\" />\n</WpfElements:SpinDecorator>\n" ...
2008/12/20
[ "https://Stackoverflow.com/questions/382678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47733/" ]
382,711
<p>I was looking at sql inner queries (bit like the sql equivalent of a C# anon method), and was wondering, can I return more than one value from a query?</p> <p>For example, return the number of rows in a table as one output value, and also, as another output value, return the distinct number of rows?</p> <p>Also, how does distinct work? Is this based on whether one field may be the same as another (thus classified as "distinct")?</p> <p>I am using Sql Server 2005. Would there be a performance penalty if I return one value from one query, rather than two from one query?</p> <p>Thanks</p>
[ { "answer_id": 382728, "author": "GluedHands", "author_id": 37726, "author_profile": "https://Stackoverflow.com/users/37726", "pm_score": 2, "selected": false, "text": "SELECT\n COUNT(field1),\n COUNT(DISTINCT field2)\nFROM table\n" }, { "answer_id": 383373, "author": "Marc...
2008/12/20
[ "https://Stackoverflow.com/questions/382711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
382,720
<p>I find it hard to generate the dbscripts from TOAD. I get errors when executing the scripts things like looping chain of synonyms or certain statement not abel to exceute etc.</p> <p>Is there any seamless way in said like connecting a remote oracle schema and just duplicate to my local environment?</p> <p>And also do synchronization along the way?</p>
[ { "answer_id": 382771, "author": "derobert", "author_id": 27727, "author_profile": "https://Stackoverflow.com/users/27727", "pm_score": 2, "selected": false, "text": "$ exp username/password@source-sid CONSISTENT=Y DIRECT=Y OWNER=schema FILE=schema.exp\n$ ⋮ # some command(s) to nuke obje...
2008/12/20
[ "https://Stackoverflow.com/questions/382720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,734
<p>I'm trying to run the following commands:</p> <pre><code>replace -x "must " A2input.txt replace -x " a" -f -s ## A2input.txt replace -x to -s ## -a A2input.txt replace -x faith -f "unequivocal" A2input.txt </code></pre> <p>And it'd be nice if I could just alias it to something short and simple like "a", "b", "c", "d", etc...</p> <p>However, some of those arguments have a quote, which is messing up the alias. Does anyone know how to actually escape the double quotes? I've tried things like '\"' and \" but nothing seems to work. </p> <p>I'm using tcsh as my shell.</p>
[ { "answer_id": 382760, "author": "derobert", "author_id": 27727, "author_profile": "https://Stackoverflow.com/users/27727", "pm_score": 0, "selected": false, "text": "#!/bin/tcsh\nreplace -x \"must\" ...\n alias t='echo \"hello world\"' # using single quotes to enclose entire string...
2008/12/20
[ "https://Stackoverflow.com/questions/382734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20526/" ]
382,747
<p>How do I submit the ListBox selections to the ModelBinder?</p> <pre><code>&lt;%=Html.Hidden("response.Index",index)%&gt; &lt;%=Html.ListBox("response[index].ChoiceID", new MultiSelectList(gc.choice,"ChoiceID","ChoiceText") )%&gt; </code></pre> <p>'gc.choice' is a List </p> <p>I can get the fisrt selected value to the model, but not the second selection presumably because I cannot change the index. </p>
[ { "answer_id": 700730, "author": "Rokey Ge", "author_id": 84543, "author_profile": "https://Stackoverflow.com/users/84543", "pm_score": 1, "selected": false, "text": "SamplePresentationModel userList IEnumerable<User> allUser View(new SamplePresentationModel(){ userList = new MultiSele...
2008/12/20
[ "https://Stackoverflow.com/questions/382747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,781
<p><strong>Question:</strong> Does Emacs have a canonical equivalent of Vim's <a href="http://vimdoc.sourceforge.net/htmldoc/options.html#&#39;foldmethod&#39;" rel="noreferrer">Folding with Foldmethod=indent</a>?</p> <p>I am particularly interested in something that can work alongside any Emacs major mode and any file. The Emacs searches have not turned up a definitive answer.</p>
[ { "answer_id": 448724, "author": "Michael Paulukonis", "author_id": 41153, "author_profile": "https://Stackoverflow.com/users/41153", "pm_score": 2, "selected": false, "text": ";; http://emacs.wordpress.com/2007/01/16/quick-and-dirty-code-folding/\n(defun jao-toggle-selective-display (co...
2008/12/20
[ "https://Stackoverflow.com/questions/382781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42223/" ]
382,791
<p>I am getting this error when starting up Jetty that uses Mysql Connection Pool. Could someone help me out please?</p> <pre><code>[root@localhost test]# java -DOPTIONS=plus,ext.default -classpath %CLASSPATH% -jar /usr/src/jetty7/start.jar myjetty.xml 2008-12-20 18:24:08.138::INFO: Logging to STDERR via org.mortbay.log.StdErrLog 2008-12-20 18:24:08.307::WARN: Config error at &lt;New id="dev" class="org.mortbay.jetty.plus.naming.Resource"&gt;&lt;Arg&gt;jdbc/mysql&lt;/Arg&gt;&lt;Arg&gt; &lt;New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"&gt;&lt;Set name="User"&gt;root&lt;/Set&gt;&lt;Set name="URL"&gt;jdbc:mysql://192.168.1.105/app&lt;/Set&gt;&lt;Set name="Password"&gt;sqlpass&lt;/Set&gt;&lt;/New&gt; &lt;/Arg&gt;&lt;/New&gt; 2008-12-20 18:24:08.307::WARN: EXCEPTION java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:608) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:256) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:214) at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:974) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mortbay.start.Main.invokeMain(Main.java:218) at org.mortbay.start.Main.start(Main.java:564) at org.mortbay.start.Main.main(Main.java:136) Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325) at javax.naming.InitialContext.getNameParser(InitialContext.java:480) at org.mortbay.jetty.plus.naming.NamingEntry.save(NamingEntry.java:182) at org.mortbay.jetty.plus.naming.NamingEntry.&lt;init&gt;(NamingEntry.java:58) at org.mortbay.jetty.plus.naming.NamingEntry.&lt;init&gt;(NamingEntry.java:76) at org.mortbay.jetty.plus.naming.Resource.&lt;init&gt;(Resource.java:44) ... 15 more 2008-12-20 18:24:08.308::WARN: Nested in java.lang.reflect.InvocationTargetException: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325) at javax.naming.InitialContext.getNameParser(InitialContext.java:480) at org.mortbay.jetty.plus.naming.NamingEntry.save(NamingEntry.java:182) at org.mortbay.jetty.plus.naming.NamingEntry.&lt;init&gt;(NamingEntry.java:58) at org.mortbay.jetty.plus.naming.NamingEntry.&lt;init&gt;(NamingEntry.java:76) at org.mortbay.jetty.plus.naming.Resource.&lt;init&gt;(Resource.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:608) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:256) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:214) at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:974) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mortbay.start.Main.invokeMain(Main.java:218) at org.mortbay.start.Main.start(Main.java:564) at org.mortbay.start.Main.main(Main.java:136) [root@localhost test]# </code></pre> <p>Here is my Jetty.xml</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"&gt; &lt;Configure id="Server" class="org.mortbay.jetty.Server"&gt; &lt;Call name="addConnector"&gt; &lt;Arg&gt; &lt;New class="org.mortbay.jetty.nio.SelectChannelConnector"&gt; &lt;!-- the ip address or domain to bind --&gt; &lt;Set name="host"&gt;&lt;SystemProperty name="jetty.host" /&gt;&lt;/Set&gt; &lt;!-- the port to use/bind, defaults to 8080 if property not set --&gt; &lt;Set name="port"&gt;&lt;SystemProperty name="jetty.port" default="8090"/&gt;&lt;/Set&gt; &lt;!-- the time in milliseconds when a connection is considered idle --&gt; &lt;Set name="maxIdleTime"&gt;300000&lt;/Set&gt; &lt;!-- the number of acceptors (their job is to accept the connection and dispatch to thread pool) --&gt; &lt;Set name="Acceptors"&gt;2&lt;/Set&gt; &lt;!-- should the connection statistics be turned on? (Not advisable in production) --&gt; &lt;Set name="statsOn"&gt;false&lt;/Set&gt; &lt;!-- the confidential port --&gt; &lt;Set name="confidentialPort"&gt;8443&lt;/Set&gt; &lt;!-- indicates the minimum number of connections when the server is considered low on resources --&gt; &lt;Set name="lowResourcesConnections"&gt;20000&lt;/Set&gt; &lt;!-- when low on resources, this indicates the maximum time (milliseconds) a connection must be idle to not be closed --&gt; &lt;Set name="lowResourcesMaxIdleTime"&gt;5000&lt;/Set&gt; &lt;/New&gt; &lt;/Arg&gt; &lt;/Call&gt; &lt;Set name="handler"&gt; &lt;New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection"&gt; &lt;Set name="handlers"&gt; &lt;Array type="org.mortbay.jetty.Handler"&gt; &lt;Item&gt; &lt;New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/&gt; &lt;/Item&gt; &lt;Item&gt; &lt;New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/&gt; &lt;/Item&gt; &lt;Item&gt; &lt;New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/&gt; &lt;/Item&gt; &lt;/Array&gt; &lt;/Set&gt; &lt;/New&gt; &lt;/Set&gt; &lt;Array id="plusConfig" type="java.lang.String"&gt; &lt;Item&gt;org.mortbay.jetty.webapp.WebInfConfiguration&lt;/Item&gt; &lt;Item&gt;org.mortbay.jetty.plus.webapp.EnvConfiguration&lt;/Item&gt; &lt;Item&gt;org.mortbay.jetty.plus.webapp.Configuration&lt;/Item&gt; &lt;Item&gt;org.mortbay.jetty.webapp.JettyWebXmlConfiguration&lt;/Item&gt; &lt;Item&gt;org.mortbay.jetty.webapp.TagLibConfiguration&lt;/Item&gt; &lt;/Array&gt; &lt;New id="dev" class="org.mortbay.jetty.plus.naming.Resource"&gt; &lt;Arg&gt;jdbc/mysql&lt;/Arg&gt; &lt;Arg&gt; &lt;New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"&gt; &lt;Set name="User"&gt;root&lt;/Set&gt; &lt;Set name="URL"&gt;jdbc:mysql://192.168.1.105/app&lt;/Set&gt; &lt;Set name="Password"&gt;sqlpass&lt;/Set&gt; &lt;/New&gt; &lt;/Arg&gt; &lt;/New&gt; &lt;Call name="addLifeCycle"&gt; &lt;Arg&gt; &lt;New class="org.mortbay.jetty.deployer.WebAppDeployer"&gt; &lt;Set name="ConfigurationClasses"&gt;&lt;Ref id="plusConfig"/&gt;&lt;/Set&gt; &lt;Set name="contexts"&gt;&lt;Ref id="Contexts"/&gt;&lt;/Set&gt; &lt;Set name="configurationDir"&gt;&lt;SystemProperty name="jetty.home" default="/root/test"/&gt;/contexts&lt;/Set&gt; &lt;Set name="scanInterval"&gt;5&lt;/Set&gt; &lt;/New&gt; &lt;/Arg&gt; &lt;/Call&gt; &lt;Ref id="RequestLog"&gt; &lt;Set name="requestLog"&gt; &lt;New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog"&gt; &lt;Set name="filename"&gt;&lt;SystemProperty name="jetty.logs" default="./logs"/&gt;/yyyy_mm_dd.request.log&lt;/Set&gt; &lt;Set name="filenameDateFormat"&gt;yyyy_MM_dd&lt;/Set&gt; &lt;Set name="retainDays"&gt;90&lt;/Set&gt; &lt;Set name="append"&gt;true&lt;/Set&gt; &lt;Set name="extended"&gt;true&lt;/Set&gt; &lt;Set name="logCookies"&gt;false&lt;/Set&gt; &lt;Set name="LogTimeZone"&gt;GMT&lt;/Set&gt; &lt;/New&gt; &lt;/Set&gt; &lt;/Ref&gt; &lt;/Configure&gt; </code></pre>
[ { "answer_id": 1268516, "author": "Adam Batkin", "author_id": 120808, "author_profile": "https://Stackoverflow.com/users/120808", "pm_score": 2, "selected": false, "text": "etc/jetty-plus.xml java -DOPTIONS=plus,ext.default -classpath %CLASSPATH% -jar /usr/src/jetty7/start.jar /path/to/e...
2008/12/20
[ "https://Stackoverflow.com/questions/382791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,797
<p>I teach a one semester University course in systems analysis and design. Topics include design patterns, UML, OOP, software development lifecycles, and the history, benefits and drawbacks of various methodologies (such as Agile/SCRUM/BDUF/Waterfall.)</p> <p>Students who enter the course should have <em>some</em> exposure to programming, but in reality I've seen everything from people who are highly fluent in one or two modern languages to those who can barely pass the FizzBuzz test. </p> <p>My question is two-fold: how much programming experience do you think students need before exposure to these topics (or do you think they should learn them before they learn to code), and second, what do you feel would be fair and appropriate ways to pre-test them at the start of the class, knowing that there is no consistent language or platform in their background?</p>
[ { "answer_id": 382889, "author": "coobird", "author_id": 17172, "author_profile": "https://Stackoverflow.com/users/17172", "pm_score": 1, "selected": false, "text": "GOTO" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/382797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1854/" ]
382,798
<p>I'm developing a web app in Perl with some C as necessary for some heavy duty number crunching. The main problem I'm having so far is trying to decide if I should use mod-perl, mod-fastcgi or both to run my scripts because I'm having a difficult time trying to analyze the pros and cons of each mod.</p> <p>Can anyone post a summary or give a link where I can find some comparison information and perhaps some recommendations with examples?</p>
[ { "answer_id": 16641338, "author": "Ross Attrill", "author_id": 556644, "author_profile": "https://Stackoverflow.com/users/556644", "pm_score": 3, "selected": false, "text": "cgi - 1200+ requests per minute\nmod_perl - 6000+ requests per minute (ModPerl::PerlRun only)\nfast_cgi - 6000+ r...
2008/12/20
[ "https://Stackoverflow.com/questions/382798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31787/" ]
382,811
<p>How do you set a function to \C-' ? when I try to do :</p> <pre><code>(global-set-key "\C-'" 'myfunct) </code></pre> <p>it gives me "Invalid modifier in string".</p>
[ { "answer_id": 382816, "author": "ShreevatsaR", "author_id": 4958, "author_profile": "https://Stackoverflow.com/users/4958", "pm_score": 5, "selected": true, "text": "\\C-' C-' (global-set-key (kbd \"C-'\") 'myfunct)\n" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/382811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41241/" ]
382,822
<p>I declared a private variable </p> <pre><code>vector&lt;SomeClass&gt; theVector; </code></pre> <p>someplace inside my SomeClass class.</p> <p>Why can't I say: <code>delete theVector</code> inside my SomeClass destructor?</p> <p>The compiler error says:</p> <pre><code> type `class Vector&lt;SomeClass&gt;' argument given to `delete', expected pointer </code></pre> <p>What expected pointer?</p>
[ { "answer_id": 382823, "author": "PolyThinker", "author_id": 47707, "author_profile": "https://Stackoverflow.com/users/47707", "pm_score": 2, "selected": false, "text": "delete' expects. \"Expected pointer\" means the operand of int theInt;\ndelete theInt;\n" }, { "answer_id": 38...
2008/12/20
[ "https://Stackoverflow.com/questions/382822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45963/" ]
382,854
<p>Button class:</p> <pre><code>class SubmitButton extends JButton implements ActionListener { public SubmitButton(String title){ super(title); .... </code></pre> <p>Where I declare it:</p> <pre><code>SubmitButton submit = new SubmitButton("Submit"); submit.setBounds(530+150, 200, 100, 25); </code></pre> <p><strong>How does super(title) set the String title to the title of the button? How does it do the same as the method .setText() for regular JButtons?</strong></p> <p>In other words, how did calling super() do the same thing as .setText() how does super() know to change title? is .setText() the only method in JButton Class that takes in string as parameter?</p>
[ { "answer_id": 382870, "author": "Draemon", "author_id": 26334, "author_profile": "https://Stackoverflow.com/users/26334", "pm_score": 6, "selected": true, "text": "public JButton(String title) {\n setText(title);\n}\n public SubmitButton(String title) {\n super(title);\n}\n" }, ...
2008/12/20
[ "https://Stackoverflow.com/questions/382854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51518/" ]
382,878
<p>I have a java class file with a main method. In Windows, I would like to be able to drag files onto a desktop icon/short/etc that would call supply the filenames to my main method. Basically, I want to allow users to drag-and-drop files at program execution instead of having type them on the command line.</p> <p>Any thoughts?</p>
[ { "answer_id": 382916, "author": "coobird", "author_id": 17172, "author_profile": "https://Stackoverflow.com/users/17172", "pm_score": 2, "selected": false, "text": "java main @ECHO OFF\n:Loop\nIF \"%1\" == \"\" GOTO Done\njava YourClass %1\nSHIFT\nGOTO Loop\n:Done\n" }, { "answe...
2008/12/20
[ "https://Stackoverflow.com/questions/382878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,880
<p>My team is working on a conversion project to convert one product (but with many facets) from VB6 to .Net (we have over ~300k LOC). Before I got on board, the decision was made that regardless of the location of the assembly, or folder structure, all classes / structs will be in one namespace:</p> <p>.</p> <p>They even go as far as changing auto-generated application settings designer code, resource designer code, and such to force uniformity. How do I convince them that namespace use is good? What is the proper use of namespace and what are the pros and cons? I guess I am having a tough time understanding why my colleagues would go through so much hassle to save a few using lines. Any external, reputable references to support your argument would be much appreciated. Please help!</p>
[ { "answer_id": 383336, "author": "paercebal", "author_id": 14089, "author_profile": "https://Stackoverflow.com/users/14089", "pm_score": 4, "selected": true, "text": "Imports MyWholeProject\n\nClass HelloWorld\n\n Public Sub Main()\n Dim o As MyModuleAAA_MyObject = New MyModuleAAA...
2008/12/20
[ "https://Stackoverflow.com/questions/382880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42536/" ]
382,883
<p>For the sake of an example, is this statement</p> <pre><code>window.Number.constructor.prototype.constructor(); </code></pre> <p>read like a path?</p> <pre><code>C:\Users\Vista\Documents\Work\text.txt </code></pre> <p>From left to right</p> <pre><code>window:\Number\constructor\prototype\constructor() </code></pre> <p>where <code>window</code> is the root object, <code>Number</code> is an object inside <code>window</code>, <code>constructor</code> is an object inside <code>Number</code>, <code>prototype</code> is an object inside <code>constructor</code> and <code>constructor()</code> is an object inside <code>prototype</code>?</p> <p>Just like in this statement</p> <pre><code>window.document.myForm.textBox.value; </code></pre> <p>which equals</p> <pre><code>[object].[object].[object].[object].1 </code></pre> <p>where the objects aren't actually acting on each other?</p> <p><strong>OR</strong></p> <p>Are the actual values read from right to left, where each object is acting on the object directly to the left of it?</p> <p>Where</p> <pre><code>window.Number.constructor.prototype.constructor(); </code></pre> <p>equals</p> <pre><code>[object] . function Number() { [native code] } . function Function() { [native code] } . function prototype() { [native code] } . function anonymous() { } </code></pre> <p>as</p> <pre><code>window.Number(9.256).toFixed(2); </code></pre> <p>equals</p> <pre><code>[object].(9.256).(9.26); </code></pre> <p>where <code>toFixed</code> is a property that's using the return value of the <code>Number</code> object and the result is stored as a property of the <code>window</code> object?</p> <p>As you can probably tell, I'm kinda tangled up over here :) Just having difficulty wrapping my head around the dot concept. I'm sure a background in Java would help, but unfortunately, I don't have one (yet).</p>
[ { "answer_id": 382893, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 0, "selected": false, "text": "struct window.Number.constructor.prototype.constructor()\n ()" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/382883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,928
<p>I need to create a wpf treeviewlist to look something like this:</p> <pre><code>AAAA BBBB ....CCCC ....DDDD .......EEEE FFFFF </code></pre> <p>(where the dots above are indents)</p> <p>I need to do this from vb.net (2008) code.</p> <p>I've spent an embarrassingly long amount of time trying to figure this out, and so far all I’ve got is:</p> <p>vb.net:</p> <pre><code>Dim tvi1, tvi2 As TreeViewItem tvi1 = New TreeViewItem tvi2 = New TreeViewItem Dim Node1 As Integer tvi1.Header = "AAAA" tvi2.Header = "BBBB" Node1 = TreeView1.Items.Add(tvi1) Node1 = TreeView1.Items.Add(tvi2) </code></pre> <p>Any pointers or examples would be greatly appreciated.</p> <p>Thanks, Rob</p>
[ { "answer_id": 383046, "author": "Mark Carpenter", "author_id": 47645, "author_profile": "https://Stackoverflow.com/users/47645", "pm_score": 3, "selected": true, "text": "var parent = new TreeViewItem();\nvar child = new TreeViewItem();\nparent.Header = \"Hey\";\nchild.Header = \"There!...
2008/12/20
[ "https://Stackoverflow.com/questions/382928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18735/" ]
382,930
<p>I have this jQuery code that queries an API on a keyup event (via keyterms.php). It works as it is, but I'm trying to figure out how to implement a "pause" so to speak such that it will only do a query after a certain amount of time (say 2sec.) after the last keyup. Any help will be much appreciated. Thanks!</p> <pre><code>$(document).ready(function() { $('#loading').hide(); $('#q').keyup(function(){ $('#loading').show(); $.post("keyterms.php", { q: $('#q').val() }, function(response){ $('#qResult').fadeOut(); setTimeout("finishAjax('qResult', '"+escape(response)+"')", 400); }); return false; }); }); </code></pre>
[ { "answer_id": 382956, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 0, "selected": false, "text": "setTimeout" }, { "answer_id": 382965, "author": "Andreas Grech", "author_id": 44084, "author_p...
2008/12/20
[ "https://Stackoverflow.com/questions/382930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47947/" ]
382,980
<p>Is there some command line or AppleScript that I can write/run to make the machine go to sleep automatically or even better, into hibernate mode? </p> <p>I can run the program as root.</p>
[ { "answer_id": 382986, "author": "Rob Kennedy", "author_id": 33732, "author_profile": "https://Stackoverflow.com/users/33732", "pm_score": 4, "selected": true, "text": "osascript -e 'tell application \"Finder\" to sleep'\n" }, { "answer_id": 390450, "author": "Coxy", "aut...
2008/12/20
[ "https://Stackoverflow.com/questions/382980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23072/" ]
382,993
<p>A colleague of mine recently got bitten badly by writing out of bounds to a static array on the stack (he added an element to it without increasing the array size). Shouldn't the compiler catch this kind of error? The following code compiles cleanly with gcc, even with the <code>-Wall -Wextra</code> options, and yet it is clearly erroneous:</p> <pre><code>int main(void) { int a[10]; a[13] = 3; // oops, overwrote the return address return 0; } </code></pre> <p>I'm positive that this is undefined behavior, although I can't find an excerpt from the C99 standard saying so at the moment. But in the simplest case, where the size of an array is known as compile time and the indices are known at compile time, shouldn't the compiler emit a warning at the very least?</p>
[ { "answer_id": 383002, "author": "Norman Ramsey", "author_id": 41661, "author_profile": "https://Stackoverflow.com/users/41661", "pm_score": 3, "selected": false, "text": "gcc -Wall -O" }, { "answer_id": 383095, "author": "derobert", "author_id": 27727, "author_profil...
2008/12/20
[ "https://Stackoverflow.com/questions/382993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9530/" ]
382,998
<p>Does anyone know exactly what Windows XP does when you click "Repair" on a network connection? I'd like to do the same programmatically or from a command line.</p> <p>I did a Google search and found <a href="http://windowsitpro.com/article/articleid/41060/what-actions-occur-when-i-click-repair-on-a-network-connection-in-windows-xp-and-later.html" rel="nofollow noreferrer">this article</a>, which has a good explanation, but I don't think it's complete. I can reliably reproduce a condition where I lose network connectivity and clicking the Repair button fixes the problem, but running the commands in that article does not.</p>
[ { "answer_id": 383005, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 0, "selected": false, "text": "ipconfig /renew\n" }, { "answer_id": 383062, "author": "EMP", "author_id": 20336, "author_profile...
2008/12/20
[ "https://Stackoverflow.com/questions/382998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20336/" ]
383,016
<p>How does container object like vector in stl get destroyed even though they are created in heap?</p> <p><strong>EDIT</strong></p> <p>If the container holds pointers then how to destroy those pointer objects</p>
[ { "answer_id": 383044, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 2, "selected": false, "text": "void foo() { \n vector<int> v;\n v.push_back(42);\n}\n" }, { "answer_id": 383079, "author": "strager", ...
2008/12/20
[ "https://Stackoverflow.com/questions/383016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
383,026
<p>I find this comes up a lot, and I'm not sure the best way to approach it. </p> <p><strong>The question I have is how to make the decision between using foreign keys to lookup tables, or using lookup table values directly in the tables requesting it, avoiding the lookup table relationship completely.</strong></p> <p>Points to keep in mind:</p> <ul> <li><p>With the second method you would need to do mass updates to all records referencing the data if it is changed in the lookup table.</p></li> <li><p>This is focused more towards tables that have a lot of the column's referencing many lookup tables.Therefore lots of foreign keys means a lot of joins every time you query the table.</p></li> <li>This data would be coming from drop down lists which would be pulled from the lookup tables. In order to match up data when reloading, the values need to be in the existing list (<em>related to the first point</em>).</li> </ul> <p>Is there a best practice here, or any key points to consider?</p>
[ { "answer_id": 383425, "author": "Ian Varley", "author_id": 37539, "author_profile": "https://Stackoverflow.com/users/37539", "pm_score": 3, "selected": false, "text": "CREATE TABLE Hat (\n hat_id INT NOT NULL PRIMARY KEY,\n brand VARCHAR(255) NOT NULL,\n size INT NOT NULL,\n color V...
2008/12/20
[ "https://Stackoverflow.com/questions/383026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37966/" ]
383,032
<p>Does GWT has LazyPanel .I can not see it .Please let me know .If it got lazyPanel ,please lemme know version</p>
[ { "answer_id": 684275, "author": "reechard", "author_id": 44509, "author_profile": "https://Stackoverflow.com/users/44509", "pm_score": 0, "selected": false, "text": "/*\n * Copyright 2008 Google Inc.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\...
2008/12/20
[ "https://Stackoverflow.com/questions/383032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15476/" ]
383,057
<p>I need to transfer data from one table to the same table in another server which has been truncated. What is the easiest way to do this?</p>
[ { "answer_id": 383061, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 2, "selected": false, "text": "bcp BULK INSERT OPENDATASOURCE" }, { "answer_id": 383092, "author": "Nick Kavadias", "author_id": 40067, "...
2008/12/20
[ "https://Stackoverflow.com/questions/383057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47957/" ]
383,058
<p>I am using Jruby and rails 2.2.2. My problem is I have a migration that is not being correctly written to the database schema.</p> <p>Here is my migration: </p> <pre><code>class CreateNotes &lt; ActiveRecord::Migration def self.up create_table(:notes, :options =&gt; 'ENGINE=MyISAM') do |t| t.string :title t.text :body t.timestamps end execute "alter table notes ADD FULLTEXT(title, body)" end </code></pre> <p>Here is what it produces on in schema.rb</p> <pre><code>create_table "notes", :force =&gt; true do |t| t.string "title" t.text "body" t.datetime "created_at" t.datetime "updated_at" end add_index "notes", ["title", "body"], :name =&gt; "title" </code></pre> <p>I have two question:</p> <ul> <li>How do I get <code>'ENGINE=MyISAM'</code> into the schema?</li> <li>Why did my execute statement become <code>add_index "notes", ["title", "body"], :name =&gt; "title"</code>? and how do I force migrations to leave it as an execute statement?</li> </ul> <p>Thanks to Christian Lescuyer for the answer. However, when I tried this nothing changed. I uncommented the config.active_record... line but, my schema has not changed. I have tried this in jruby and on ruby 1.8.6 with rails 2.2.2 and edge rails and there is not changes in the schema. Can anybody tell me what I am doing wrong?</p>
[ { "answer_id": 383357, "author": "Christian Lescuyer", "author_id": 341, "author_profile": "https://Stackoverflow.com/users/341", "pm_score": 4, "selected": true, "text": "# Use SQL instead of Active Record's schema dumper when creating the test database.\n# This is necessary if your sch...
2008/12/20
[ "https://Stackoverflow.com/questions/383058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004/" ]
383,073
<p>I'd like to write a script that interacts with my DB using a Django app's model. However, I would like to be able to run this script from the command line or via cron. What all do I need to import to allow this?</p>
[ { "answer_id": 383089, "author": "Soviut", "author_id": 46914, "author_profile": "https://Stackoverflow.com/users/46914", "pm_score": 4, "selected": false, "text": "import os\n\nos.environ['PYTHONPATH'] = '/path/to/myproject'\nos.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'\n...
2008/12/20
[ "https://Stackoverflow.com/questions/383073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1595/" ]
383,099
<p>I have the following code:</p> <pre><code>&lt;tr&gt; &lt;td width="60%"&gt; &lt;dl&gt; &lt;dt&gt;Full Name&lt;/dt&gt; &lt;dd&gt; &lt;input name="fullname[]" type="text" class="txt w90" id="fullname[]" value="&lt;?php echo $value; ?&gt;" /&gt; &lt;/dd&gt; &lt;/dl&gt; &lt;/td&gt; &lt;td width="30%"&gt; &lt;dl&gt; &lt;dt&gt;Job Title&lt;/dt&gt; &lt;dd&gt; &lt;input name="job_title[]" type="text" class="txt w90" id="job_title[]" value="&lt;?php echo $value2; ?&gt;" /&gt; &lt;/dd&gt; &lt;/dl&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Lets assume that I have several rows of the above code. How do I iterate and get the value for arrays <code>$_POST['fullname']</code> and <code>$_POST['job_title']</code>?</p>
[ { "answer_id": 383106, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 3, "selected": false, "text": "foreach ($_POST['fullname'] as $name) {\n echo $name.\"\\n\";\n}\n for ($i=0; $i < count($_POST['fullname']); $i+...
2008/12/20
[ "https://Stackoverflow.com/questions/383099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37667/" ]
383,101
<p>i'm having a hard time with Xcode; for some reason, it just won't let me pass a variable from one view controller class to another. It should work, i was basically just copying/pasting from my other classes (it works on all of them... except this one). I've been at it all night long, tried everything i could think of and still it remains.</p> <p>Here's the view controller class where I'm making the call:</p> <h2>ResultadosViewController.h:</h2> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "Filme.h" #import "Festival.h" #import "Top10Discos.h" #import "Peca.h" @class DetalhesViewController; @interface ResultadosViewController : UIViewController { // Navegation DetalhesViewController *dvc; BOOL isViewPushed; // What i'd really like to pass lol NSArray *array_resultados; } @property (nonatomic, retain) NSArray *array_resultados; @property (nonatomic, readwrite) BOOL isViewPushed; @end* </code></pre> <h2>ResultadosViewController.m:</h2> <pre><code>#import "ResultadosViewController.h" #import "DetalhesViewController.h" #import "Filme.h" #import "Peca.h" #import "Top10Discos.h" #import "Festival.h" @implementation ResultadosViewController @synthesize isViewPushed, array_resultados; (...) - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic -- create and push a new view controller if (indexPath.row == 2) { if(dvc != nil) [dvc dealloc]; NSString *ffs = [[array_resultados objectAtIndex:indexPath.row] TituloFilme]; dvc = [[DetalhesViewController alloc] initWithNibName:@"DetailedView" bundle:[NSBundle mainBundle]]; **resultadosControllerCell.array_resultados = [self array_resultados];** *"Request for member 'array_resultados' in something not a structure or union"* //Push the view controller to the top of the stack. [self.navigationController pushViewController:dvc animated:YES]; } } </code></pre> <p>And here's the other class i want to send the array into:</p> <h2>DetalhesViewController.h:</h2> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "Filme.h" #import "Festival.h" #import "Top10Discos.h" #import "Peca.h" @interface DetalhesViewController : UIViewController { // Navegacao NSArray *array_resultados; } @property (nonatomic, retain) NSArray *array_resultados; @end </code></pre> <p>I'm not sure if any of you would to see the .m file for this class; in that case, just ask.</p> <p>Thanks in advance, Hal</p> <p>PS: tried with other variables (other types too), cleansed/rebuilt, recreated xib file, you name it... i'm outta tricks :(</p>
[ { "answer_id": 383105, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 0, "selected": false, "text": "-> . resultadosControllerCell->array_resultados = [self array_resultados];\n" }, { "answer_id": 383367, ...
2008/12/20
[ "https://Stackoverflow.com/questions/383101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
383,103
<p>I would like to know is there any way by which we can change the Image color at runtime. for e.g lets say I am having a JPG bind to an Image control of ASP.Net. Next I am having a dropdown List which gives me the various color option like red,gree,etc. I would now like to change the color of the Image to the one selected in the droprdown List.</p>
[ { "answer_id": 383305, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 4, "selected": false, "text": "Bitmap bmp = (Bitmap)Bitmap.FromFile(\"image.jpg\");\nfor (int x = 0; x < bmp.Width; x++)\n{\n for (int y = 0; y < ...
2008/12/20
[ "https://Stackoverflow.com/questions/383103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
383,104
<p>When testing in any language, how does everybody <strong>phrase their assertion messages</strong>?</p> <p>I see three obvious ways:</p> <pre><code># assume failure assert (4-2) == 2, "Subtracting 2 from 4 doesn't equal 2" # describe success assert (4-2) == 2, "Subtracting 2 from 4 should equal 2" # be vauge with failure assert (4-2) == 2, "Subtracting 2 from 4 is broken" </code></pre> <p>This is obviously a simple example, but you get the idea. What is the standard practice? What do you do? Why?</p>
[ { "answer_id": 383108, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 3, "selected": true, "text": "Assert Failed: (4-2)==2 : Line 123, File foo.c\n" }, { "answer_id": 383131, "author": "EMP", "author_id": 20336...
2008/12/20
[ "https://Stackoverflow.com/questions/383104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13216/" ]
383,164
<p>I have build a WPF application where users can drag and drop MP3 files onto a listbox. I need a way to calculate the total duration of the playlist.</p> <p>Any libraries I should use? Or is it possible using only the .NET framework?</p>
[ { "answer_id": 13269914, "author": "Daniel Mošmondor", "author_id": 166251, "author_profile": "https://Stackoverflow.com/users/166251", "pm_score": 5, "selected": true, "text": " double GetMediaDuration(string MediaFilename)\n {\n double duration = 0.0;\n using (FileS...
2008/12/20
[ "https://Stackoverflow.com/questions/383164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2172/" ]
383,172
<p>What is the correct output (meaning correct by the ECMA standard) of the following program?</p> <pre><code>function nl(x) { document.write(x + "&lt;br&gt;"); } nl(Function.prototype); nl(Function.prototype.prototype); nl(Function.prototype.prototype == Object.prototype); nl(Function.prototype.prototype.prototype); </code></pre> <p>Chrome and IE6 agree in saying: </p> <pre><code>function Empty() {} null for Chrome / undefined for IE6 false </code></pre> <p>and then crashing.</p> <p>Mozilla outputs:</p> <pre><code>function () { } [object Object] false undefined </code></pre> <p>Are either of these correct? It seems that the Mozilla one does better, but that the best output is</p> <pre><code>function () { } [object Object] true undefined </code></pre>
[ { "answer_id": 383290, "author": "some", "author_id": 36866, "author_profile": "https://Stackoverflow.com/users/36866", "pm_score": 4, "selected": false, "text": "nl(typeof Function.prototype); //function\n nl(typeof Object.prototype); //object\nnl(typeof Array.prototype); //object\nnl(t...
2008/12/20
[ "https://Stackoverflow.com/questions/383172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
383,183
<p>I'm new to JSF world please help me out in generating a pop up window in the page.</p> <p>Here is my requirement I will be having a list of links in my master page(parent) on click of each link I need to show a pop up which contains some details, which I need to get from DB in the pop up mbean. I will have few buttons in my pop up and for each and every action I will be having a DB operation accordingly. I have tried out different ways and I failed.</p> <p>The problem that I'm facing is when pop up loading for the first time it's well and good and projecting the values as expected. But for the second time it showing the new values in the init function and I cant see the new values on the screen instead its showing the first pop up values.</p>
[ { "answer_id": 402333, "author": "SCdF", "author_id": 1666, "author_profile": "https://Stackoverflow.com/users/1666", "pm_score": 0, "selected": false, "text": "http://localhost:8080/myApp/myPopupURL #{name.javaBeanField}" }, { "answer_id": 683258, "author": "Mark", "auth...
2008/12/20
[ "https://Stackoverflow.com/questions/383183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44256/" ]
383,185
<p>When a function is attached to an object and called:</p> <pre><code>function f() { return this.x; } var o = {x: 20}; o.func = f; o.func(); //evaluates to 20 </code></pre> <p><code>this</code> refers to the object that the function was called as a method of. It's equivalent to doing <code>f.call(o)</code>.</p> <p>When the function is called not as part of an object, <code>this</code> refers to the global object. How do I check if a function is being called from a non-object context? Is there any standard keyword to access the global object? Is the only way to do it something like this?</p> <pre><code>globalobj = this; function f() { if (this == globalobj) doSomething(); } </code></pre> <p>Note: I have no particular use case in mind here - I actually am asking about this exact mechanism.</p>
[ { "answer_id": 383190, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 4, "selected": true, "text": "if (this === window)\n" }, { "answer_id": 384252, "author": "olliej", "author_id": 784, "author_profile": ...
2008/12/20
[ "https://Stackoverflow.com/questions/383185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
383,189
<p>The ECMA standard defines a hidden, internal property <code>[[Call]]</code>, which, if implemented, mean the object is callable / is a function.</p> <p>In Python, something similar takes place, except that you can override it yourself to create your own callable objects:</p> <pre><code>&gt;&gt;&gt; class B: ... def __call__(self, x,y): print x,y ... &gt;&gt;&gt; inst = B() &gt;&gt;&gt; inst(1,2) 1, 2 </code></pre> <p>Is there any similar mechanism available in standard JavaScript? If not, what about any of the current JavaScript implementations? </p>
[ { "answer_id": 383199, "author": "some", "author_id": 36866, "author_profile": "https://Stackoverflow.com/users/36866", "pm_score": 3, "selected": true, "text": "function myfunc(){\n var myself = arguments.callee;\n myself.anotherfunc();\n}\n\nmyfunc.avalue=5;\n\nmyfunc.anotherfunc=fun...
2008/12/20
[ "https://Stackoverflow.com/questions/383189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
383,192
<p>I want an msbuild task to compile the views so I can see if there are compile time errors at well... compile time. Any ideas?</p>
[ { "answer_id": 383200, "author": "maxnk", "author_id": 45862, "author_profile": "https://Stackoverflow.com/users/45862", "pm_score": 6, "selected": false, "text": "C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\aspnet_compiler -v /Virtual/Application/Path/Or/Path/In/IIS/Metabase -p C...
2008/12/20
[ "https://Stackoverflow.com/questions/383192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24108/" ]
383,194
<p>A lot of times when reading about web developping on the internet I hear that you should split up your javascript and css files into multiple files.<br> Like split up your css files in a:</p> <ul> <li>clear.css</li> <li>base.css</li> <li>page_specific.css</li> </ul> <p>Or that you should even split those up into files containing positioning, colour and typography information.</p> <p>But isn't it true that a browser is only allowed to make two simultaneous http requests? Splitting the files up into that many would create a whole load of http requests. Isn't it better to just split them into two files, a page specific and and a base/clear css file? and then send them with loads of cache headers? </p> <p>I understand that splitting up the files is easier for development but shouldn't speed be more important?</p>
[ { "answer_id": 383231, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": false, "text": "src" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/383194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35197/" ]
383,195
<p><strong>Background:</strong> This question relates to versions of Delphi below 2009 (ie without Unicode support built in). I have a specification that requires me to transmit a Unicode encoded string over a TCP connection but I do not have Delphi 2009. </p> <p><strong>Question</strong> Is there a single function or very small library (I don't need too much bulk) that I can use to encode a single string into UTF-8 immediately prior sending over the wire? As a second part of my question: if there are UTF-8 encoded strings being sent back as a response, I guess I would then need another function to get it back into a Delphi string format. I understand the limitations of such Unicode support in this way.</p>
[ { "answer_id": 383460, "author": "Rob Kennedy", "author_id": 33732, "author_profile": "https://Stackoverflow.com/users/33732", "pm_score": 6, "selected": true, "text": "WideString WideString UnicodeString PWideChar Windows JclWideStrings JclUnicode WideString WideString Utf8Encode AnsiSt...
2008/12/20
[ "https://Stackoverflow.com/questions/383195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2447/" ]
383,201
<p>From <a href="http://www.jibbering.com/faq/faq_notes/closures.html" rel="noreferrer">http://www.jibbering.com/faq/faq_notes/closures.html</a> :</p> <blockquote> <p>Note: ECMAScript defines an internal [[prototype]] property of the internal Object type. This property is not directly accessible with scripts, but it is the chain of objects referred to with the internal [[prototype]] property that is used in property accessor resolution; the object's prototype chain. A public prototype property exists to allow the assignment, definition and manipulation of prototypes in association with the internal [[prototype]] property. <strong>The details of the relationship between to two are described in ECMA 262 (3rd edition) and are beyond the scope of this discussion.</strong></p> </blockquote> <p>What are the details of the relationship between the two? I've browsed through ECMA 262 and all I've read there is stuff like:</p> <blockquote> <p>The constructor’s associated prototype can be referenced by the program expression constructor.prototype,</p> <p>Native ECMAScript objects have an internal property called [[Prototype]]. The value of this property is either null or an object and is used for implementing inheritance.</p> <p>Every built-in function and every built-in constructor has the Function prototype object, which is the initial value of the expression Function.prototype</p> <p>Every built-in prototype object has the Object prototype object, which is the initial value of the expression Object.prototype (15.3.2.1), as the value of its internal [[Prototype]] property, except the Object prototype object itself.</p> </blockquote> <p>From this all I gather is that the [[Prototype]] property is equivalent to the <code>prototype</code> property for pretty much any object. Am I mistaken?</p>
[ { "answer_id": 383232, "author": "JacquesB", "author_id": 7488, "author_profile": "https://Stackoverflow.com/users/7488", "pm_score": 7, "selected": true, "text": "[[Prototype]] prototype new [[Prototype]] prototype function C() {}\nC.prototype = P1; \nvar obj = new C(); // obj.[[Proto...
2008/12/20
[ "https://Stackoverflow.com/questions/383201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
383,211
<p>I'm spending a bit of time with Erlang, and I'm wanting to apply TDD to code I'm writing.</p> <p>While <a href="http://www.erlang.org/doc/apps/eunit/chapter.html" rel="noreferrer">EUnit</a> in the standard lib provides a nice traditional unit testing framework for testing regular style code, there doesn't seem to be anything to help specifically with testing concurrent code, which is used a LOT in Erlang.</p> <p>Note that we're talking Erlang here, which uses message passing (as opposed to shared state) for communication between concurrent processes, so techniques for unit testing concurrent code in shared state languages may not be applicable.</p> <p>Anyone found a good way to test concurrent code in Erlang?</p>
[ { "answer_id": 450279, "author": "Adam Lindberg", "author_id": 2457, "author_profile": "https://Stackoverflow.com/users/2457", "pm_score": 3, "selected": false, "text": "deep_sum(ListOfLists) ->\n Parent = self(),\n [spawn(fun() -> Parent ! lists:sum(List) end) || List <- ListOfL...
2008/12/20
[ "https://Stackoverflow.com/questions/383211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14160/" ]
383,251
<p>I want to style the slider control so that the height of the draggable thumb is set to 8 pixels.</p> <p>What is the simplest way to do this in <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation" rel="nofollow noreferrer">WPF</a>?</p> <pre><code>&lt;Slider&gt; &lt;Slider.Style&gt; &lt;!-- which xaml here? --&gt; &lt;/Slider.style&gt; &lt;/Slider&gt; </code></pre>
[ { "answer_id": 387252, "author": "Rhys", "author_id": 22169, "author_profile": "https://Stackoverflow.com/users/22169", "pm_score": 4, "selected": true, "text": "<ScrollBar/>\n <LinearGradientBrush x:Key=\"VerticalScrollBarPageButtonNormal\" EndPoint=\"1, 0\" StartPoint=\"0, 0\">\n ...
2008/12/20
[ "https://Stackoverflow.com/questions/383251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2172/" ]
383,291
<p>I am implementing a list, and I am wondering about the definition of the IndexOutOfRange. Which one of the following do you think is better?</p> <pre><code>/// &lt;exception cref="IndexOutOfRangeException"&gt;if index is less than 0 /// or greater than &lt;see cref="Count"/&gt; public T this[int index] { get { return myArray[index]; } } </code></pre> <p>Or</p> <pre><code>/// &lt;exception cref="IndexOutOfRangeException"&gt;if index outside the valid range /// for an array of length equal to &lt;see cref="Count"/&gt;&lt;/exception&gt; public T this[int index] { get { return myArray[index]; } } </code></pre> <p>I am thinking about the case when this class would be used from a .NET language that indexes arrays starting from 1. I don't know much about the topic, but is the second version better than the first by any means?</p>
[ { "answer_id": 383300, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "/// <exception cref=\"IndexOutOfRangeException\">if index is less than <see cref=\"Base\" />\n" }, { "answer_id": 3833...
2008/12/20
[ "https://Stackoverflow.com/questions/383291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41283/" ]
383,293
<p>I am using xcode 2.4.1 on tiger. When i do below everything is ok. when i do</p> <pre><code>pthread_mutex_t mute; ImageMan() { dibSize=0; mute = PTHREAD_MUTEX_INITIALIZER; } </code></pre> <p>I get these two errors</p> <pre><code>error: expected primary-expression before '{' token error: expected `;' before '{' token </code></pre> <p>I dont know why. However if i do pthread_mutex_t mute = PTHREAD_MUTEX_INITIALIZER; it works fine. Why?</p> <p>-edit- I havent ran it but this seems to compile. Why? huh?</p> <pre><code> pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; mute = mutex; </code></pre>
[ { "answer_id": 383343, "author": "geocar", "author_id": 37507, "author_profile": "https://Stackoverflow.com/users/37507", "pm_score": 5, "selected": true, "text": "PTHREAD_MUTEX_INITIALIZER mute=mutex; pthread_mutex_init(&mute, NULL);\n m = malloc(sizeof(pthread_mutex_t)));\npthread_mute...
2008/12/20
[ "https://Stackoverflow.com/questions/383293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
383,306
<p>I use UIScrollView to make large-sized (larger than 320px) UI on iPhone.</p> <p>I made an instance of UIScrollView and added some subviews on it. The problem is that I want to enable scrolling only when user touches outside of subviews, stop scrolling when user touches one of subviews.</p> <p>I read documents and tried to find samples but I can't find good hint. If you have any idea, please help me.</p>
[ { "answer_id": 392562, "author": "lostInTransit", "author_id": 46297, "author_profile": "https://Stackoverflow.com/users/46297", "pm_score": 4, "selected": true, "text": "touchesShouldBegin touchesShouldCancelInContentView" }, { "answer_id": 465061, "author": "Dave Verwer", ...
2008/12/20
[ "https://Stackoverflow.com/questions/383306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47986/" ]
383,307
<p>A simple question</p> <p>Consider this piece of code in C#</p> <pre><code>String a; String b; String c; 1. a = 2. b = 3. //Comment 4. c = "a String"; </code></pre> <p>During compilation, it was fine, but i hit an error when I run my application. From my logs, the error occur at the above.</p> <p>Question: </p> <p>Is the error caused by the comment in line 3? </p> <p>The error is "Object reference not set to an instance of an object" </p> <p>I'm guessing the compiler treats the above code as 1 statement.</p> <p>This code resides in the code behind of an aspx page. (aspx.cs)</p> <p>//Backstory//</p> <p>The aspx was tested in the test servers and was file. However after we deployed the page to the production server, there is an error at pageload(), the line where the error occur is at line 1 of my code example above.</p> <p>It is just my suspicion that the error is caused by the comment.</p> <p>Am I right?</p>
[ { "answer_id": 383315, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "//" }, { "answer_id": 383318, "author": "Aistina", "author_id": 37472, "author_profile": "https:/...
2008/12/20
[ "https://Stackoverflow.com/questions/383307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12944/" ]
383,314
<p>I have a window with 2 column grid. Left column contains a browser control</p> <p>I woould like to display a little window or something to show a that the webpage is still loading.</p> <p>How could I do this?? Could I have a floating window in the 2nd column that shows in front of the browser??? please explain how?</p> <p>Malcolm</p> <p>Thanks bendwey works like a charm. Only thing can't find a GIF that I could use that would show something moving/revolving or the like for the overlay any ideas where?</p>
[ { "answer_id": 387273, "author": "Nate", "author_id": 3413, "author_profile": "https://Stackoverflow.com/users/3413", "pm_score": 3, "selected": true, "text": "<UserControl x:Class=\"UK.Budgeting.XBAP.Loading\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n ...
2008/12/20
[ "https://Stackoverflow.com/questions/383314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40568/" ]
383,321
<p>I added a new column in my table.</p> <pre><code>ALTER TABLE neue_buch modify preis not null; </code></pre> <p>and I have got this error:</p> <pre><code>Error starting at line 40 in command: ALTER TABLE neue_buch modify preis not null Error report: SQL Error: ORA-02296: cannot enable (S1885872.) - null values found 02296. 00000 - "cannot enable (%s.%s) - null values found" *Cause: an alter table enable constraint failed because the table contains values that do not satisfy the constraint. *Action: Obvious </code></pre> <p>What wrong with my MODIFY STATEMENT.?</p> <p>many thanks in advance,</p> <p>magidu</p>
[ { "answer_id": 383333, "author": "Justin Cave", "author_id": 10397, "author_profile": "https://Stackoverflow.com/users/10397", "pm_score": 3, "selected": false, "text": "NEUE_BUCH PREIS" }, { "answer_id": 11219487, "author": "Jeffrey Kemp", "author_id": 103295, "autho...
2008/12/20
[ "https://Stackoverflow.com/questions/383321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
383,324
<p>I understand that .NET FileStream's Flush method only writes the current buffer to disk, but dependent on Windows' disk driver and the hard disk firmware this is no guarantee that the data is actually physically written to disk.</p> <p>Is there a .NET or Win32 method that can give me this guarantee? So if there is power loss one nanosecond after the call to this method comes back, I can still be sure that everything is OK?</p>
[ { "answer_id": 383328, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "Flush() GZipStream Close()" }, { "answer_id": 3992428, "author": "jimvfr", "author_id": 483584, "...
2008/12/20
[ "https://Stackoverflow.com/questions/383324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6358/" ]
383,347
<p>Let's say I've got an object <code>Customer</code> with a couple properties (<code>ID</code>, <code>FirstName</code>, <code>LastName</code>). I've got the default constructor <code>Customer()</code>, but then I've also got a <code>Customer(DataRow dr)</code>, since I load this object from a database and that's a simple way to do it.</p> <p>I frequently come to a point where I want to set up another constructor, <code>Customer(int ID)</code>, for times when I want to load a <code>Customer</code> but I haven't made the trip to the database yet. The simplest way to me seems to be like so:</p> <pre><code>Customer(int ID) { DataTable dt = DataAccess.GetCustomer(ID); if (dt.Rows.Count &gt; 0) { // pass control to the DataRow constructor at this point? } else { // pass control to the default constructor at this point? } } </code></pre> <p>It makes sense to reuse the code that's already in the DataRow constructor, but I can't figure out a way to call that and return what it gives me. Through Googling, I've found information about constructor overloading with the <code>: this()</code> syntax, but all those examples seem backwards or incompatible with what I'm trying to do. </p> <p>So there's a gap in my understanding of constructors, but I can't seem to sort it out. What am I missing?</p>
[ { "answer_id": 383360, "author": "joel.neely", "author_id": 3525, "author_profile": "https://Stackoverflow.com/users/3525", "pm_score": 0, "selected": false, "text": "Customer ProvideCustomer(int ID)\n{\n Customer result; // or initialize to null to signal more work to come\n DataT...
2008/12/20
[ "https://Stackoverflow.com/questions/383347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3248/" ]
383,368
<p>I'm implementing saved data on my app by using NSUserDefaults, like this:</p> <pre><code>[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:0],@"mySetting",nil]]; // check int firstLaunch = [[NSUserDefaults standardUserDefaults] integerForKey:@"mySetting"]; // set [[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"mySetting"]; </code></pre> <p>Now for development purposes, I'd like to be able to remove the saved data and go back to the defaults, without having to remove the app and re-install it each single time. Is there a quick way to do that? I thought resetStandardUserDefaults would do the job, but it doesn't.</p>
[ { "answer_id": 383424, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "-removeObjectForKey: -<type>ForKey:" }, { "answer_id": 383427, "author": "Abizern", "author_id": 41116, "au...
2008/12/20
[ "https://Stackoverflow.com/questions/383368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36182/" ]
383,389
<p>I recently wanted to get a decend IDE for my PHP side-projecs, and by searching SO found Eclipse+PDT. Although it's not quite at the level of Visual Studio yet, it's pretty nice and better than Notepad++ for this purpose. I can even debug somewhat, although it's pretty glitchy.</p> <p>But there is one thing that is bugging me. It seems to have some kind of weird performance issue, whereupon it it uses lots of CPU about once a minute or so. By itself this is not noticeable, but if you do something else at the same time (like watch a movie, or play Quake 3), it produces an annoying hicup now and then.</p> <p>Granted, my computer is not state-of-the-art (Sempron 2200+ with 1GB of RAM), but then it's certainly more than enough for all of this.</p> <p>Another performance question is that I'm used to Visual Studio where IntelliSense pops up as soon as you type a compatible symbol. Here you have to wait for a moment. Is there any way to make it open up instantly?</p> <p>P.S. Perhaps there's an even better <strong>freeware</strong> IDE for PHP?</p> <p><b>Added:</b> It was suggested by Stefan Schmidt to change Auto-Activation speed. It seems that there is a bug with this. The smaller I set it, the more it fails to open at all. For example, when it's 200, it opens mostly all the time when there is something to open. At 10 it doesn't open (at least) for static class members. What gives?</p>
[ { "answer_id": 390754, "author": "Kire Haglin", "author_id": 2049208, "author_profile": "https://Stackoverflow.com/users/2049208", "pm_score": 1, "selected": false, "text": "-XgcPrio:pausetime \n-XpauseTarget:250\n" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/383389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41360/" ]
383,390
<p>I've installed PowerShell recently and one of the first things I started looking for was how to create a new user. After looking for some time I still haven't found this. I have a little experience in bash on linux and find it very effective. Creating users there is trivial. Is there an easy\built-in way to create a local user with PowerShell?</p> <p>Thank you.</p>
[ { "answer_id": 383396, "author": "BobbyShaftoe", "author_id": 38426, "author_profile": "https://Stackoverflow.com/users/38426", "pm_score": 5, "selected": true, "text": "function create-account ([string]$accountName = \"testuser\") { \n $hostname = hostname \n $comp = [adsi] \"Wi...
2008/12/20
[ "https://Stackoverflow.com/questions/383390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430254/" ]
383,402
<p>In <a href="https://stackoverflow.com/questions/377716/javascript-automatic-gettersetters-john-resig-book">another question</a>, a user pointed out that the <code>new</code> keyword was dangerous to use and proposed a solution to object creation that did not use <code>new</code>. I didn't believe that was true, mostly because I've used <a href="https://en.wikipedia.org/wiki/Prototype_JavaScript_Framework" rel="nofollow noreferrer">Prototype</a>, <a href="https://en.wikipedia.org/wiki/Prototype_JavaScript_Framework" rel="nofollow noreferrer">Script.aculo.us</a> and other excellent JavaScript libraries, and everyone of them used the <code>new</code> keyword.</p> <p>In spite of that, yesterday I was watching Douglas Crockford's talk at YUI theater and he said the exactly same thing, that he didn't use the <code>new</code> keyword anymore in his code (<a href="http://www.youtube.com/watch?v=ya4UHuXNygM&amp;t=50m23s" rel="nofollow noreferrer">Crockford on JavaScript - Act III: Function the Ultimate - 50:23 minutes</a>).</p> <p>Is it 'bad' to use the <code>new</code> keyword? What are the advantages and disadvantages of using it?</p>
[ { "answer_id": 383422, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 5, "selected": false, "text": "var foo = function () {\n var pub = { };\n return pub;\n}\nvar bar = foo();\n function foo() { }\nvar bar = ne...
2008/12/20
[ "https://Stackoverflow.com/questions/383402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7595/" ]
383,403
<p>Print all 12 verses of the <a href="http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)" rel="nofollow noreferrer">popular holiday song</a>.</p> <p>By 12 <em>verses</em> I mean the repetition of each line as is sung in the song, ie</p> <p>Verse One: On the first day of Christmas my true love gave to me a partridge in a pear tree.</p> <p>Verse Two On the second day of Christmas my true love gave to me two turtle doves and a partridge in a pear tree.</p> <p>...</p> <p>Verse N: On the nth day of Christmas my true love gave to me (Verse N-1 without the first line) (line added in verse N)</p>
[ { "answer_id": 383404, "author": "fizzer", "author_id": 18167, "author_profile": "https://Stackoverflow.com/users/18167", "pm_score": 6, "selected": true, "text": "(mapc #'princ\n (reverse (maplist #'(lambda(l)\n (format nil \n \"On the ~:R day of Christmas my tru...
2008/12/20
[ "https://Stackoverflow.com/questions/383403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18167/" ]
383,405
<p>I'm working on a small GreaseMonkey script where I would like to embed a jQuery plugin (Markitup) so that the script is fully self contained (images + js) except for jQuery which is served from google.</p> <p>I found the site <a href="http://www.greywyvern.com/code/php/binary2base64" rel="noreferrer">http://www.greywyvern.com/code/php/binary2base64</a> which says that you can embed javascript with the href if you base64 encode the script, much like serving images as basse64 from CSS.</p> <pre><code>&lt;script type="text/javascript" href="data:text/javascript;base64,dmFyIHNjT2JqMSA9IG5ldyBzY3Jv..."&gt;&lt;/script&gt; </code></pre> <p>So i tried that but couldn't get it to work at all, using Firefox 3.0.5 on OS X.</p> <p>I put together a small test page to isolate the problem but couldn't get it to work at that page either.</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Title&lt;/title&gt; &lt;meta charset="utf-8"&gt; &lt;/head&gt; &lt;body&gt; &lt;script href="data:text/javascript;base64,YWxlcnQoJ2FzYWRhc2QnKTsK"&gt;&lt;/script&gt; &lt;script&gt;alert('a');&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The base64 string (YWxlcnQoJ2FzYWRhc2QnKTsK) says <code>alert('asadasd');</code> so I'm supposed to get two alerts but the only one I see is the second one where the alert is located as text inside the script tag.</p> <p>Am I doing something wrong or why isn't this working, any ideas?</p>
[ { "answer_id": 383443, "author": "rombarcz", "author_id": 47267, "author_profile": "https://Stackoverflow.com/users/47267", "pm_score": 3, "selected": false, "text": "<script src=\"...\"\n ^^^\n src NOT href\n" }, { "answer_id": 383542, "author": "PhiLho", "...
2008/12/20
[ "https://Stackoverflow.com/questions/383405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32728/" ]
383,414
<p>I have a K* window, and within it, a widget which needs the events filtered.</p> <p>For example I do not want the possibility of clicking it...</p> <p>How can I do that? </p> <p>Have I to use eventfilters? In this case, what's the best way?</p> <hr> <p>but my problem is that I can't subclass my widget,because it's a TerminalInterface->widget(), not an object like others :\</p>
[ { "answer_id": 383468, "author": "Mark Beckwith", "author_id": 45799, "author_profile": "https://Stackoverflow.com/users/45799", "pm_score": 1, "selected": false, "text": "enabled widget->setEnabled(false) QPushButton" }, { "answer_id": 389421, "author": "Mark Beckwith", ...
2008/12/20
[ "https://Stackoverflow.com/questions/383414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39339/" ]
383,416
<p>If I am using <code>ReaderWriterLockSlim</code> to acquire read/write locks, do I need to make my variables <code>volatile</code> or use <code>Interlocked.Increment</code>?</p> <p>For example, would the code in the <code>Add</code> method below work fine, or does it need enhancement?</p> <pre><code>public class AppendableList&lt;T&gt; { // semi-immutable; supports appending only private T[] data = new T[16]; private ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim(); public int Count { get; private set; } public T this[int index] { get { rwLock.EnterReadLock(); try { return data[index]; } finally { rwLock.ExitReadLock(); } } } public void Add(T item) { rwLock.EnterUpgradeableReadLock(); try { if (Count == data.Length) reAllocateArray(); // upgrades to write lock data[Count++] = item; // do I need to use Interlocked here? } finally { rwLock.ExitUpgradeableReadLock(); } } } </code></pre> <p><strong>EDIT:</strong> I'm trying to write a light-weight, fast and simple list that allows multiple threads to access its data concurrently (sort of producer-consumer buffer). I have edited the code above removing the simplifications I used before, so the issue should be clearer now. It seems to me that this code is thread-safe, but I am not sure whether all threads will see the updated value of <code>Count</code> right after exiting the upgradeable lock.</p> <p><strong>EDIT 2</strong>: The "Write" lock here is used to indicate writing to the <em>array reference</em>, not the array elements. I'm assuming this is sufficient (since the data itself is immutable). I guess that I need to use Interlocked when incrementing <code>Count</code>. Is that true?</p>
[ { "answer_id": 383418, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": true, "text": "ReaderWriterLockSlim Interlocked volatile lock [MethodImpl] ReaderWriterLock[Slim] get Count++ try finally private...
2008/12/20
[ "https://Stackoverflow.com/questions/383416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41283/" ]
383,444
<p>Is it possible to do a google map lookup using the google maps API from a UK postcode? I know you can search by UK postcode on their website, but this converts to lat / long. I don't have access to the PAF database to be able to convert to long / lat.</p> <p>An example:</p> <p>Users have an item to sell. One of the details of that item is a postcode, where the user / item is located. When the items are displayed on the front end of the website, there needs to be a google map of the items location generated using the postcode.</p> <p>If this is possible, how do I do it?</p>
[ { "answer_id": 2157228, "author": "Bobby Jack", "author_id": 5058, "author_profile": "https://Stackoverflow.com/users/5058", "pm_score": 1, "selected": false, "text": "function usePointFromPostcode(postcode, callbackFunction) {\n localSearch.setSearchCompleteCallback(null, function() ...
2008/12/20
[ "https://Stackoverflow.com/questions/383444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1349865/" ]
383,449
<p>I have a JSP page that receives an ArrayList of event objects, each event object contains an ArrayList of dates. I am iterating through the event objects with the following:</p> <p> </p> <p>How can I iterate through the dateTimes ArrayList of each event object and print out each events date/times ?</p>
[ { "answer_id": 383458, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 2, "selected": false, "text": "<%@ taglib uri=\"http://java.sun.com/jstl/core\" prefix=\"c\" %>\n<%@ taglib uri=\"http://java.sun.com/jstl/fmt\" prefix=\"...
2008/12/20
[ "https://Stackoverflow.com/questions/383449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16684/" ]
383,480
<p>Have created a c++ implementation of the Hough transform for detecting lines in images. Found lines are represented using rho, theta, as described on wikipedia:</p> <blockquote> <p>"The parameter r represents the distance between the line and the origin, while θ is the angle of the vector from the origin to this closest point "</p> </blockquote> <p>How can i find the intersection point in x, y space for two lines described using r, θ?</p> <p>For reference here are my current functions for converting in and out of hough space:</p> <pre><code>//get 'r' (length of a line from pole (corner, 0,0, distance from center) perpendicular to a line intersecting point x,y at a given angle) given the point and the angle (in radians) inline float point2Hough(int x, int y, float theta) { return((((float)x)*cosf(theta))+((float)y)*sinf(theta)); } //get point y for a line at angle theta with a distance from the pole of r intersecting x? bad explanation! &gt;_&lt; inline float hough2Point(int x, int r, float theta) { float y; if(theta!=0) { y=(-cosf(theta)/sinf(theta))*x+((float)r/sinf(theta)); } else { y=(float)r; //wth theta may == 0?! } return(y); } </code></pre> <p>sorry in advance if this is something obvious..</p>
[ { "answer_id": 416559, "author": "erisu", "author_id": 47971, "author_profile": "https://Stackoverflow.com/users/47971", "pm_score": 4, "selected": false, "text": "//Find point (x,y) where two parameterized lines intersect :p Returns 0 if lines are parallel \nint parametricIntersect(floa...
2008/12/20
[ "https://Stackoverflow.com/questions/383480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47971/" ]
383,510
<p>We have a large Java application that run as applet or Java Web Start. And it grow more and more. Typical a user need only a small part of the classes. Because Java does not know which class can it found in which jar file that it load all jar files until it find the class. If it will load a class that not exist (for example a resource bundle) then it load all jar files. This reduce the start time on a small bandwidth very large.</p> <p>Is there a small framework with which we can load the plugins only if needed? Or better if needed and on background?</p> <p>Of course the framework should not delay the start time self with it large size.</p> <p>I think it should use a URLClassLoader for downloading.</p>
[ { "answer_id": 383533, "author": "asalamon74", "author_id": 21348, "author_profile": "https://Stackoverflow.com/users/21348", "pm_score": 0, "selected": false, "text": "<jar href=\"sound.jar\" download=\"lazy\"/>\n <package>" } ]
2008/12/20
[ "https://Stackoverflow.com/questions/383510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12631/" ]
383,528
<p>I have a Perl hash whose keys start with, or are, numbers.</p> <p>If I use,</p> <pre><code>foreach my $key (sort keys %hash) { print $hash{$key} . "\n"; } </code></pre> <p>the list might come out as,</p> <pre><code>0 0001 1000 203 23 </code></pre> <p>Instead of</p> <pre><code>0 0001 23 203 1000 </code></pre>
[ { "answer_id": 383539, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 6, "selected": true, "text": "foreach my $key (sort { $a <=> $b} keys %hash) {\n print $hash{$key} . \"\\n\";\n}\n" }, { "answer_id": 38546...
2008/12/20
[ "https://Stackoverflow.com/questions/383528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15884/" ]
383,550
<p>im just starting to learn flex and im trying to understand how Flex does remoting? From what i have read it looks like Flex provides a LifeCycle data services war which sits on your server and intercepts your remote calls , is this close?</p> <p>Im concerned that if i use this option that 1. Ill have to add an extra war to my server - the lifecycle data service war and 2. That i will have to pay for a license for each instance i use on each cpu.</p> <p>Is there an easier [free] option out there which i can use to call my remote java objects from within my flex mxml?</p>
[ { "answer_id": 383539, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 6, "selected": true, "text": "foreach my $key (sort { $a <=> $b} keys %hash) {\n print $hash{$key} . \"\\n\";\n}\n" }, { "answer_id": 38546...
2008/12/20
[ "https://Stackoverflow.com/questions/383550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24481/" ]
383,551
<p>Can any one tell the bit size of <strong>boolean</strong> in Java?</p>
[ { "answer_id": 383563, "author": "rics", "author_id": 21047, "author_profile": "https://Stackoverflow.com/users/21047", "pm_score": 2, "selected": false, "text": "boolean int" }, { "answer_id": 383597, "author": "Jon Skeet", "author_id": 22656, "author_profile": "http...
2008/12/20
[ "https://Stackoverflow.com/questions/383551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40945/" ]