qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
271,340
<p>I'm trying to use a dojo combobox with an Ajax data source. What I have is </p> <pre><code>&lt;div dojoType="dojo.data.ItemFileReadStore" jsId="tags" url="&lt;%=ResolveClientUrl("~/Tag/TagMatches")%&gt;" &gt; &lt;/div&gt; &lt;select dojoType="dijit.form.ComboBox" store="tags" value="" name="tagName"&gt; &lt;/select&gt; </code></pre> <p>Which does work except that I can't restrict the search set on the server side because I don't know how to change the url from which the data is pulled in order to specify a parameter. Any hints? </p>
[ { "answer_id": 271443, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": true, "text": "<div>" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/361/" ]
271,347
<p>I have a class that stores a serialized value and a type. I want to have a property/method returning the value already casted:</p> <pre><code>public String Value { get; set; } public Type TheType { get; set; } public typeof(TheType) CastedValue { get { return Convert.ChangeType(Value, typeof(_Type)); } </code></pre> <p>Is this possible in C#?</p>
[ { "answer_id": 271356, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackoverflow.com/users/5745", "pm_score": 7, "selected": false, "text": "class Foo<TValue> {\n public string Value { get; set; }\n public TValue TypedValue {\n get {\n retur...
2008/11/07
[ "https://Stackoverflow.com/questions/271347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,364
<p><code>:vimgrep</code> looks like a really useful thing.</p> <p>Here's how to use it:</p> <pre><code>:vim[grep][!] /{pattern}/[g][j] {file} ... </code></pre> <p><code>:help</code> says that you can essentially glob <code>{file}</code> to name, say, <code>*.c</code> for the current directory. I may have started Vim with a list of files that is complicated enough that I don't want to manually type it in for <code>{file}</code>, and besides Vim already knows what those files are.</p> <p>What I would like to do is vimgrep over any of:</p> <ul> <li><code>:args</code></li> <li><code>:files</code></li> <li><code>:buffers</code></li> </ul> <p>What variable(s) would I use in place of <code>{file}</code> to name, respectively, any of those lists in a <code>vimgrep</code> command?</p>
[ { "answer_id": 271381, "author": "Jerub", "author_id": 14648, "author_profile": "https://Stackoverflow.com/users/14648", "pm_score": 3, "selected": false, "text": ":bufdo vimgrep /pattern/ %\n" }, { "answer_id": 271709, "author": "Luc Hermitte", "author_id": 15934, "a...
2008/11/07
[ "https://Stackoverflow.com/questions/271364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35221/" ]
271,378
<p>I have designed my site with a 900 x 600 fixed background image. On the computer it looks fine. How will it look on a PDA device? Will I have to design it separately for PDA?</p> <p>How should check whether my site can be browsed effectively from mobile phone?</p> <p>What should I do?</p>
[ { "answer_id": 271452, "author": "Treb", "author_id": 22114, "author_profile": "https://Stackoverflow.com/users/22114", "pm_score": 2, "selected": false, "text": "<link rel=\"stylesheet\" href=\"small.css\" type=\"text/css\" media=\"handheld\">\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,380
<p>One of the files in my current head revision got corrupted. I want to make an older revision of that file the head revision as usually people sync to head revsion in my project. How to do that?</p>
[ { "answer_id": 271387, "author": "Martin v. Löwis", "author_id": 33006, "author_profile": "https://Stackoverflow.com/users/33006", "pm_score": 7, "selected": true, "text": "svn merge -rHEAD:oldrev filename\nsvn commit -m \"rolled back to oldrev\"\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13440/" ]
271,384
<ul> <li>What are the pros and cons of LINQ (Language-Integrated Query)?</li> <li>What are the best and worst cases in which to use LINQ?</li> <li>How have you benefitted or not benefitted from using LINQ?</li> <li>Which data sources benefit the least and the most from LINQ?</li> </ul>
[ { "answer_id": 271415, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": true, "text": "OrderBy" }, { "answer_id": 271462, "author": "Toby", "author_id": 291137, "author_profile": "https://...
2008/11/07
[ "https://Stackoverflow.com/questions/271384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35331/" ]
271,394
<p>A class I am taking currently requires us to do all of our coding in smalltalk (it's a Design class). On one of our projects, I am looking to do some things, and am having a tough time finding how to do them. It seems that what most people do is modify their own version of smalltalk to do what they need it to do. I am not at liberty to do this, as this would cause an error on my prof's computer when he doesn't have the same built-in methods I do.</p> <p>Here's what I'm looking to do:</p> <p>Random Numbers. I need to create a random number between 1 and 1000. Right now I'm faking it by doing </p> <pre><code>rand := Random new. rand := (rand nextValue) * 1000. rand := rand asInteger. </code></pre> <p>This gives me a number between 0 and 1000. Is there a way to do this in one command? similar to </p> <pre><code>Random between: 0 and: 1000 </code></pre> <p>And/Or statements. This one bugs the living daylights out of me. I have tried several different configurations of </p> <pre><code>(statement) and: (statement) ifTrue... (statement) and (statement) ifTrue... </code></pre> <p>So I'm faking it with nested ifTrue statements:</p> <pre><code>(statement) ifTrue:[ (statement) ifTrue:[... </code></pre> <p>What is the correct way to do and/or and Random in smalltalk?</p>
[ { "answer_id": 271402, "author": "Martin v. Löwis", "author_id": 33006, "author_profile": "https://Stackoverflow.com/users/33006", "pm_score": 4, "selected": true, "text": " (expr) and: (expr) ifTrue: aBlock\n" }, { "answer_id": 271500, "author": "Martin v. Löwis", "autho...
2008/11/07
[ "https://Stackoverflow.com/questions/271394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50/" ]
271,398
<p>Let's make a list of answers where you post your excellent and favorite <a href="http://en.wikipedia.org/wiki/Extension_method" rel="nofollow noreferrer">extension methods</a>. </p> <p>The requirement is that the full code must be posted and a example and an explanation on how to use it.</p> <p>Based on the high interest in this topic I have setup an Open Source Project called extensionoverflow on <a href="http://www.codeplex.com/extensionoverflow" rel="nofollow noreferrer"><strong>Codeplex</strong></a>. </p> <p><strong>Please mark your answers with an acceptance to put the code in the Codeplex project.</strong></p> <p><strong>Please post the full sourcecode and not a link.</strong></p> <p><strong>Codeplex News:</strong></p> <p>24.08.2010 The Codeplex page is now here: <a href="http://extensionoverflow.codeplex.com/" rel="nofollow noreferrer">http://extensionoverflow.codeplex.com/</a></p> <p>11.11.2008 <strong>XmlSerialize / XmlDeserialize</strong> is now <a href="http://www.codeplex.com/extensionoverflow/SourceControl/FileView.aspx?itemId=284374&amp;changeSetId=17001" rel="nofollow noreferrer">Implemented</a> and <a href="http://www.codeplex.com/extensionoverflow/SourceControl/FileView.aspx?itemId=288847&amp;changeSetId=17001" rel="nofollow noreferrer">Unit Tested</a>.</p> <p>11.11.2008 There is still room for more developers. ;-) <strong>Join NOW!</strong></p> <p>11.11.2008 Third contributer joined <a href="http://www.codeplex.com/extensionoverflow" rel="nofollow noreferrer">ExtensionOverflow</a>, welcome to <a href="http://www.codeplex.com/site/users/view/BKristensen" rel="nofollow noreferrer">BKristensen</a></p> <p>11.11.2008 <strong>FormatWith</strong> is now <a href="http://www.codeplex.com/extensionoverflow/SourceControl/FileView.aspx?itemId=284374&amp;changeSetId=16839" rel="nofollow noreferrer">Implemented</a> and <a href="http://www.codeplex.com/extensionoverflow/SourceControl/FileView.aspx?itemId=288847&amp;changeSetId=16839" rel="nofollow noreferrer">Unit Tested</a>.</p> <p>09.11.2008 Second contributer joined <a href="http://www.codeplex.com/extensionoverflow" rel="nofollow noreferrer">ExtensionOverflow</a>. welcome to <a href="https://stackoverflow.com/users/3055/chakrit">chakrit</a>.</p> <p>09.11.2008 We need more developers. ;-)</p> <p>09.11.2008 <strong>ThrowIfArgumentIsNull</strong> in now <a href="http://www.codeplex.com/extensionoverflow/SourceControl/FileView.aspx?itemId=278942&amp;changeSetId=16468" rel="nofollow noreferrer">Implemented</a> and <a href="http://www.codeplex.com/extensionoverflow/SourceControl/FileView.aspx?itemId=284112&amp;changeSetId=16468" rel="nofollow noreferrer">Unit Tested</a> on Codeplex.</p>
[ { "answer_id": 271409, "author": "bovium", "author_id": 11135, "author_profile": "https://Stackoverflow.com/users/11135", "pm_score": 5, "selected": false, "text": "public static class Extensions\n{\n public static void ThrowIfArgumentIsNull<T>(this T obj, string parameterName) where ...
2008/11/07
[ "https://Stackoverflow.com/questions/271398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11135/" ]
271,406
<p>I have a table in lua with some data.</p> <pre><code>sometable = { {name = "bob", something = "foo"}, {name = "greg", something = "bar"} } </code></pre> <p>I then want to loop through the table and assign a number to each name as a variable. New to lua and tried it like this.</p> <pre><code>for i,t in ipairs(sometable) do t.name = i end </code></pre> <p>I was then assuming print("name1", bob) would give me name1 = 1. Right now I'm getting nil. So I'm back to my ugly static list of variables till some kind soul tells me how I'm an idiot.</p>
[ { "answer_id": 274107, "author": "Doug Currie", "author_id": 33252, "author_profile": "https://Stackoverflow.com/users/33252", "pm_score": 3, "selected": true, "text": "> sometable = {{name = \"bob\", something = \"foo\"},{name = \"greg\", something = \"bar\"}}\n> for i,t in ipairs(somet...
2008/11/07
[ "https://Stackoverflow.com/questions/271406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18933/" ]
271,428
<hr> <p>Thanks for answers,Actually I am not puzzled about draw 1024*768 pixels is slower than 100* 100 pixels... It is so simple a logic.. Which made me puzzled is that DrawImage's interpolation algorithm may be very slow, while there exists lots of better algorithm, and its decoder seems can decode from a jpg with a certain resolution, it is really cool, I search for sometime but do not find any free lib to do this...</p> <p>It is really strange! I add the following code into on Paint method. c:\1.jpg is 5M jpg file, about 4000*3000</p> <p>//--------------------------------------------------------------</p> <pre><code>HDC hdc = pDC-&gt;GetSafeHdc(); bitmap = Bitmap::FromFile(L"c:\\1.jpg",true); Graphics graphics(hdc); graphics.SetInterpolationMode( InterpolationModeNearestNeighbor ); graphics.DrawImage(bitmap,0,0,200,200); </code></pre> <p>The above is really fast! even real time! I don't think decode a 5m JPG can be that fast!</p> <p>//--------------------------------------------------------------</p> <pre><code>HDC hdc = pDC-&gt;GetSafeHdc(); bitmap = Bitmap::FromFile(L"c:\\1.jpg",true); Graphics graphics(hdc); graphics.SetInterpolationMode( InterpolationModeNearestNeighbor ); graphics.DrawImage(bitmap,0,0,2000,2000); </code></pre> <p>The above code become really slow</p> <p>//--------------------------------------------------------------</p> <p>If I add Bitmap = Bitmap::FromFile(L"c:\1.jpg", true); // into construct</p> <p>leave </p> <pre><code> Graphics graphics(hdc); graphics.SetInterpolationMode( InterpolationModeNearestNeighbor ); graphics.DrawImage(bitmap,0,0,2000,2000); </code></pre> <p>in OnPaint method, The code is still a bit slow~~~</p> <p>//------------------------------------------------------------------</p> <p>Comparing with decoding, the drawImage Process is really slow...</p> <p>Why and How did they do that? Did Microsoft pay the men taking charge of decoder double salary than the men taking charge of writing drawingImage?</p>
[ { "answer_id": 271463, "author": "Johann Gerell", "author_id": 6345, "author_profile": "https://Stackoverflow.com/users/6345", "pm_score": 3, "selected": false, "text": "graphics.DrawImage(bitmap,0,0,200,200);\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25749/" ]
271,438
<p>I am having a .cs file, i need to execute that file.. I don't have experience in C#.. Please help.. Do we have to install any software to run it.. </p> <p>Currently i am using windows XP.. </p> <p>Please help me... </p>
[ { "answer_id": 272151, "author": "Xiaofu", "author_id": 31967, "author_profile": "https://Stackoverflow.com/users/31967", "pm_score": 0, "selected": false, "text": "csc /out:your_app_name.exe your_cs_filename.cs\n" }, { "answer_id": 53193120, "author": "NanoWar", "author_...
2008/11/07
[ "https://Stackoverflow.com/questions/271438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,440
<p>I met an interesting issue about C#. I have code like below.</p> <pre><code>List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;(); int variable = 0; while (variable &lt; 5) { actions.Add(() =&gt; variable * 2); ++ variable; } foreach (var act in actions) { Console.WriteLine(act.Invoke()); } </code></pre> <p>I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s.</p> <p>It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output.</p> <p>Is there a way to work round this limit to have each action instance have its own captured variable?</p>
[ { "answer_id": 271447, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 9, "selected": true, "text": "while (variable < 5)\n{\n int copy = variable;\n actions.Add(() => copy * 2);\n ++ variable;\n}\n" }, { ...
2008/11/07
[ "https://Stackoverflow.com/questions/271440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26349/" ]
271,464
<p>I have a multiline text string (e.g. "Stuff\nMore Stuff\nYet More Stuff"), and I want to paint it, along with a bitmap into a tooltip. Since I am painting the bitmap, I need to set OwnerDraw to true, which I am doing. I am also handling the Popup event, so I can size the tooltip to be large enough to hold the text and the bitmap.</p> <p>I am calling e.DrawBackground and e.DrawBorder(), and then painting my bitmap on the left side of the tooltip area. </p> <p>Is there a set of flags I can pass to e.DrawText() in order to left-align the text, but to offset it so that it doesn't get painted over my bitmap? Or do I need to custom draw all the text as well (which will probably involve splitting the string on newlines, etc)?</p> <p>UPDATED: The final code looks like this:</p> <pre><code>private void _ItemTip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); // Reserve a square of size e.Bounds.Height x e.Bounds.Height // for the image. Keep a margin around it so that it looks good. int margin = 2; Image i = _ItemTip.Tag as Image; if (i != null) { int side = e.Bounds.Height - 2 * margin; e.Graphics.DrawImage(i, new Rectangle(margin, margin, side, side)); } // Construct bounding rectangle for text (don't want to paint it over the image). int textOffset = e.Bounds.Height + 2 * margin; RectangleF rText = e.Bounds; rText.Offset(textOffset, 0); rText.Width -= textOffset; e.Graphics.DrawString(e.ToolTipText, e.Font, Brushes.Black, rText); } </code></pre>
[ { "answer_id": 271628, "author": "Robert Jeppesen", "author_id": 9436, "author_profile": "https://Stackoverflow.com/users/9436", "pm_score": 3, "selected": true, "text": " RectangleF rect = new RectangleF(100,100,100,100);\n e.Graphics.DrawString(myString, myFont, myBrush, rect);...
2008/11/07
[ "https://Stackoverflow.com/questions/271464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2683/" ]
271,485
<p>whats the best way to export a Datagrid to excel? I have no experience whatsoever in exporting datagrid to excel, so i want to know how you guys export datagrid to excel. i read that there are a lot of ways, but i am thinking to just make a simple export excel to datagrid function.i am using asp.net C#</p> <p>cheers.. </p>
[ { "answer_id": 271487, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<table><tr><td>...</td></tr>...</table>" }, { "answer_id": 271496, "author": "Christian C. Salvadó", "...
2008/11/07
[ "https://Stackoverflow.com/questions/271485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23491/" ]
271,488
<p>I asked <a href="https://stackoverflow.com/questions/269417/which-language-should-i-use">a question</a> earlier about which language to use for an AI prototype. The consensus seemed to be that if I want it to be fast, I need to use a language like Java or C++, but that Python / Perl / Ruby would be good for the interface bits. </p> <p>So, this leads me on to another question. How easy is it to link these languages together? And which combination works best? So, if I wanted to have a Ruby CGI-type program calling C++ or Java AI functions, is that easy to do? Any pointers for where I look for information on doing that kind of thing? Or would a different combination be better?</p> <p>My main experience with writing web applications started with C++ CGI and then moved on to Java servlets (about 10 years ago) and then after a long gap away from programming I did some PHP. But I've not had experience of writing a web application in a scripting language which then calls out to a compiled language for the speed-critical bits. So any advice will be welcome!</p>
[ { "answer_id": 271494, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 2, "selected": false, "text": "require \"java\"\n# The next line exposes Java's String as JString\ninclude_class(\"java.lang.String\") { |pkg, name| \"J\" + n...
2008/11/07
[ "https://Stackoverflow.com/questions/271488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
271,506
<p>I am refering to the <a href="https://stackoverflow.com/questions/252893/how-do-you-change-the-classpath-within-java#252905">question</a> on changing the classpath programmatically.</p> <p>I read and found out that there is some function under <strong>System</strong> class as getproperties where we can retrieve the properties and then also can set it using setProperties().</p> <p>The answers however I got was that It Wont work. I have not tried this myself, however, i am taking the call.</p> <p>Just to clarify, then why these setProperty() and getProperty() methods are there if they cannot alter it at run time. Or is this specific to the classpath property only ?</p> <p>I will appreciate if someone can present a scenario where they are really helpful?</p>
[ { "answer_id": 271522, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": false, "text": "/*\nAdd the URL handler to the handler property. This informs \nIBMJSSE what URL handler to use to handle the safkeyring \nsupp...
2008/11/07
[ "https://Stackoverflow.com/questions/271506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11614/" ]
271,520
<p>I could do this in C#..</p> <pre><code>int number = 2; string str = "Hello " + number + " world"; </code></pre> <p>..and str ends up as "Hello 2 world".</p> <p>In VB.NET i could do this..</p> <pre><code>Dim number As Integer = 2 Dim str As String = "Hello " + number + " world" </code></pre> <p>..but I get an InvalidCastException "Conversion from string "Hello " to type 'Double' is not valid."</p> <p>I am aware that I should use .ToString() in both cases, but whats going on here with the code as it is?</p>
[ { "answer_id": 271529, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "Dim number As Integer = 2\nDim str As String = \"Hello \" & number & \" world\"\n" }, { "answer_id": 271531, ...
2008/11/07
[ "https://Stackoverflow.com/questions/271520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233/" ]
271,521
<p>Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose their 'real' names and instead one sees their values listed in the Variables window as arg0, arg1, arg2, etc but at least the values are visible.</p> <p>This is occurring at present in relation to classes defined within the core JDK. I have verified that the installed and current JRE is a JDK.</p> <p>Is anybody able to shed some light on this behaviour?</p>
[ { "answer_id": 940988, "author": "Geoffrey Zheng", "author_id": 62479, "author_profile": "https://Stackoverflow.com/users/62479", "pm_score": 4, "selected": false, "text": "mkdir \\tmp; mkdir \\tmp\\out" }, { "answer_id": 31980261, "author": "Naresh", "author_id": 3359659...
2008/11/07
[ "https://Stackoverflow.com/questions/271521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35138/" ]
271,526
<p>I use <code>x != null</code> to avoid <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/NullPointerException.html" rel="noreferrer"><code>NullPointerException</code></a>. Is there an alternative?</p> <pre class="lang-java prettyprint-override"><code>if (x != null) { // ... } </code></pre>
[ { "answer_id": 271576, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 6, "selected": false, "text": "a.f(b); <-> b.f(a);\n" }, { "answer_id": 271587, "author": "javamonkey79", "author_id": 276...
2008/11/07
[ "https://Stackoverflow.com/questions/271526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34856/" ]
271,530
<p>There is an application with an extensive object graph. This graph mainly consists of a set of subgraphs which are connected to the rest of the graph through the only reference. But internally each such subgraph has some number of cross-references among objects. Once in a while such a sub graph needs to be thrown away. Would it be enough just to set to null the only referece which points to that subgraph to make it eligible for garbage collection?</p> <p>My concern is that internal cross-references may "protect" the entire subgraph from garbage collection. In other words, is the garbage collector wise enough to figure out that all references in a subgraph do not leave the boundaries of the subgraph and therefore entire subgraph can be purged.</p>
[ { "answer_id": 271556, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 5, "selected": true, "text": "public void buidDog() {\n Dog newDog = new Dog();\n Tail newTail = new Tail();\n newDog.tail = newTail;\n newTail.dog = ...
2008/11/07
[ "https://Stackoverflow.com/questions/271530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31993/" ]
271,546
<p>I have an object instance which I access with the ME as it accesses the instantiated object. I have a method that gets a collection of these objects and I wish to assign the first one to the instantiated object. </p> <p>This is some of the code</p> <pre><code>Dim Books As New BookCollection(True) Books.ListByThemeFeatured(ThemeID, 1) ' Fills the collection If Books.Count &gt; 0 Then Me = Books(0) ' Should set the first item to the current object End If </code></pre> <p>Is this possible?</p> <p>EDIT: Me refers to the class that was instantiated. In this case it is a BookEntity Class. THis method would have been called using the following code</p> <pre><code> Dim Book As New BookEntity Book.FeaturedBook() ' Should fill the book entity with a featured book </code></pre>
[ { "answer_id": 271556, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 5, "selected": true, "text": "public void buidDog() {\n Dog newDog = new Dog();\n Tail newTail = new Tail();\n newDog.tail = newTail;\n newTail.dog = ...
2008/11/07
[ "https://Stackoverflow.com/questions/271546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23230/" ]
271,561
<p>In c#, is there any difference in the excecution speed for the order in which you state the condition?</p> <pre><code>if (null != variable) ... if (variable != null) ... </code></pre> <p>Since recently, I saw the first one quite often, and it caught my attention since I was used to the second one.</p> <p>If there is no difference, what is the advantage of the first one?</p>
[ { "answer_id": 271573, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 3, "selected": false, "text": "int i = 0;\nif (i = 1)\n{\n ...\n}\n" }, { "answer_id": 271575, "author": "Jon Skeet", "author_id"...
2008/11/07
[ "https://Stackoverflow.com/questions/271561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26070/" ]
271,588
<p>Is there a way to pass null arguments to C# methods (something like null arguments in c++)?</p> <p>For example:</p> <p>Is it possible to translate the following c++ function to C# method:</p> <pre><code>private void Example(int* arg1, int* arg2) { if(arg1 == null) { //do something } if(arg2 == null) { //do something else } } </code></pre>
[ { "answer_id": 271593, "author": "Marcin K", "author_id": 28722, "author_profile": "https://Stackoverflow.com/users/28722", "pm_score": 3, "selected": false, "text": "private void Example(int? arg1, int? arg2)\n{\n if(arg1 == null)\n {\n //do something\n }\n if(arg2 ==...
2008/11/07
[ "https://Stackoverflow.com/questions/271588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22996/" ]
271,595
<p>I need to get all the dates present in the date range using SQL Server 2005</p>
[ { "answer_id": 271607, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 3, "selected": false, "text": "select * from yourTable where yourDate between date1 and date2\n" }, { "answer_id": 271775, "author": "Concer...
2008/11/07
[ "https://Stackoverflow.com/questions/271595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,596
<p>I've got a Java application that I'm writing an installer for. We're using the AdvancedInstaller program to create our installer (well, we're evaluating it currently, but will definitely purchase a license soon), and although it has special support for Java applications, it is geared more towards repackaging them as desktop-type apps, and our software is a series of Java services and other utilities which doesn't make sense to distribute in EXE-wrappers. The target audience for this software is very specific, and we know that our software will probably be automatically distributed on freshly-imaged Windows 2003 Server machines. So requiring Java as a prerequisite basically makes more work for some poor sysadmin, and I'd rather avoid that if at all possible by repackaging the JRE's installer inside of our own.</p> <p>I discovered that if I tried to execute the JRE's installer as a pre-install step from my MSI, it complains that another installer is already running (mine, of course), so it bails out. When I try to add the JRE installer as a software prerequisite in the AdvancedInstaller project (as a bundled EXE, not a URL link), it never seems to actually get installed, despite me trying to force-install it.</p> <p>What's the best way to repackage the JRE? I'm not really a Java guy, so I don't know too much about how other developers deal with this same problem, short of requiring their users to hunt out and install the JRE on their own. The ideal solution here would be for us to find a EXE installer which can be executed from inside of another MSI installer, or if it's possible, to just package all of the files inside of the JRE and then create the appropriate registry and environment variables. How should I go about doing this?</p>
[ { "answer_id": 271622, "author": "bdumitriu", "author_id": 35415, "author_profile": "https://Stackoverflow.com/users/35415", "pm_score": 2, "selected": false, "text": "java ..." } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14302/" ]
271,598
<p>How do I save a Tlistviews layout in Delphi 2007?</p> <p>I have been asked to write some code to allow users to re-order columns in a TListview (well all TListviews in our application), I have the code working (by manipulating the columns index and setting width to zero to hide columns not needed) but now I need a way to save the state of the view when to form exits.</p> <p>What is the best way to do this? I thought about serialization, but I dont need the data or sort order so that seamed a bit overkill to me.</p> <p>Some things to ponder It needs to be on a per user basis It needs to be flexible, in-case we add a new column in the middle of the listview There is no garantee that the Column headding will be unique The listview name may not be unique across the application</p> <p>Any ideas?</p>
[ { "answer_id": 271619, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "[Settings]\n\n[Col_1]\nposition=1\nwidth=500\ntitle=hello world\nalign=left\nsort=ascending\n\n.. etc for more fields...
2008/11/07
[ "https://Stackoverflow.com/questions/271598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2098/" ]
271,609
<p>We have a couple of applications running on Java 5 and would like now to bring in an application based on Java 6. Can both java versions live together under Windows? </p> <p>Is there any control panel to set the appropriate Java version for different applications, or any other way to set up, what version of Java will be used to run that particular application?</p>
[ { "answer_id": 271623, "author": "reallyinsane", "author_id": 35407, "author_profile": "https://Stackoverflow.com/users/35407", "pm_score": 7, "selected": true, "text": "java ...\n" }, { "answer_id": 271630, "author": "Ruben", "author_id": 26919, "author_profile": "ht...
2008/11/07
[ "https://Stackoverflow.com/questions/271609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35061/" ]
271,612
<p>I have the following file/line:</p> <pre><code>pc=1 ct=1 av=112 cv=1100 cp=1700 rec=2 p=10001 g=0 a=0 sz=5 cr=200 pc=1 ct=1 av=113 cv=1110 cp=1800 rec=2 p=10001 g=0 a=10 sz=5 cr=200 </code></pre> <p>and so on. I wish to parse this and take the key value pairs and put them in a structure:</p> <pre><code>struct pky { pky() : a_id(0), sz_id(0), cr_id(0), cp_id(0), cv_id(0), ct_id(0), fr(0), g('U'), a(0), pc(0), p_id(0) { } }; </code></pre> <p>wherein either all the structure fields are used or some might be omitted.</p> <p>How do I create a C++ class, which will do the same? I am new to C++ and not aware of any functions or library which would do this work.</p> <p>Each line is to be processed, and the structure will be populated with one line each time and used, before it is flushed. The structure is later used as a parameter to a function.</p>
[ { "answer_id": 271654, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": true, "text": "std::string line;\nstd::map<std::string, std::string> props;\nstd::ifstream file(\"foo.txt\");\nwhile(std::g...
2008/11/07
[ "https://Stackoverflow.com/questions/271612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35416/" ]
271,613
<p>I was reading <em><a href="http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html" rel="nofollow noreferrer">Java Platform Performance</a></em> (sadly the link seems to have disappeared from the internet since I originally posed this question) and section A.3.3 worried me.</p> <p>I had been working on the assumption that a variable that dropped out of scope would no longer be considered a GC root, but this paper appears to contradict that.</p> <p>Do recent JVMs, in particular Sun's 1.6.0_07 version, still have this limitation? If so, then I have a lot of code to analyse...</p> <p>I ask the question because the paper is from 1999 - sometimes things change, particularly in the world of GC.</p> <hr/> <p>As the paper is no longer available, I'd like to paraphrase the concern. The paper implied that variables that were defined inside a method would be considered a GC root until the method exited, and not until the code block ended. Therefore setting the variable to null was necessary to permit the Object referenced to be garbage collected.</p> <p>This meant that a local variable defined in a conditional block in the main() method (or similar method that contained an infinite loop) would cause a one-off memory leak unless you nulled a variable just before it dropped out of scope.</p> <p>The code from the <a href="https://stackoverflow.com/a/271824/7938">chosen answer</a> illustrates the issue well. On the version of the JVM referenced in the document, the foo object can not be garbage collected when it drops out of scope at the end of the try block. Instead, the JVM will hold open the reference until the end of the main() method, even though it is impossible for anything to use that reference.</p> <p>This appears to be the origin of the idea that nulling a variable reference would help the garbage collector out, even if the variable was just about to drop out of scope.</p>
[ { "answer_id": 271824, "author": "Rasmus Faber", "author_id": 5542, "author_profile": "https://Stackoverflow.com/users/5542", "pm_score": 4, "selected": true, "text": "public class TestInvisibleObject{\n public static class PrintWhenFinalized{\n private String s;\n public PrintWhe...
2008/11/07
[ "https://Stackoverflow.com/questions/271613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7938/" ]
271,615
<p>I have two lists of custom objects and want to update a field for all objects in one list if there is an object in the other list which matches on another pair of fields.</p> <p>This code explains the problem better and produces the results I want. However for larger lists 20k, and a 20k list with matching objects, this takes a considerable time (31s). I can improve this with ~50% by using the generic lists Find(Predicate) method.</p> <pre><code>using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; namespace ExperimentFW3 { public class PropValue { public string Name; public decimal Val; public decimal Total; } public class Adjustment { public string PropName; public decimal AdjVal; } class Program { static List&lt;PropValue&gt; propList; static List&lt;Adjustment&gt; adjList; public static void Main() { propList = new List&lt;PropValue&gt;{ new PropValue{Name = "Alfa", Val=2.1M}, new PropValue{Name = "Beta", Val=1.0M}, new PropValue{Name = "Gamma", Val=8.0M} }; adjList = new List&lt;Adjustment&gt;{ new Adjustment{PropName = "Alfa", AdjVal=-0.1M}, new Adjustment{PropName = "Beta", AdjVal=3M} }; foreach (var p in propList) { Adjustment a = adjList.SingleOrDefault( av =&gt; av.PropName.Equals(p.Name) ); if (a != null) p.Total = p.Val + a.AdjVal; else p.Total = p.Val; } } } } </code></pre> <p>The desired result is: Alfa total=2,Beta total=4,Gamma total=8</p> <p>But I wonder if this is possible to do even faster. Inner joining the two lists takes very little time, even when looping over 20k items in the resultset.</p> <pre><code>var joined = from p in propList join a in adjList on p.Name equals a.PropName select new { p.Name, p.Val, p.Total, a.AdjVal }; </code></pre> <p>So my question is if it's possible to do something like I would do with T-SQL? An UPDATE from a left join using ISNULL(val,0) on the adjustment value.</p>
[ { "answer_id": 271645, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "adjList" }, { "answer_id": 272155, "author": "Amy B", "author_id": 8155, "author_profile": "https://S...
2008/11/07
[ "https://Stackoverflow.com/questions/271615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2006748/" ]
271,657
<p>I have many emails coming in from different sources. they all have attachments, many of them have attachment names in chinese, so these names are converted to base64 by their email clients.</p> <p>When I receive these emails, I wish to decode the name. but there are other names which are not base64. How can I differentiate whether a string is base64 or not, using the <strong>jython</strong> programming language?</p> <p>Ie. </p> <p>First attachment: </p> <pre><code>------=_NextPart_000_0091_01C940CC.EF5AC860 Content-Type: application/vnd.ms-excel; name="Copy of Book1.xls" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Copy of Book1.xls" </code></pre> <p>second attachment:</p> <pre><code>------=_NextPart_000_0091_01C940CC.EF5AC860 Content-Type: application/vnd.ms-excel; name="=?gb2312?B?uLGxvmhlbrixsb5nLnhscw==?=" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="=?gb2312?B?uLGxvmhlbrixsb5nLnhscw==?=" </code></pre> <p>Please note both "<strong>Content-Transfer-Encoding</strong>" have base64</p>
[ { "answer_id": 271832, "author": "bobince", "author_id": 18936, "author_profile": "https://Stackoverflow.com/users/18936", "pm_score": 5, "selected": true, "text": "Content-Transfer-Encoding" }, { "answer_id": 1687765, "author": "Ringding", "author_id": 135811, "autho...
2008/11/07
[ "https://Stackoverflow.com/questions/271657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21537/" ]
271,661
<p>I have a problem with Lucene.NET. During an index, I receive the error 'Access to the path segments is denied'. Or sometimes 'Access to the path deletable is denied'. I eventually gave 'Everyone' full security rights to the index directory, but the problem still existed.</p> <p>I then found out that during the index run, lucene renames the segments file to 'segments.new', and <em>then</em> this error happens. I guess some process still tries to read from the old segments file after it has been renamed? I have no clue as to why this happens, or how to fix this. Strangely enough, my co-developers can run the index on their computer without a problem.</p> <p>The error happens at happens in Lucene.Net.Index.IndexModifier.AddDocument(Document).</p> <p>Any ideas would be much appreciated.</p>
[ { "answer_id": 1325676, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": " doc.Add(new Field(\"URL\", \"C:/Users/blabla/(convert-csharp)/IMssg\", Field.Store.YES, Field.Index.TOKENIZED));\n\n writer....
2008/11/07
[ "https://Stackoverflow.com/questions/271661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,665
<p>I have a client sending me requests without HTTP chunking (they use content-length). When my server responds, chunking is enabled, and the client can't handle this - even though they should be able to as they are using HTTP 1.1..... </p> <p>I have tried to disable chunking by removing the entry below from the axis2 config file (axis2.xml) but the response is still going back chunked.</p> <p>chunked</p> <p>So the question is, is there somewhere else that the chunking is being enabled that is over-riding the axis2 setting? In tomcat setting perhaps?</p> <p>Webserver details - tomcat 6.0.16, axis2 2.1.3</p> <p>Thanks Mike</p>
[ { "answer_id": 1394439, "author": "Chochos", "author_id": 10165, "author_profile": "https://Stackoverflow.com/users/10165", "pm_score": 2, "selected": false, "text": "myStub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,668
<p>Is there a way of converting special folder paths to a full file name (and back) or do I need to code my own (not hard I know, but no point if it exists)</p> <p>e.g. I want to store the file name of a template for an application, which the user can then change, it exists in the LocalApplicationData folder.</p> <p>what I would like to store is the location of the file in the format:</p> <p>%LOCALAPPDATA%\MyApp\Templates\Report Template.xls</p> <p>so that this application file can be used by many users, each user when they open it will get the Report Template from their own local app directory.</p> <p>I can write</p> <pre><code>replace("%LOCALAPPDATA%", _ System.Environment.GetFolderPath( System.Environment.SpecialFolder.LocalApplicationData)) and vice versa </code></pre> <p>when I come to save the file location, however is there a System.IO (or similar) call to do this for me, rather than having to go through every possible special folder?</p>
[ { "answer_id": 271683, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 3, "selected": true, "text": "static void Main(string[] args)\n{\n var values = Enum.GetValues(typeof(Environment.SpecialFolder));\n\n foreach (Envir...
2008/11/07
[ "https://Stackoverflow.com/questions/271668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6684/" ]
271,672
<p>I tried this on J2ME</p> <pre><code>try { Image immutableThumb = Image.createImage( temp, 0, temp.length); } catch (Exception ex) { System.out.println(ex); } </code></pre> <p>I hit this error: <code>java.lang.IllegalArgumentException:</code></p> <p>How do I solve this?</p>
[ { "answer_id": 2461625, "author": "Cipi", "author_id": 191164, "author_profile": "https://Stackoverflow.com/users/191164", "pm_score": 0, "selected": false, "text": "FFD8" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,675
<p>I have a binded DataGridView where depending on some BoundItem property value that line will be read only. What is the best way to implement this? Thanks</p>
[ { "answer_id": 271679, "author": "CestLaGalere", "author_id": 6684, "author_profile": "https://Stackoverflow.com/users/6684", "pm_score": 0, "selected": false, "text": "private sub MyView_RowEnter(...) handles MyView.RowEnter\n MyView.Rows(e.Rowindex).ReadOnly = (condition)\nend sub\n...
2008/11/07
[ "https://Stackoverflow.com/questions/271675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,688
<p><a href="http://dl.getdropbox.com/u/240752/stars.gif" rel="nofollow noreferrer">My screenshot http://dl.getdropbox.com/u/240752/stars.gif</a></p> <p>I want to have it so that only the text is underlined. The only way I can see of doing this is this:</p> <pre><code>.no-underline { text-decoration:none; } .underline { text-decoration:underline; } &lt;a href="#" class="no-underline"&gt;&lt;span class="underline"&gt;Average customer review rating&lt;/span&gt;&lt;img src="img/five-stars.gif" alt="five stars" width="78" height="16" title="5 star review rating" /&gt;&lt;/a&gt; </code></pre> <p>Is this the best way? or does someone know a leaner way? Thanks.</p>
[ { "answer_id": 271697, "author": "Lasar", "author_id": 9438, "author_profile": "https://Stackoverflow.com/users/9438", "pm_score": 4, "selected": true, "text": "<a href=\"#\" class=\"imgLink\"><span>Link Text</span> <img src=\"...\"></a>\n\na.imgLink { text-decoration: none; }\na.imgLink...
2008/11/07
[ "https://Stackoverflow.com/questions/271688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
271,699
<p>Is there any way to (unit) test my own HtmlHelpers? In case when I'd like to have custom control (rendered by HtmlHelper) and I know requierements for that control how could I write tests first - and then write code? Is there a specific (nice) way to do that? </p> <p>Is it worth?</p>
[ { "answer_id": 747186, "author": "Marc Climent", "author_id": 58791, "author_profile": "https://Stackoverflow.com/users/58791", "pm_score": 6, "selected": true, "text": " public static HtmlHelper CreateHtmlHelper(ViewDataDictionary viewData)\n {\n var mocks = new MockReposit...
2008/11/07
[ "https://Stackoverflow.com/questions/271699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3182/" ]
271,700
<p>As far as i know the EAP editions of JBoss Application Server (AS) are just a bunch of community edition JBoss projects with some sugar.</p> <p>So, what is the <strong>community edition</strong> of the JBoss Application Server that <strong>JBoss EAP 4.3.0</strong> corresponds to?</p>
[ { "answer_id": 17274131, "author": "Ondra Žižka", "author_id": 145989, "author_profile": "https://Stackoverflow.com/users/145989", "pm_score": 1, "selected": false, "text": "settings.xml" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23428/" ]
271,706
<p>I basically have a page which shows a "processing" screen which has been flushed to the browser. Later on I need to redirect this page, currently we use meta refresh and this normally works fine. </p> <p>With a new payment system, which includes 3D secure, we potentially end up within an iframe being directed back to our site from a third party.</p> <p>I need to be able to redirect from this page, either using javascript or meta-refresh, and bust out of the iframe if it exists.</p> <p>Cheers!</p> <p>(I have done busting out of iframes before but can't find my old code and a google search was useless, thought it was the perfect time to try Stackoverflow out!)</p>
[ { "answer_id": 271902, "author": "Ben Lynch", "author_id": 15363, "author_profile": "https://Stackoverflow.com/users/15363", "pm_score": 3, "selected": true, "text": "<script type=\"text/javascript\" language=\"javascript\">\n if (top.frames.length>0)\n setTimeout(\"top.location = ...
2008/11/07
[ "https://Stackoverflow.com/questions/271706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15363/" ]
271,710
<p>The code looks like below:</p> <pre><code>namespace Test { public interface IMyClass { List&lt;IMyClass&gt; GetList(); } public class MyClass : IMyClass { public List&lt;IMyClass&gt; GetList() { return new List&lt;IMyClass&gt;(); } } } </code></pre> <p>When I Run Code Analysis i get the following recommendation.</p> <blockquote> <p>Warning 3 CA1002 : Microsoft.Design : Change 'List' in 'IMyClass.GetList()' to use Collection, ReadOnlyCollection or KeyedCollection</p> </blockquote> <p>How should I fix this and what is good practice here?</p>
[ { "answer_id": 271711, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": false, "text": "IList<T>" }, { "answer_id": 271719, "author": "Tamas Czinege", "author_id": 8954, "author_profile": ...
2008/11/07
[ "https://Stackoverflow.com/questions/271710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11135/" ]
271,718
<p>In a detailsview, how can I prepopulate one of the textboxes on the insertcommand (When the user clicks insert and the view is insert).</p> <p>I think this would work for codebehind:</p> <p>Dim txtBox As TextBox = FormView1.FindControl("txtbox")</p> <p>txtbox.Text = "Whatever I want"</p> <p>Is this right? What do I need in the aspx (not as sure)? Also, I'm assuming the server-side code will go in the itemcommand or insertcreating event.</p> <p>I have typed this in VB.NET but I am using C# (I can do both so on a language agnostic forum I might type the problem in another language). I am also using a SqlDataSource, with my parameters and insert/delete/edit commands all created.</p> <p>I am trying to generate a random GUID (using the GUID object), which will be prepopulated in the textbox.</p> <p>Also, is the postbackurl property of a button not another way of preserving form state?</p> <p>Thanks</p>
[ { "answer_id": 684039, "author": "Anthony K", "author_id": 1682, "author_profile": "https://Stackoverflow.com/users/1682", "pm_score": 0, "selected": false, "text": "dvDetails.ChangeMode(DetailsViewMode.Insert)\npnlDetailMenu.Visible = True\nDim ColumnTextBox As TextBox\nColumnTextBox = ...
2008/11/07
[ "https://Stackoverflow.com/questions/271718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
271,724
<p>I am playing around with ASP.NET MVC for the first time, so I apologize in advance if this sounds academic. </p> <p>I have created a simple content management system using ASP.NET MVC. The url to retrieve a list of content, in this case, announcements, looks like:</p> <pre><code>http://www.mydomain.com/announcements/list/10 </code></pre> <p>This will return the top ten most recent announcements.</p> <p>My questions are as follows:</p> <ol> <li><p>Is it possible for any website to consume this service? Or would I also have to expose it using something like WCF?</p></li> <li><p>What are some examples, of how to consume this service to display this data on another website? I'm primarily programming in the .NET world, but I'm thinking if I could consume the service using javascript, or do something with Json, it could really work for any technology.</p></li> </ol> <p>I am looking to dynamically generate something like the following output:</p> <pre><code>&lt;div class="announcement"&gt; &lt;h1&gt;Title&lt;/h1&gt; &lt;h2&gt;Posted Date&lt;/h3&gt; &lt;p&gt;Teaser&lt;/p&gt; &lt;a href="www.someotherdomain.com"&gt;More&lt;/a&gt; &lt;/div&gt; </code></pre> <hr> <p>For now ... is it possible to return an Html representation and display it in a webpage? Is this possible using just Javascript?</p>
[ { "answer_id": 684039, "author": "Anthony K", "author_id": 1682, "author_profile": "https://Stackoverflow.com/users/1682", "pm_score": 0, "selected": false, "text": "dvDetails.ChangeMode(DetailsViewMode.Insert)\npnlDetailMenu.Visible = True\nDim ColumnTextBox As TextBox\nColumnTextBox = ...
2008/11/07
[ "https://Stackoverflow.com/questions/271724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
271,725
<p>I'm working on a search module that searches in text columns that contains html code. The queries are constructed like: WHERE htmlcolumn LIKE '% searchterm %';</p> <p>Default the modules searches with spaces at both end of the searchterms, with wildcards at the beginning and/or the end of the searchterms these spaces are removed (*searchterm -> LIKE '%searchterm %'; Also i've added the possibility to exclude results with certain words (-searchterm -> NOT LIKE '% searchterm %'). So far so good.</p> <p>The problem is that words that that are preceded by an html-tag are not found (<code>&lt;br/&gt;</code>searchterm is not found when searching on LIKE '% searchterm.., also words that come after a comma or end with a period etc.). What i would like to do is search for words that are not preceded or followed by the characters A-Z and a-z. Every other characters are ok.</p> <p>Any ideas how i should achieve this? Thanks!</p>
[ { "answer_id": 272043, "author": "Incidently", "author_id": 34187, "author_profile": "https://Stackoverflow.com/users/34187", "pm_score": 1, "selected": false, "text": "SELECT * FROM `t` WHERE `htmlcolumn` REGEXP '[[:<:]]term[[:>:]]'\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21238/" ]
271,730
<p>I run a website where users can post items (e.g. pictures). The items are stored in a MySQL database. </p> <p>I want to query for the last ten posted items BUT with the constraint of a maximum of 3 items can come from any single user. </p> <p>What is the best way of doing it? My preferred solution is a constraint that is put on the SQL query requesting the last ten items. But ideas on how to set up the database design is very welcome.</p> <p>Thanks in advance!</p> <p>BR</p>
[ { "answer_id": 271768, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": false, "text": "SELECT\n i.UserId,\n i.ImageId\nFROM\n UserSuppliedImages i\nWHERE\n /* second valid ImageId */\n ImageId = (\n SE...
2008/11/07
[ "https://Stackoverflow.com/questions/271730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/103373/" ]
271,736
<p>Given a html document, what is the most correct and concise regular expression pattern to remove the query strings from each url in the document?</p>
[ { "answer_id": 271778, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 0, "selected": false, "text": "/href=\"([^\\?\"]*?)\\?[^\\\"]*\"/\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6691/" ]
271,741
<p>I'm trying to parse a html page and extract 2 values from a table row. The html for the table row is as follows: -</p> <pre><code>&lt;tr&gt; &lt;td title="Associated temperature in (ºC)" class="TABLEDATACELL" nowrap="nowrap" align="Left" colspan="1" rowspan="1"&gt;Max Temperature (ºC)&lt;/td&gt; &lt;td class="TABLEDATACELLNOTT" nowrap="nowrap" align="Center" colspan="1" rowspan="1"&gt;6&lt;/td&gt; &lt;td class="TABLEDATACELLNOTT" nowrap="nowrap" align="Center" colspan="1" rowspan="1"&gt; 13:41:30&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>and the expression I have at the moment is:</p> <pre><code>&lt;tr&gt;[\s]&lt;td[^&lt;]+?&gt;Max Temperature[\w\s]*&lt;/td&gt;[\s] &lt;td[^&lt;]+?&gt;(?&lt;value&gt;([\d]+))&lt;/td&gt;[\s] &lt;td[^&lt;]+?&gt;(?&lt;time&gt;([\d\:]+))&lt;/td&gt;[\s]&lt;/tr&gt; </code></pre> <p>However I don't seem to be able to extract any matches. Could anyone point me in the right direction, thanks.</p>
[ { "answer_id": 271748, "author": "siukurnin", "author_id": 35273, "author_profile": "https://Stackoverflow.com/users/35273", "pm_score": 0, "selected": false, "text": "<td[^<]+?>" }, { "answer_id": 271750, "author": "The Archetypal Paul", "author_id": 21755, "author_p...
2008/11/07
[ "https://Stackoverflow.com/questions/271741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,742
<p>What are the advantages of rendering a control like this:</p> <pre><code>&lt;% Html.RenderPartial("MyControl") %&gt; or &lt;%=Html.TextBox("txtName", Model.Name) %&gt; </code></pre> <p>over the web Forms style:</p> <pre><code>&lt;uc1:MyControl ID=MyControl runat=server /&gt; </code></pre> <p>I understand that performance can be one reason because no object needs to be created but having the possibility of calling it from the codebehing just to do some basic rendering logic can be very useful. </p> <p>If this is discouraged then how you are suposed to deal with this scenarios:</p> <ul> <li><p>You need to make the control visible conditionally and you dont want to fill your HTML with rendering logic.</p></li> <li><p>You have <code>&lt;input type="text" value="&lt;%= Model.Name %&gt;" /&gt;</code> but you need to check if Model is null because otherways a NullPointerException will raise.</p></li> </ul> <p><strong>[EDIT]</strong> I asked this when I was beginning with ASP MVC, now I see the advantages of the MVC way like in Cristian answer.</p>
[ { "answer_id": 272531, "author": "Santiago Corredoira", "author_id": 4264, "author_profile": "https://Stackoverflow.com/users/4264", "pm_score": 0, "selected": false, "text": "<custom:HtmlTextBox ID=\"txtName\" runat=\"server\" />\n" }, { "answer_id": 272737, "author": "Crist...
2008/11/07
[ "https://Stackoverflow.com/questions/271742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4264/" ]
271,743
<p>What's the difference between <code>&lt;b&gt;</code> and <code>&lt;strong&gt;</code>, <code>&lt;i&gt;</code> and <code>&lt;em&gt;</code> in HTML/XHTML? When should you use each?</p>
[ { "answer_id": 271755, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 8, "selected": false, "text": "<b>" }, { "answer_id": 271756, "author": "James", "author_id": 7837, "author_profile": "https://S...
2008/11/07
[ "https://Stackoverflow.com/questions/271743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21709/" ]
271,747
<p>I'd like to send mail without bothering with the SMTP-Server which is used for delivery.</p> <p>So <a href="http://java.sun.com/products/javamail/" rel="noreferrer">JavaMail API</a> doesn't work for me because I have to specify a SMTP server to connect to.</p> <p>I'd like the library to find out on its own which SMTP server is responsible for which email address by querying the MX record of the mail address domain.</p> <p>I'm looking for something like <a href="https://aspirin.dev.java.net/" rel="noreferrer">Aspirin</a>. Unfortunately I can't use Aspirin itself because the development stopped 2004 and the library fails to communicate with modern spam hardened servers correctly.</p> <p>An embeddable version of <a href="http://james.apache.org/" rel="noreferrer">James</a> would do the task. But I haven't found documentation concerning whether this is possible.</p> <p>Or does anyone know about other libraries I could use?</p>
[ { "answer_id": 271829, "author": "Eduard Wirch", "author_id": 17428, "author_profile": "https://Stackoverflow.com/users/17428", "pm_score": 4, "selected": false, "text": "<dependency>\n <groupId>dnsjava</groupId>\n <artifactId>dnsjava</artifactId>\n <version>2.0.1</version>\n</d...
2008/11/07
[ "https://Stackoverflow.com/questions/271747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17428/" ]
271,762
<p>Can someone supply me with a regex to match a search term that is not preceded or followed by <code>[a-z]</code> and <code>[A-Z]</code>? (Other characters are OK.) I.e., when searching for <code>key</code>, I don't want <code>keyboard</code> in my search results, but <code>key.</code> is okay.</p>
[ { "answer_id": 271769, "author": "siukurnin", "author_id": 35273, "author_profile": "https://Stackoverflow.com/users/35273", "pm_score": 1, "selected": false, "text": "\\b" }, { "answer_id": 271770, "author": "Greg", "author_id": 24181, "author_profile": "https://Stac...
2008/11/07
[ "https://Stackoverflow.com/questions/271762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21238/" ]
271,767
<p>I have in my Form constructor, after the InitializeComponent the following code:</p> <pre><code>using (WebClient client = new WebClient()) { client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadDataAsync("http://example.com/version.txt"); } </code></pre> <p>When I start my form, the UI doesn't appears till client_DownloadDataCompleted is raised. The client_DownloadDataCompleted method is empty, so there's no problem there.</p> <p>What I'm doing wrong? How is supposed to do this without freezing the UI?</p> <p>Thanks for your time.<br> Best regards.</p> <p><strong>FULL CODE:</strong> </p> <p><strong>Program.cs</strong></p> <pre><code>using System; using System.Windows.Forms; namespace Lala { static class Program { /// &lt;summary&gt; /// The main entry point for the application. /// &lt;/summary&gt; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } </code></pre> <p><strong>Form1.cs</strong></p> <pre><code>using System; using System.Net; using System.Windows.Forms; namespace Lala { public partial class Form1 : Form { WebClient client = new WebClient(); public Form1() { client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadDataAsync(new Uri("http://www.google.com")); InitializeComponent(); } void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { textBox1.Text += "A"; } } partial class Form1 { /// &lt;summary&gt; /// Required designer variable. /// &lt;/summary&gt; private System.ComponentModel.IContainer components = null; /// &lt;summary&gt; /// Clean up any resources being used. /// &lt;/summary&gt; /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt; protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// &lt;summary&gt; /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// &lt;/summary&gt; private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(12, 12); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(12, 41); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(468, 213); this.textBox1.TabIndex = 1; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(492, 266); this.Controls.Add(this.textBox1); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox textBox1; } } </code></pre>
[ { "answer_id": 271790, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 0, "selected": false, "text": " int a, b;\n ThreadPool.GetMaxThreads(out a, out b);\n" }, { "answer_id": 5544274, "author": "Roma...
2008/11/07
[ "https://Stackoverflow.com/questions/271767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4386/" ]
271,815
<p>Is there a better way to write this code? </p> <p>I want to show a default value ('No data') for any empty fields returned by the query:</p> <pre><code>$archivalie_id = $_GET['archivalie_id']; $query = "SELECT a.*, ip.description AS internal_project, o.description AS origin, to_char(ad.origin_date,'YYYY') AS origin_date FROM archivalie AS a LEFT JOIN archivalie_dating AS ad ON a.id = ad.archivalie_id LEFT JOIN internal_project AS ip ON a.internal_project_id = ip.id LEFT JOIN origin AS o ON a.origin_id = o.id WHERE a.id = $archivalie_id"; $result = pg_query($db, $query); while ($row = pg_fetch_object($result)) { $no_data = '&lt;span class="no-data"&gt;No data&lt;/span&gt;'; $internal_project = ($row-&gt;internal_project != '') ? $row-&gt;internal_project : $no_data; $incoming_date = ($row-&gt;incoming_date != '') ? $row-&gt;incoming_date : $no_data; $origin = ($row-&gt;origin != '') ? $row-&gt;origin : $no_data; } </code></pre>
[ { "answer_id": 271826, "author": "Stefan Gehrig", "author_id": 11354, "author_profile": "https://Stackoverflow.com/users/11354", "pm_score": 3, "selected": true, "text": "function dbValue($value, $default=null)\n{\n if ($default===null) {\n $default='<span class=\"no-data\">No ...
2008/11/07
[ "https://Stackoverflow.com/questions/271815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
271,821
<p>I have a site that usually has news items at the top of the homepage, and sometimes (for specific periods) will have one or more 'quicklinks' beneath the news items, to guide users to pages of topical interest. Beneath those is the usual blurb.</p> <p>We have alternative language versions of these sites, which often don't contain either the news items or the quicklinks, but may do from time to time.</p> <p>Previously, when the appearance was less dynamic, each section was absolutely positioned, with a top attribute configured appropriately. But as more subtle variations were required, I find myself chopping and changing both the base HTML and the stylesheet rules. </p> <p>My question is what do people think about the different approaches to this problem, and do they have any suggestions that I haven't considered. Achieving the desired result is easy, but I'm thinking of good coding practice that makes the site easier to read &amp; debug.</p> <p>I could have separate style classes for each variation of each item:</p> <pre><code>.news {top: 100px; etc...;} .news2 {top: 150px; etc...;} .ql {top: 150px; etc...;} .ql2 {top: 200px; etc...;} .main {top: 200px; etc...;} .main2 {top: 250px; etc...;} </code></pre> <p>...which seems a little too verbose.</p> <p>Or, perhaps:</p> <pre><code>.news {etc...;} .ql {etc...;} .main {etc...;} .top100 {top: 100px;} .top150 {top: 150px;} .top200 {top: 200px;} .top250 {top: 250px;} </code></pre> <p>Somewhat more compact, and it keeps the styling in the stylesheet and away from the HTML.</p> <p>Or, perhaps even:</p> <pre><code>.news {etc...;} .ql {etc...;} .main {etc...;} </code></pre> <p>in HTML:</p> <pre><code>&lt;div class="news" style="top:100px;"&gt; &lt;div class="ql" style="top:150px;"&gt; &lt;div class="main" style="top:200px;"&gt; </code></pre> <p>This is the most 'direct' solution, but clearly some of the styling is in the HTML which from a purists point of view is a 'no-no'; There are practical reasons for this view, but in this case, this is probably the easiest way to handle the varied and arbitrary changes that will be requested.</p> <p>Note: The site was (poorly) designed by a 3rd party, although I have tried to rescue it without entirely re-writing it. However, the site will be re-developed, possibly as early as Q3 or Q4 2009. At that stage, I'd hope to be moving away from a absolutely positioned approach, to one that is more fluid - so this question is about what to do in the interim, and also as a general question of style.</p>
[ { "answer_id": 271827, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 3, "selected": true, "text": ".top100 {top: 100px;}\n.top150 {top: 150px;}\n.top200 {top: 200px;}\n.top250 {top: 250px;}\n" }, { "answer_id"...
2008/11/07
[ "https://Stackoverflow.com/questions/271821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6898/" ]
271,843
<p>Does that mean that I can't share a Form between delphi 2007 and 2009?</p>
[ { "answer_id": 275156, "author": "Ondrej Kelle", "author_id": 11480, "author_profile": "https://Stackoverflow.com/users/11480", "pm_score": 4, "selected": false, "text": "unit Delphi2009Form;\n\ninterface\n\nuses\n Windows, Classes, SysUtils, Controls, Forms;\n\ntype\n{$IFDEF VER200}\n ...
2008/11/07
[ "https://Stackoverflow.com/questions/271843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727/" ]
271,850
<p>After upgrading a project from Delphi 2007 to Delphi 2009 I'm getting an Unknown memory leak, so far I've been tryin to track it down using fastMM, here is what fastMM stack trace reports:</p> <pre><code>A memory block has been leaked. The size is: 20 This block was allocated by thread 0x111C, and the stack trace (return addresses) at the time was: 40339E [System.pas][System][@GetMem][3412] 534873 [crtl][_malloc] 56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918] 56D316 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3961] 56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085] 562D48 [DBCommon.pas][DBCommon][TFilterExpr.PutExprNode][1583] 408E46 [System.pas][System][DynArraySetLength][20464] 56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085] 408E92 [System.pas][System][@DynArraySetLength][20486] 528C1B [Forms.pas][Forms][TCustomForm.DoCreate][3260] 171A1A [GetRawStackTrace] The block is currently used for an object of class: Unknown The allocation number is: 302844 </code></pre> <p>And sometimes I get this:</p> <pre><code>A memory block has been leaked. The size is: 20 This block was allocated by thread 0x111C, and the stack trace (return addresses) at the time was: 40339E [System.pas][System][@GetMem][3412] 534873 [crtl][_malloc] 56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918] 56D316 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3961] 77DC921A [RtlAnsiStringToUnicodeString] 56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085] 7726B8F5 [GetProcAddress] 7726B907 [GetProcAddress] 589B1E [ossrv.cpp][MidasLib][DllGetDataSnapClassObject][3163] 56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085] 408E92 [System.pas][System][@DynArraySetLength][20486] The block is currently used for an object of class: Unknown </code></pre> <p>Is there some better way to figure out what really is causing the Memory leak?</p>
[ { "answer_id": 272370, "author": "zendar", "author_id": 25732, "author_profile": "https://Stackoverflow.com/users/25732", "pm_score": 1, "selected": false, "text": "@DynArraySetLength" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727/" ]
271,870
<p>I have a form whose controls I want to enable/disable depending on the values in a ComboBox control. This ComboBox control is linked, like all the other controls in the form, to a table. Inside the ComboBox's Change event, I placed the code that enables/disables the other controls.</p> <p>The problem I have is that when I open the form, the controls are not enabled/disabled. I have to re-choose the ComboBox value to make all other controls enable or disable.</p> <p>One thing I noticed is that the RecordSet control inside the ComboBox often does not change to the value shown in the value property of the ComboBox.</p> <p>I tried using <br> <code>combobox.recordset.filter = "Key = " &amp; combobox.value</code><br> but I get the error <br> <code>Operation is not supported for this type of object.</code></p> <hr> <h2>Update</h2> <p>I think my problem has to do more in how I'm accessing the values in the combobox.recordset. I was under the impression that combobox.recordset held the value received from the table. But, it seems to hold the first record from the recordsource.</p> <p>I'm guessing that I will need to search those values I need by using another recordset object.</p>
[ { "answer_id": 274294, "author": "David-W-Fenton", "author_id": 9787, "author_profile": "https://Stackoverflow.com/users/9787", "pm_score": 1, "selected": false, "text": " Private Sub cmbComboBox1_AfterUpdate()\n Dim strRowsource As String\n\n strRowsource = \"SELECT * FROM MyTab...
2008/11/07
[ "https://Stackoverflow.com/questions/271870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15884/" ]
271,881
<p>I am using a JEditorPane as an editor to write comments in my application. The content type is set "text/plain". When I am writing text in it and the text fills the available space and I go on typing, the text is not moving upward to show the cursor. So I dont know where I am typing and what I am typing since it would be visible.</p> <p>Could you tell me how to always show the caret by moving the above text upwards?</p> <p>Instead, it could be better if I can auto-resize the editor as I am typing. The JEditorPane is inside a JPanel, so I have to resize that too. any Ideas?</p>
[ { "answer_id": 5837644, "author": "Raze", "author_id": 142716, "author_profile": "https://Stackoverflow.com/users/142716", "pm_score": 1, "selected": false, "text": "scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);\nscrollPane.setVerticalScrollBarP...
2008/11/07
[ "https://Stackoverflow.com/questions/271881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22550/" ]
271,888
<p>In my database application I sometimes have to deal with <code>null</code> strings in the database. In most cases this is fine, but when it comes do displaying data in a form the Swing components - using <code>JTextField</code> for example - cannot handle null strings. (<code>.setText(null)</code> fails)</p> <p>(<strong>EDIT:</strong> I just noticed that <code>JTextField</code> actually accepts a <code>null</code> string, but the question remains for all other cases where unexpected <code>null</code> values can lead to problems.)</p> <p>The null values have no special meaning, they can (must) be treated as empty strings. </p> <p>What is the best practice to deal with this problem? <em>Unfortunatly I cannot change the database</em>.</p> <ul> <li>Checking every value if it is <code>null</code> before calling <code>setText()</code>?</li> <li>Adding a try-catch handler to every <code>setText()</code> call?</li> <li>Introducing a static method which filters all <code>null</code> strings?</li> <li>Replace all <code>null</code> values to empty strings immediatly after reading from the database?</li> <li>... [your suggestions]</li> </ul>
[ { "answer_id": 271921, "author": "Ron Tuffin", "author_id": 939, "author_profile": "https://Stackoverflow.com/users/939", "pm_score": 2, "selected": false, "text": "select ISNULL(column_name,'') from ...\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23368/" ]
271,892
<p>I have a &lt;select&gt;. Using JavaScript, I need to get a specific &lt;option&gt; from the list of options, and all I know is the value of the option. The option may or may not be selected.</p> <p>Here's the catch: there are thousands of options and I need to do this a few hundred times in a loop. Right now I loop through the "options" array and look for the option I want. This is too slow (in the sense that on my very fast machine the browser locked up until I killed it after a few minutes).</p> <p>Is there any faster way to do this? I'll take browser-specific ways, but of course a DOM-standard way would be nice.</p>
[ { "answer_id": 271903, "author": "Davide Gualano", "author_id": 28582, "author_profile": "https://Stackoverflow.com/users/28582", "pm_score": -1, "selected": false, "text": "$(\"#idselect option[value='yourval']\")\n" }, { "answer_id": 271906, "author": "Lasar", "author_i...
2008/11/07
[ "https://Stackoverflow.com/questions/271892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4641/" ]
271,904
<p>Say you have a class declaration, e.g.:</p> <pre><code> class MyClass { int myInt=7; int myOtherInt; } </code></pre> <p>Now, is there a way in generic code, using reflection (or any other means, for that matter), that I can deduce that myInt has a default value assigned, whereas myOtherInt does not? Note the difference between being initialised with an explicit default value, and being left to it's implicit default value (myOtherInt will be initialised to 0, by default).</p> <p>From my own research it looks like there is no way to do this - but I thought I'd ask here before giving up.</p> <p>[Edit]</p> <p>Even with nullable and reference types I want to distingush between those that have been left as null, and those that have been explicitly initialised to null. This is so that I can say that fields with an initialiser are "optional" and other fields are "mandatory". At the moment I'm having to do this using attributes - which niggles me with their redundancy of information in this case.</p>
[ { "answer_id": 271919, "author": "John Lemp", "author_id": 12915, "author_profile": "https://Stackoverflow.com/users/12915", "pm_score": 2, "selected": false, "text": "class MyClass\n{\n int? myInt = 7;\n int? myOtherInt = null;\n}\n" }, { "answer_id": 271925, "author": "Sa...
2008/11/07
[ "https://Stackoverflow.com/questions/271904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32136/" ]
271,907
<p>Is there a way to find out when in a LAN anyone plugs in a pendrive to the USB port? Programatically (in C# preferably) or through some tool. Basically I'd imagine a client application sits on each terminal and monitors the USB ports and sends the information to the server. </p> <p>a.) Can I get the details of the file(s) being copied? b.) Is there a way to do this without a client application? </p> <p>EDIT</p> <p>I dont want to disable the USB port entirely. its to be on a need to have basis. Basically just want the users on the LAN to share data responsibly and know that whatever data is tranfered is monitored and logged and can be questioned later.</p>
[ { "answer_id": 272005, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 5, "selected": true, "text": "DEV_BROADCAST_DEVICEINTERFACE" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20358/" ]
271,938
<p>Background: I have a kubuntu laptop right now that I can't use wirelessly, i.e. I haven't got wireless assistant installed. But I have a windows laptop that I can download the debian packages seperately on a USB memory stick.</p> <p>How do I install a debian package on the computer locally?</p>
[ { "answer_id": 271952, "author": "Powerlord", "author_id": 15880, "author_profile": "https://Stackoverflow.com/users/15880", "pm_score": 3, "selected": true, "text": "dpkg --install /path/to/foo_VVV-RRR.deb\n" }, { "answer_id": 271989, "author": "Sam Stokes", "author_id":...
2008/11/07
[ "https://Stackoverflow.com/questions/271938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]
271,944
<p>I have a scenario where users of my ASP.NET web application submit testimonials consisting of text info and images. The submit process has the following steps:</p> <ul> <li>First the user inputs the content and chooses a path to an image</li> <li>When he clicks preview, the info is once again shown so that he can confirm</li> <li>Once confirmed the info is persisted in the database</li> </ul> <p>The problem with this is that I don't want to store uploaded images in the DB before the user actually confirms. Instead I store them as temporary files and put them in DB only after final confirmation.</p> <p>Since I also want my application to run in medium trust, I have write permissions only to the application directory and nowhere outside. I even want to limit write permissions for the ASPNET / NETWORK SERVICE user to the ~/App_Data folder. The problem with my scenario is that once a temporary file is created in this folder, the application pool is recycled and I don't want that on every testimonial submit.</p> <p>How do you advise I keep these temp files instead? The pool is not restarted if I update a file - only on create or rename. But I don't think I can store whole images in a single file for all users. What do you think?</p> <p><b>UPDATE</b>: I should note that I'm using a third party control for upload. It gives me programmatic access to the binary stream of the file contents after upload, but I cannot keep this after a second postback (the first step and postback actually does the upload).</p>
[ { "answer_id": 271994, "author": "Seb Nilsson", "author_id": 2429, "author_profile": "https://Stackoverflow.com/users/2429", "pm_score": 4, "selected": true, "text": "IsolatedStorageFileStream stream = \n new IsolatedStorageFileStream(ISOLATED_FILE_NAME, \n FileMode.Create, isoStore);\...
2008/11/07
[ "https://Stackoverflow.com/questions/271944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1801/" ]
271,953
<p>Got into a situation where in a schema i have a table, say table ACTION , while i got a synonym called ACTION as well which refers to another table to another schema.</p> <p>Now, when i run the query</p> <p>select * from ACTION</p> <p>it will select the records from the table, but not the synonym.</p> <p>Anyway for me to select from the synonym AND the table both together?</p> <p>Thanx</p>
[ { "answer_id": 271997, "author": "Kieveli", "author_id": 15852, "author_profile": "https://Stackoverflow.com/users/15852", "pm_score": 2, "selected": false, "text": "SELECT * from LOCAL_ACTION\nUNION\nSELECT * from otheruser.LOCAL_ACTION\n" }, { "answer_id": 272051, "author":...
2008/11/07
[ "https://Stackoverflow.com/questions/271953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
271,954
<p>I never use Access 2007 - until today.</p> <p>I want to connect to an existing SQL Server 2008 database. I have tried using:</p> <ul> <li>External Data ODBC option - but get DSN errror</li> <li>Upsizing wizard with ODBC - get an error</li> <li>Upsizing wizard with SNAC - get ODBC error. So that one seems a none starter :-)</li> </ul> <p>I have done some searching and only found others with same issue. About to do some more... but hoping one of you has the answer OTTOYH. Thanks.</p>
[ { "answer_id": 271984, "author": "Eric Nelson", "author_id": 5636, "author_profile": "https://Stackoverflow.com/users/5636", "pm_score": 0, "selected": false, "text": "[ODBC]\nDRIVER=SQL Server\nUID=ericnel\nDATABASE=AccessTest\nWSID=ERICNEL1\nAPP=2007 Microsoft Office system\nTrusted_Co...
2008/11/07
[ "https://Stackoverflow.com/questions/271954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5636/" ]
271,957
<p>I got a row structure looks like ID bigint, ScanRept XML</p> <p>I want to wind up with a file named 4.xml containing just the xml from the ScanRept column where the ID number is 4.</p> <p>I don't want to do it interactively (by going into Manager Studio, finding the row, right-clicking the field and doing Save AS) - that's what I'll do if I can't figure out a better way. </p> <p>I do have C# available; if this is doable with sqlcmd, that's my preference (cause there will probably be a lot of variations I can't anticipate right now).</p>
[ { "answer_id": 271984, "author": "Eric Nelson", "author_id": 5636, "author_profile": "https://Stackoverflow.com/users/5636", "pm_score": 0, "selected": false, "text": "[ODBC]\nDRIVER=SQL Server\nUID=ericnel\nDATABASE=AccessTest\nWSID=ERICNEL1\nAPP=2007 Microsoft Office system\nTrusted_Co...
2008/11/07
[ "https://Stackoverflow.com/questions/271957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35458/" ]
271,965
<p>Is there a function in glut which moves the mouse to a specific position? There is a similar function in SDL (SDL_WarpMouse) but I want to stick to glut.</p>
[ { "answer_id": 271975, "author": "Alexander Stolz", "author_id": 2450, "author_profile": "https://Stackoverflow.com/users/2450", "pm_score": 4, "selected": true, "text": "glutWarpPointer(middleX, middleY)" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2450/" ]
271,966
<p>There are no builtin matrix functions in C#, but there are in the F# powerpack.</p> <p>Rather than using a third party or open source C# library, I wonder about rolling my own in F#, and exposing the useful bits to C#. </p> <p>Wondered if anybody has already thought of this, or tried it, and whether it's a good idea.</p> <p>Should I expose it as a class, or a load of static functions?</p> <p>Or should I create a C# wrapper class, and have that call down to F#? Or have the F# use the C# class as input and output?</p> <p>Any thoughts?</p> <p>Answer thanks to <a href="https://stackoverflow.com/questions/271966/about-using-f-to-create-a-matrix-assembly-usable-from-c#272250">Hath</a> below: you can use the F# library directly in C# (operators as well!):</p> <pre><code>using System; using System.Text; using Microsoft.FSharp.Math; namespace CSharp { class Program { static void Main(string[] args) { double[,] x = { { 1.0, 2.0 }, { 4.0, 5.0 } }; double[,] y = { { 1.0, 2.0 }, { 7.0, 8.0 } }; Matrix&lt;double&gt; m1 = MatrixModule.of_array2(x); Matrix&lt;double&gt; m2 = MatrixModule.of_array2(y); var mp = m1 * m2; var output = mp.ToArray2(); Console.WriteLine(output.StringIt()); Console.ReadKey(); } } public static class Extensions { public static string StringIt(this double[,] array) { var sb = new StringBuilder(); for (int r = 0; r &lt; array.Length / array.Rank; r++) { for (int c = 0; c &lt; array.Rank; c++) { if (c &gt; 0) sb.Append("\t"); sb.Append(array[r, c].ToString()); } sb.AppendLine(); } return sb.ToString(); } } } </code></pre>
[ { "answer_id": 272250, "author": "Hath", "author_id": 5186, "author_profile": "https://Stackoverflow.com/users/5186", "pm_score": 4, "selected": true, "text": "Microsoft.FSharp.Math.BigInt class.\n" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/271966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11410/" ]
271,971
<p>Through profiling I've discovered that the sprintf here takes a long time. Is there a better performing alternative that still handles the leading zeros in the y/m/d h/m/s fields?</p> <pre><code>SYSTEMTIME sysTime; GetLocalTime( &amp;sysTime ); char buf[80]; for (int i = 0; i &lt; 100000; i++) { sprintf(buf, "%4d-%02d-%02d %02d:%02d:%02d", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond); } </code></pre> <hr> <p>Note: The OP explains in the comments that this is a stripped-down example. The "real" loop contains additional code that uses varying time values from a database. Profiling has pinpointed <code>sprintf()</code> as the offender.</p>
[ { "answer_id": 271993, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 3, "selected": false, "text": "buf[0] = (sysTime.wYear / 1000) % 10 + '0' ;\nbuf[1] = (sysTime.wYear / 100) % 10 + '0';\nbuf[2] = (sysTime.wYear / 10) % 10 +...
2008/11/07
[ "https://Stackoverflow.com/questions/271971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
271,979
<p>I need to pull some BLOB data from a SQL Server 2005 database and generate a SQL script to insert this same data in another database, in another server.</p> <p>I am only allowed to do this using SQL scripts, I can't use any other utility or write a program in Java or .NET to do it.</p> <p>The other big restriction I have is that I don't have access to the original database (where the original BLOB data is) when I run the script, to copy the BLOB data to the target database, so the data should already be encoded within the SQL script file.</p> <p>Summing up: is there a way to encode the BLOB data into text so that I can dump it into a SQL INSERT command within a script text file and run it?</p> <p>I am able to run special T-SQL statements and stored procedures if needed to.</p>
[ { "answer_id": 271999, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 1, "selected": false, "text": "CREATE PROCEDURE sp_textcopy (\n @srvname varchar (30),\n @login varchar (30),\n @password varchar (30),\n ...
2008/11/07
[ "https://Stackoverflow.com/questions/271979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407003/" ]
272,003
<p>I have a MS-access database. But it is on the shared drive. And it is required that only some selected number of people can use it. Is there a way to authenticate the user?</p>
[ { "answer_id": 417801, "author": "Mike", "author_id": 51350, "author_profile": "https://Stackoverflow.com/users/51350", "pm_score": 0, "selected": false, "text": "AuthorizedUser = True\nSelect Case user\n Case \"USER_A\":\n Case \"USER_B\":\n Case \"USER_C\": \n Case Else...
2008/11/07
[ "https://Stackoverflow.com/questions/272003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6613/" ]
272,007
<p>I am using jQuery to try and trigger a method when an <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> (2.0) dropdown list's change event is handled by jQuery. The problem is that the drop down list is located inside a gridview and even then only when a user has decided to edit a row within that gridview.</p> <p>I think I have it picking up the object using an ASP code block, but the problem with that is that when the page first loads the edit index of the row does not exist and it throws an error. Putting the block inside a <code>IF</code> statement also does not work.</p> <pre><code>$(document).ready(function() //when DOM is ready, run containing code { &lt;% if (grvTimeSheets.EditIndex &gt; -1) {%&gt; $(#&lt;%=grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients").ClientID %&gt;).change(function() { $(#&lt;%= grvTimeSheets.ClientID %&gt;).block({ message: null } }); } ); &lt;% } %&gt; </code></pre> <p>It is one attempt I made, and I also tried putting the IF statement ASP code outside the JavaScript block. It doesn't work either.</p> <p>How could I apply the jQuery event to the drop drop box? Ideally as concise as possible.</p> <hr> <p>Thanks for the answer but nope, it doesn't work :(. The JavaScript code seems not to be outputted... Confusing...</p> <pre><code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.tablesorter.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.blockUI.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() //When DOM is ready, run the containing code { } ); &lt;/script&gt; </code></pre> <p>Is the output. Even though this is the code:</p> <pre><code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.tablesorter.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.blockUI.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() //when DOM is ready, run containing code {&lt;% if (grvTimeSheets.EditIndex &gt; -1) {%&gt; var id = '#&lt;%=grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients").ClientID %&gt;'; $(id).change(function() { $(id).block({ message: null } }); &lt;% } %&gt; } ); &lt;/script&gt; </code></pre> <p>It was doing that before as well, driving me CRAZY.</p> <hr> <p>Sorry, could you make that slightly clearer. I tried defining the entire thing in code behind like so:</p> <pre><code>DropDownList ddl (DropDownList)grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients"); if (ddl != null) { ClientScriptManager csm = Page.ClientScript; Type cstype = this.GetType(); String csname1 = "PopupScript"; string script = @" &lt;script language='javascript' type='text/javascript'&gt; $(#" + ddl.ClientID + ").change(function() { $(" + grvTimeSheets.ClientID + ").blockUI({ message: null }});} &lt;/script&gt;"; csm.RegisterStartupScript(cstype, csname1, script, true); } </code></pre> <p>Is that what you meant?</p> <p>BTW, the above didn't work. No errors, just no events worked.</p>
[ { "answer_id": 272311, "author": "MrKurt", "author_id": 35296, "author_profile": "https://Stackoverflow.com/users/35296", "pm_score": 3, "selected": true, "text": "$()" }, { "answer_id": 272752, "author": "OutOFTouch", "author_id": 35166, "author_profile": "https://St...
2008/11/07
[ "https://Stackoverflow.com/questions/272007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35454/" ]
272,010
<p>I'm looking for a PHP (with MYSQL) nested sets class with all needed functions. For example:</p> <p>createLeftNode, createRightNode,createRootNode, createSubNode,deleteNode and <strong>moveTree</strong>. Not only 1 left, 1 right, 1 up and 1 down but also a part of a tree in a nother tree.</p> <p>Thanks!</p>
[ { "answer_id": 42076840, "author": "Kim Pepper", "author_id": 668727, "author_profile": "https://Stackoverflow.com/users/668727", "pm_score": 0, "selected": false, "text": "revision_id" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/272010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35459/" ]
272,013
<p>Why is it called a single in VB.net? I'm sure there is a good reason but it doesn't seem intuitive to a non formally trained programmer like me.</p>
[ { "answer_id": 272023, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 2, "selected": false, "text": "shorthand" }, { "answer_id": 272186, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https...
2008/11/07
[ "https://Stackoverflow.com/questions/272013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2763/" ]
272,030
<p>I have a VS 2005 C# project that uses a special Plugin folder to load extra DLLs (for use as nodes in an asset conversion process).</p> <p>I have a mixture of C# and C++ DLLs in this folder.</p> <p>The issue I have is that when Shadow Copying is enabled, the C++ DLLs refuse to load using Assembly.LoadFrom. I have attempted to create a custom app domain, and used Load, but this also failed.</p> <p>Finally, I tried reading the DLL in as byte[] data and using Load on that - again, only the C# DLLs would work this way, with an error "Additional information: Unverifiable code failed policy check. (Exception from HRESULT: 0x80131402)".</p> <p>An article on the net prompted me to attempt to use /clr:safe when building that particular DLL, but then it simply failed to build due to thousands of errors in Microsoft code... (apparently)</p> <p>With Shadow Copying disabled, LoadFrom works fine for all DLLs. The app is itself a plugin for Maya, and this used to work with Maya 8.5 but fails with 2008 / 2009 (if Shadow Copying is enabled).</p> <p>We really would prefer to use Shadow Copying, because it prevents DLL file locks when the app is running (the Plugins folder is stored in a location that Perforce can update while the app is running).</p> <p>Any ideas as to how I can persuade Shadow Copying to work with a custom folder AND a mix of C# / C++ DLLs without these problems?</p>
[ { "answer_id": 272307, "author": "Sunlight", "author_id": 33650, "author_profile": "https://Stackoverflow.com/users/33650", "pm_score": 1, "selected": false, "text": "/clr:safe" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/272030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35444/" ]
272,035
<p>I have a form that displays file information in a TabControl, and I'd like the pages to have the file's icon in their tab. How do I get the icon associated with a file type?</p> <p>I'd prefer solutions that don't involve looking things up in the registry, but if that's the only way then so be it.</p>
[ { "answer_id": 272044, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 5, "selected": true, "text": "FileAssociationInfo" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/272035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15371/" ]
272,036
<p>I've accidentally removed Win2K compatibility from an application by using <a href="http://msdn.microsoft.com/en-us/library/ms683215(VS.85).aspx" rel="nofollow noreferrer">GetProcessID</a>.</p> <p>I use it like this, to get the main HWND for the launched application.</p> <pre><code>ShellExecuteEx(&amp;info); // Launch application HANDLE han = info.hProcess; // Get process cbinfo.han = han; //Call EnumWindows to enumerate windows.... //with this as the callback static BOOL CALLBACK enumproc(HWND hwnd, LPARAM lParam) { DWORD id; GetWIndowThreadProcessID(hwnd, &amp;id); if (id == GetProcessID(cbinfo.han)) setResult(hwnd) ... } </code></pre> <p>Any ideas how the same function could be acheived on Win2K?</p>
[ { "answer_id": 280533, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 2, "selected": false, "text": "#include \"Winternl.h\"\n\ntypedef DWORD (WINAPI* pfnGetProcID)(HANDLE h);\n\ntypedef NTSTATUS (WINAPI* pfnQueryInformationPro...
2008/11/07
[ "https://Stackoverflow.com/questions/272036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737/" ]
272,038
<p>In my Seam application, I have a Seam component that returns a (<code>@Datamodel</code>) list of items I want to transform into a set of <code>&lt;li&gt;</code> HTML elements. I have this working without a problem. </p> <p>But now, I want to split up the list according to an EL expression. So the EL expression determines if a new <code>&lt;ul&gt;</code> element should be started. I tried the following:</p> <pre><code>&lt;s:fragment rendered="#{action.isNewList(index)}"&gt; &lt;ul&gt; &lt;/s:fragment&gt; &lt;!-- stuff that does the &lt;li&gt;'s goes here --&gt; &lt;s:fragment rendered="#{action.isNewList(index)}"&gt; &lt;/ul&gt; &lt;/s:fragment&gt; </code></pre> <p>But that's invalid, because the nesting for <code>&lt;ul&gt;</code> is wrong.</p> <p>How should I do this?</p>
[ { "answer_id": 483930, "author": "phloopy", "author_id": 8507, "author_profile": "https://Stackoverflow.com/users/8507", "pm_score": 0, "selected": false, "text": "<!-- before your loop, open your first <ul> if the (@Datamodel) is not empty -->\n\n<s:fragment rendered=\"#{action.isNewLis...
2008/11/07
[ "https://Stackoverflow.com/questions/272038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6400/" ]
272,045
<p>I have two tables A and B. I would like to delete all the records from table A that are returned in the following query:</p> <pre><code>SELECT A.* FROM A , B WHERE A.id = B.a_id AND b.date &lt; '2008-10-10' </code></pre> <p>I have tried:</p> <pre><code>DELETE A WHERE id in ( SELECT a_id FROM B WHERE date &lt; '2008-10-10') </code></pre> <p>but that only works if the inner select actually returns a value (not if the result set is empty)</p> <p><strong>NB:</strong> this has to work on <strong>both SQLServer AND MySQL</strong></p> <p>EDIT: More information</p> <p>The above delete works 100% on SQLServer</p> <p>When running it on MySQL I get an "error in you SQL syntax" message which points to the start of the SELECT as the problem. if I substitute the inner select with (1,2) then it works. </p> <p><em>@Kibbee You are right it actually makes no difference if the inner select returns rows or not.</em></p> <p><em>@Fred I get a "not unique table.alias: a" message</em></p>
[ { "answer_id": 272056, "author": "Fred", "author_id": 33630, "author_profile": "https://Stackoverflow.com/users/33630", "pm_score": 1, "selected": false, "text": "DELETE FROM A\nWHERE A.id in (\n SELECT B.a_id \n FROM B\n WHERE B.date < '2008-10-10');\n" }, { "answer_id"...
2008/11/07
[ "https://Stackoverflow.com/questions/272045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/939/" ]
272,097
<p>How do I dynamically reload the app.config in a .net Windows application? I need to turn logging on and off dynamically and not just based upon the value at application start.</p> <p>ConfigurationManager.RefreshSection("appSettings") does not work and I've also tried explicitly opening the config file using OpenExeConfiguration but I always get the cached value at application startup and not the current value. </p> <p>I've accepted the answer of creating a custom configuration section. As a side note and foolish mistake - if you're running from the IDE there's no point in updating the app.config file and expecting changes. Yuo have to modify the .exe.config file in the bin\debug folder. Doh!</p>
[ { "answer_id": 272114, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 6, "selected": true, "text": "ConfigurationManager.RefreshSection(\"yoursection/subsection\");\n" }, { "answer_id": 272120, "autho...
2008/11/07
[ "https://Stackoverflow.com/questions/272097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
272,109
<p>I have a csv file of the format:</p> <pre><code>270291014011 ED HARDY - TRUE TO MY LOVE - Cap NEU 2008 NEU 0,00 € 0,00 € 0 1 0 22.10.2008 03:37:10 21.11.2008 02:37:10 21.11.2008 02:42:10 50 0 0 0 39,99 € http://i7.ebayimg.com/02/i/001/16/0d/68af_1.JPG?set_id=800005007 0 2 8.10.2008 13:40:20 8.10.2008 13:40:20 80587 0 &lt;table bordercolordark="#999900" bordercolorlight="#666666" bgcolor="#ffffff" border="10" bordercolor="#666666" width="100%"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;br&gt; &lt;/font&gt;&lt;/b&gt;&lt;blockquote&gt; &lt;div align="center"&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;h1&gt;&lt;font size="6"&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;100% ORGINAL MARKENWARE AUS DEN USA&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/h1&gt; &lt;p style="color: rgb(0, 0, 0);"&gt;&lt;font size="6"&gt;&lt;b&gt;&lt;font face="arial"&gt;ED HARDY&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="color: rgb(0, 0, 0);"&gt;&lt;b&gt;&lt;font face="arial" size="5"&gt;CAP&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;font size="5"&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Style: TRUE ROSE&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size="5"&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Die Kollektion von der trend Marke Ed Hardy kreiert sportlich, hipe Mode die bei den Stars in Hollywood der absolute Renner ist. In diesem super Trucker Cap fallen Sie auf !!&amp;nbsp; &lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size="5"&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Dieses Cap ist nagelneu mit Etikett und&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size="5"&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt; 100% orginal.&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size="5"&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Wir tragen die ebay Kosten und der Kaeufer die Versandkosten.&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Versandkosten nach Europa sind folgend:&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;fuer unversicherten Versand 6,00 Euro&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;font size="5"&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;fuer versicherten Versand 12,00 Euro&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br&gt; &lt;font size="5"&gt;&lt;span style="font-family: arial;"&gt;&lt;span style="font-weight: bold;"&gt;Bei paypal Bezahlungen akzeptieren wir nur noch versicherten Versand!&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;br&gt;&lt;font size="5"&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Auf Ihren Wunsch versenden wir die Ware auch versichert. Ansonsten trägt das Risiko beim Versand der Käufer. &lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial"&gt;Wir bitten um Ihre Zahlung innerhalb 10 Tage nach Auktionsende.&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;br&gt; &lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;div align="center"&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="#ff0000"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;marquee width="70%" bgcolor="#ffffff"&gt; &lt;h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;b&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="#ff0000"&gt;Schauen Sie unbedingt bei unserem Shop "cheap-and-hip" vorbei!!!&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h2&gt;&lt;/marquee&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;br&gt;&lt;b&gt;&lt;font color="black" face="arial" size="5"&gt;&lt;br&gt; &lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;blockquote&gt; &lt;div align="center"&gt; &lt;center&gt; &lt;h1&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;b&gt;&lt;font color="black" face="arial" size="5"&gt;Abwicklung Ihres Einkaufs bei uns&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h1&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;b&gt;&lt;font color="black" face="arial" size="5"&gt;&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/center&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Jeder Käufer erhält innerhalb von 24 Stunden nach Auktionsende eine e-mail mit allen für die Kaufabwicklung relevanten Informationen. Sollten Sie nach 24 Stunden noch keine e-mail erhalten haben, setzen Sie sich bitte mit uns per e-mail in Verbindung. &lt;br&gt;&lt;br&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Kauf von mehreren Artikeln&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Da das Porto aus den USA nach Gewicht berechnet wird, werden die Versandkosten beim Einkauf von mehreren Artikeln neu berechnet. Bitte teilen Sie uns per e-mail mit, wenn Sie mehrere Artikel ersteigert/gekauft haben, bzw. noch ersteigern/kaufen moechten, Sie erhalten von uns dann die kompletten Versandkosten. Die Kosten fuer den Versand werden von dem Kaeufer getragen. Die Versanddauer betraegt bei Luftversand zirka 5-10 Tage.&lt;br&gt;&lt;br&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Versand&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Der Versand erfolgt innerhalb von 2-3 Werktagen nach Zahlungseingang (Gutschrift der Überweisung auf unserem Konto bei der Postbank oder bei paypal). Bitte beachten Sie, dass es je nach Kreditinstitut 2-4 Werktage dauern kann, bis Ihre Überweisung auf unserem Konto gutgeschrieben wird. Kreditkarten Gutbuchung ueber paypal erfolgt noch am gleichen Tag.&lt;br&gt;Als Betreff einer Ueberweisung muß unbedingt die eBay-Artikelnummer der Auktion angegeben werden. Ohne diese Information ist eine Zuordnung der Überweisung leider fast nicht möglich! &lt;br&gt;ZOLL: Bitte beachten Sie das Zollgebuehren anfallen koennen auch wenn es nur selten vorkommt sollten Sie sich mit den Einfuhrbestimmungen Ihres Landes vertraut machen. &lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;br&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Umtausch&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Wir tauschen gerne Ihren Artikel um sofern Sie die Ware innerhalb von 14 Tagen nach erhalt den Artikel uns wieder zuschicken. Wir nehmen nur ungetragene Ware zurueck und alle Etiketten muessen noch an dem Artikel befestigt sein&lt;br&gt;&lt;br&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Falls Sie Reklamationen haben&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h2&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;Wir bitten bei Beanstandungen der Ware sich erst mit uns in Verbindung zu setzten. Wir pruefen unsere Ware immer auf Defekte aber es kann vorkommen das uns etwas entgeht und bevor Sie eine "negative Bewertung" abgeben moechten wir die Chance bekommen Sie zufrieden zustellen. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;p&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;b&gt;&lt;font color="#ff0000" face="arial" size="5"&gt; &lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;center&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;b&gt;&lt;font color="#ff0000" face="arial" size="5"&gt;Vielen Dank fuer Ihr Intresse!&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/center&gt;&lt;p&gt;&lt;b&gt;&lt;font color="#990000" face="arial" size="5"&gt;&lt;font color="#ff0000"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;font color="black" face="arial" size="3"&gt;&lt;b&gt;&lt;font color="#ff0000" face="arial" size="5"&gt;&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;&lt;br&gt; 1 Baltimore 1 0 1 0 0 0,10 € 0,00 € 0,00 € 0 0 1 77 </code></pre> <p>I would like to know if there is an easy way with sed or awk to remove the HTML tags except for <code>&lt;p&gt;</code> tags. I would also like to know if it is possible for any link html embedding a Flash SWF file, to change the HTML automatically to link to this file.</p> <p>So, in essence, to replace any code such as</p> <pre><code>&lt;embed src="http://backend.supremeauction.com/app/gallery/loader.swf"&gt; </code></pre> <p>with something like <code>&lt;a href="http://backend.supremeauction.com/app/gallery/loader.swf"&gt;Click here for external description&lt;/a&gt;</code> and then remove all other HTML tags except for <code>&lt;p&gt;</code></p> <p>Is this even possible?</p>
[ { "answer_id": 272353, "author": "Axeman", "author_id": 11289, "author_profile": "https://Stackoverflow.com/users/11289", "pm_score": 2, "selected": true, "text": "perl -pe 's/<\\/?(?>[^p]|p\\w+)[^>]*>//ig'\n" }, { "answer_id": 272376, "author": "Steve Baker", "author_id"...
2008/11/07
[ "https://Stackoverflow.com/questions/272109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
272,118
<p>I know, it depends on the webapp. But in the normal case, what do you do: one servlet, that serves different pages (like an standalone-application with changing content) or for every page a single servlet.</p> <p>Take for instance a blog. There is the start-page with the most recent blog-entries, an article-view for displaying one blog-entry and an archive. Do you implement this with three different servlets, or one that is dispatching to the functions. At least a good part of the stuff is shared, like http-headers.</p> <p>So, what are your experiences, what works best?</p>
[ { "answer_id": 272506, "author": "Miguel Ping", "author_id": 22992, "author_profile": "https://Stackoverflow.com/users/22992", "pm_score": 3, "selected": false, "text": "@Controller\npublic class MyController {\n @RequestMapping(\"/viewPosts\")\n public void doViewPosts(HttpRequest r, Ht...
2008/11/07
[ "https://Stackoverflow.com/questions/272118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21005/" ]
272,124
<p>since JTree &amp; TreeModel don't provide tooltips straight out-of-the-box, what do you think, what would be the best way to have item-specific tooltips for JTree?</p> <p>Edit: (Answering my own question afterwards.) </p> <p>@Zarkonnen: Thanks for the getTooltipText idea. </p> <p>I found out another (maybe still a bit nicer) way with overriding DefaultTreeCellRenderer and thought to share it:</p> <pre><code>public class JTreeWithToolTips { private static class OwnRenderer extends DefaultTreeCellRenderer { @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { setToolTipText("foobar" + row); return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); } } public static void main(String[] args) { JTree tree = new JTree(new Object[] { "foo", "bar", "foobar" }); tree.setCellRenderer(new OwnRenderer()); ToolTipManager.sharedInstance().registerComponent(tree); JFrame frame = new JFrame(); frame.getContentPane().add(tree); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } </code></pre>
[ { "answer_id": 1774609, "author": "Agustin", "author_id": 215965, "author_profile": "https://Stackoverflow.com/users/215965", "pm_score": 1, "selected": false, "text": "onMouseMoved" }, { "answer_id": 46084789, "author": "Matthieu", "author_id": 1098603, "author_profi...
2008/11/07
[ "https://Stackoverflow.com/questions/272124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28482/" ]
272,131
<h2>Setup</h2> <p>I have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other.</p> <p>However, I only have two next to each other, and if the window resizes, there can be some ugly empty space on the screen.</p> <h2>Desire</h2> <p>What I'd like to be able to do, but have not figured out a way yet, is to put all the feeds linearly into the page, and have:</p> <ul> <li>a 'pre-built' multicolumn view where the feeds would "balance" themselves into the columns</li> </ul> <p>which leads me to:</p> <ul> <li>the number of columns change depending on how wide the screen is currently\</li> </ul> <p>This is akin to how word processing applications handle columnar layouts.</p> <h2>Question</h2> <p>I presume that I will need to implement some form of AJAXy happiness, but currently know very little about Javascript.</p> <p>Is there a way to do this with <strong><em>just</em></strong> CSS/HTML/PHP?</p> <p>If not, how should I go about solving this?</p> <p><br/></p> <h3>final solution:</h3> <p>(based on <a href="https://stackoverflow.com/a/272183/4418">@warpr</a>'s and <a href="https://stackoverflow.com/a/272229/4418">@joh6nn</a>'s answers)</p> <pre><code>#rss {min-width: 10em; max-width: 25em; min-height: 15em; max-height: 25em; font-size: .97em; float: left; } </code></pre>
[ { "answer_id": 272351, "author": "Raithlin", "author_id": 6528, "author_profile": "https://Stackoverflow.com/users/6528", "pm_score": 0, "selected": false, "text": "var columns = $(\".feed\").size();\nvar size = 100/columns;\n$(\".feed\").css(\"width\",size+\"%\");\n" }, { "answe...
2008/11/07
[ "https://Stackoverflow.com/questions/272131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4418/" ]
272,152
<p>What do I have to do to convert a DIB to a BMP?</p>
[ { "answer_id": 18292271, "author": "Jeff Barnes", "author_id": 1919288, "author_profile": "https://Stackoverflow.com/users/1919288", "pm_score": 2, "selected": false, "text": "BITMAPFILEHEADER *bmp = ...;\nchar * bmpBytes = reinterpret_cast<char *>(bmp);\nvoid * myDib = (void *)bmpBytes ...
2008/11/07
[ "https://Stackoverflow.com/questions/272152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
272,153
<p>If I define a struct in C# using automatic properties like this:</p> <pre><code>public struct Address { public Address(string line1, string line2, string city, string state, string zip) { Line1 = line1; Line2 = line2; City = city; State = state; Zip = zip; } public string Line1 { get; protected set; } public string Line2 { get; protected set; } public string City { get; protected set; } public string State { get; protected set; } public string Zip { get; protected set; } } </code></pre> <p>When I attempt to build the file, I get a compilation error saying <code>The 'this' object cannot be used before all of its fields are assigned to</code>. This can be solved by changing the constructor to make a chained call to the default constructor like this:</p> <pre><code>public Address(string line1, string line2, string city, string state, string zip): this() { Line1 = line1; Line2 = line2; City = city; State = state; Zip = zip; } </code></pre> <p>My question is, why does this work, and what is happening? I have a guess, and I tried to prove it by looking at IL, but I'm only kidding myself if I think I can break down IL. But my guess is, auto properties work by having the compiler generate fields for your properties behind the scenes. Those fields cannot be accessed through code, all setting and getting must be done through the properties. When creating a struct, a default constructor cannot be explicitly defined. So behind the scenes, the compiler must be generating a default constructor that sets the values of the fields that the developer can't see.</p> <p>Any and all IL wizards are welcome to prove or disprove my theory.</p>
[ { "answer_id": 272164, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "this()" }, { "answer_id": 12676594, "author": "supercat", "author_id": 363751, "author_profile": "htt...
2008/11/07
[ "https://Stackoverflow.com/questions/272153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6146/" ]
272,157
<p>I have a triangle mesh that has no texture, but a set color (sort of blue) and alpha (0.7f). This mesh is run time generated and the normals are correct. I find that with lighting on, the color of my object changes as it moves around the level. Also, the lighting doesn't look right. When I draw this object, this is the code:</p> <pre><code>glEnable( GL_COLOR_MATERIAL ); float matColor[] = { cur-&gt;GetRed(), cur-&gt;GetGreen(), cur-&gt;GetBlue(), cur-&gt;GetAlpha() }; float white[] = { 0.3f, 0.3f, 0.3f, 1.0f }; glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matColor); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white); </code></pre> <p>Another odd thing I noticed is that the lighting fails, when I disable <code>GL_FRONT_AND_BACK</code> and use just <code>GL_FRONT</code> or <code>GL_BACK</code>. Here is my lighting setup (done once at beginning of renderer):</p> <pre><code>m_lightAmbient[] = { 0.2f, 0.2f, 0.2f, 1.0f }; m_lightSpecular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; m_lightPosition[] = { 0.0f, 1200.0f, 0.0f, 1.0f }; glLightfv(GL_LIGHT0, GL_AMBIENT, m_lightAmbient); glLightfv(GL_LIGHT0, GL_SPECULAR, m_lightSpecular); glLightfv(GL_LIGHT0, GL_POSITION, m_lightPosition); </code></pre> <p>EDIT: I've done a lot to make the normals "more" correct (since I am generating the surface myself), but the objects color still changes depending where it is. Why is this? Does openGL have some special environment blending I don't know about?</p> <p>EDIT: Turns out the color changing was because a previous texture was on the texture stack, and even though it wasn't being drawn, <code>glMaterialfv</code> was blending with it.</p>
[ { "answer_id": 277381, "author": "DavidG", "author_id": 25893, "author_profile": "https://Stackoverflow.com/users/25893", "pm_score": 0, "selected": false, "text": "// Vertices!\nglEnableClientState(GL_VERTEX_ARRAY);\n\n// Depth func\nglEnable(GL_DEPTH_TEST);\nglDepthFunc( GL_LESS );\n\n...
2008/11/07
[ "https://Stackoverflow.com/questions/272157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25893/" ]
272,159
<p>I have the following one route, registered in my global.asax.</p> <pre><code>routes.MapRoute( "Home", // Unique name "", // Root url new { controller = "Home", action = "Index", tag = string.Empty, page = 1 } ); </code></pre> <p>kewl. when I start the site, it correctly picks up this route.</p> <p>Now, when I try to programmatically do the following, it returns NULL.</p> <pre><code>var pageLinkValueDictionary = new RouteValueDictionar(linkWithoutPageValuesDictionary) {{"page", 2}}; VirtualPathData virtualPathData = RouteTable.Routes.GetVirtualPath(viewContext, "Home" pageLinkValueDictionary); // NOTE: pageLinkValueDictionary == // Key: Action, Value: Index; Key: page, Value: 2 </code></pre> <p>Why would this be happening?</p> <p>I was under the impression that it would find the Home route but append any values not found as query string items?</p> <h2>Update</h2> <p>Still no luck with this. Also, using the <a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=f4e4ee26-4bc5-41ed-80c9-261336b2a5b6&amp;displaylang=en" rel="nofollow noreferrer">MVC RC</a>, I now need to change the viewContext to veiwContext.RequestContext .. which compiles but I'm still getting a null result.</p> <h2>Update 2</h2> <p>When I have the route without the <code>page=1</code> default item, the route <em>IS FOUND</em>. eg.</p> <pre><code>routes.MapRoute( "Home", "", new { controller = "Post", action = "Index", tags = string.Empty } ); </code></pre> <p>.. and <code>RouteTable.Routes.GetVirtualPath</code> returns a <code>VirtualPathData</code> instance. When I add the <code>page=1</code> (default value) back in, the <code>VirtualPathData</code> instance returned is null?</p>
[ { "answer_id": 272527, "author": "Torkel", "author_id": 24425, "author_profile": "https://Stackoverflow.com/users/24425", "pm_score": 2, "selected": true, "text": "return RedirectToRoute(\"IndexDefault\", new {page = \"2\"}); \n" }, { "answer_id": 272917, "author": "Ben Schei...
2008/11/07
[ "https://Stackoverflow.com/questions/272159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30674/" ]
272,161
<p>When I write code like this in VS 2008:<br><br></p> <pre><code>.h struct Patterns { string ptCreate; string ptDelete; string ptDrop; string ptUpdate; string ptInsert; string ptSelect; }; class QueryValidate { string query; string pattern; static Patterns pts; public: friend class Query; QueryValidate(const string&amp; qr, const string&amp; ptn): query(qr), pattern(ptn) {} bool validate() { boost::regex rg(pattern); return boost::regex_match(query, rg); } virtual ~QueryValidate() {} }; </code></pre> <p>I then initialize my structure like this: </p> <pre><code>.cpp string QueryValidate::pts::ptCreate = "something"; string QueryValidate::pts::ptDelete = "something"; //... </code></pre> <p>The compiler gives the following errors: </p> <blockquote> <p>'Patterns': the symbol to the left of a '::' must be a type 'ptSelect' : is not a member of 'QueryValidate'</p> </blockquote> <p>What am I doing wrong? Is this a problem with Visual Studio or with my code? I know that static members except for const ones must be defined outside the class they were declared in.</p>
[ { "answer_id": 272240, "author": "Pieter", "author_id": 5822, "author_profile": "https://Stackoverflow.com/users/5822", "pm_score": 4, "selected": true, "text": "Patterns QueryValidate::pts = {\"CREATE\", \"DELETE\"}; // etc. for every string\n" }, { "answer_id": 272295, "aut...
2008/11/07
[ "https://Stackoverflow.com/questions/272161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
272,188
<p>I have already visited <a href="https://stackoverflow.com/questions/191673/preferred-python-unit-testing-framework">Preferred Python unit-testing framework</a>. I am not just looking at Python Unit Testing Framework, but also code coverage with respect to unit tests. So far I have only come across <a href="http://nedbatchelder.com/code/modules/coverage.html" rel="nofollow noreferrer">coverage.py</a>. Is there any better option?</p> <p>An interesting option for me is to integrate <a href="http://www.python.org/" rel="nofollow noreferrer">cpython</a>, unit testing of Python code and code coverage of Python code with Visual Studio 2008 through plugins (something similar to <a href="http://www.codeplex.com/IronPythonStudio" rel="nofollow noreferrer">IronPython Studio</a>). What can be done to achieve this? I look forward to suggestions.</p>
[ { "answer_id": 288711, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 0, "selected": false, "text": "--coverage" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/272188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30289/" ]
272,190
<p>I basically created some tables to play around with: I have Two main tables, and a Many-Many join table. Here is the DDL: (I am using HSQLDB)</p> <pre><code>CREATE TABLE PERSON ( PERSON_ID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, NAME VARCHAR(50), MAIN_PERSON_ID INTEGER ) CREATE TABLE JOB ( JOB_ID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, NAME VARCHAR(50) ) CREATE TABLE JOB_PERSON ( PERSON_ID INTEGER, JOB_ID INTEGER ) ALTER TABLE JOB_PERSON ADD CONSTRAINT FK_PERSON_JOB FOREIGN KEY(PERSON_ID) REFERENCES PERSON ON DELETE CASCADE ON UPDATE CASCADE ALTER TABLE JOB_PERSON ADD CONSTRAINT FK_JOB_PERSON FOREIGN KEY(JOB_ID) REFERENCES JOB ON DELETE CASCADE ON UPDATE CASCADE ALTER TABLE PERSON ADD CONSTRAINT FK_PERSON_PERSON FOREIGN KEY(MAIN_PERSON_ID) REFERENCES PERSON ON DELETE CASCADE ON UPDATE CASCADE insert into person values(null,'Arthur', null); insert into person values(null,'James',0); insert into job values(null, 'Programmer') insert into job values(null, 'Manager') insert into job_person values(0,0); insert into job_person values(0,1); insert into job_person values(1,1); </code></pre> <p>I want to create a delete statement that deletes orphans from JOB (if there exists only one entry in the join table for a specific job) based on the PERSON.PERSON_ID. </p> <p>In pseudo language: </p> <pre><code>delete from job where job_person.job_id=job.job_id AND count(job_person.job_id)=1 AND job_person.person_id=X </code></pre> <p>Where X is some person_id. I have tried a lot of different ways; I think it is the "COUNT" part that is causing problems. I am an SQL rookie, so any help would be much appreciated.</p>
[ { "answer_id": 272243, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 3, "selected": true, "text": "JOB" }, { "answer_id": 272251, "author": "Fred", "author_id": 33630, "author_profile": "https://Stack...
2008/11/07
[ "https://Stackoverflow.com/questions/272190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33863/" ]
272,194
<p>My webapp is part of a larger EAR that is deployed into a websphere server. The server hosts number of other apps on the same virtual server. My webapp has some initialisation/health checks in a servletContextListener->contextInitialized method. I want to make the webapp unavailable if initialisation/health checks fail. What is a realiable way of doing this? Will throwing a RuntimeException from within contextInitialized suffice? Is the rest of the EAR still expected to be available? Thank you.</p>
[ { "answer_id": 272747, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 4, "selected": true, "text": "RuntimeException" } ]
2008/11/07
[ "https://Stackoverflow.com/questions/272194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33434/" ]
272,199
<p>I have a solution which contains many class libraries and an ASP .NET website which references those assemblies.</p> <p>When I build the solution from within the IDE, all assemblies referenced by the website end up in the bin directory. Great!</p> <p>When I use MsBuild from the command line, all the referenced assemblies are not copied to the bin directory. Why?</p> <p>My command line is simply:</p> <pre><code>msbuild.exe d:\myproject\mysolution.sln </code></pre>
[ { "answer_id": 287900, "author": "kenny", "author_id": 3225, "author_profile": "https://Stackoverflow.com/users/3225", "pm_score": 0, "selected": false, "text": "%windir%\\Microsoft.Net\\framework\\v2.0.50727\\aspnet_compiler -v \\%~n1 -f -p .\\%1 .\\Website\n" }, { "answer_id":...
2008/11/07
[ "https://Stackoverflow.com/questions/272199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5449/" ]
272,203
<p>I'm thinking of using PDO in all of my future webapp. Currently (using what I've learned from SO so far), what I have in my site to handle database connection is a Singleton class like this :</p> <pre><code>class DB { private static $instance = NULL; private static $dsn = "mysql:host=localhost;dbname=mydatabase;"; private static $db_user = 'root'; private static $db_pass = '0O0ooIl1'; private function __construct() { } private function __clone() { } public static function getInstance() { if (!self::$instance) { self::$instance = new PDO(self::$dsn, self::$db_user, self::$db_pass); self::$instance-&gt; setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } return self::$instance; } } </code></pre> <p>and another file (functions.php) with content-specific functions looking exactly like this one :</p> <pre><code>function get_recent_activities () { try { $db = DB::getInstance(); // --prepare and execute query here, fetch the result-- return $my_list_of_recent_activities; } catch (PDOException $e) { return "some fail-messages"; } } ... </code></pre> <p>meaning that I have to repeat the <code>try .. catch</code> part in all of the functions.</p> <p>My questions are :</p> <ol> <li>How should I make that more efficient ? (eg. not having to repeat <code>try..catch</code> in all functions, and yet still able to return different "fail-message" on each one)</li> <li>Is this already a good practice ? I'm still new at PDO and OOP (still a lot more to learn), so (as of now), I can't really see any disadvantages or things that can be improved in there.</li> </ol> <p>I'm sorry if that seems unclear or too long. Thanks in advance.</p>
[ { "answer_id": 272274, "author": "Noah Goodrich", "author_id": 20178, "author_profile": "https://Stackoverflow.com/users/20178", "pm_score": 2, "selected": false, "text": "class DB extends PDO \n{\n // Allows implementation of the singleton pattern -- ndg 5/24/2008\n private static...
2008/11/07
[ "https://Stackoverflow.com/questions/272203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26721/" ]
272,207
<p>I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer able to call it.</p> <p>Creating a little windows app in 3.5 as a test is able to call the web service without problems so I know it still works.</p> <p>Nothing has changed in the code at all, it's just compiled as a 3.5 project instead of a 2.0 project.</p> <p>For those who care what error I get back, it's this:</p> <blockquote> <p>An unhandled exception of type 'System.Net.WebException' occurred in system.web.services.dll</p> <p>Additional information: The underlying connection was closed: An unexpected error occurred on a receive.</p> </blockquote> <p>Is there anything I can do to the web service to make it backwards compatible (if that's even the issue)?</p> <p>[Edit] Responses to answers below (so far): Re-Discovering did not work, nor did removing and re-adding the webservice. I don't believe it's a SOAP issue becuase the WSDLs are identical (both show SOAP 1.2). Browsing to the webservice from the server works just fine.</p>
[ { "answer_id": 274277, "author": "denis phillips", "author_id": 748, "author_profile": "https://Stackoverflow.com/users/748", "pm_score": 1, "selected": false, "text": " // Put this override in the generated Reference.cs of the client proxy\n protected override System.Net.WebReques...
2008/11/07
[ "https://Stackoverflow.com/questions/272207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849/" ]
272,210
<p>What is the accepted practice for indenting SQL statements? For example, consider the following SQL statement:</p> <pre><code>SELECT column1, column2 FROM table1 WHERE column3 IN ( SELECT TOP(1) column4 FROM table2 INNER JOIN table3 ON table2.column1 = table3.column1 ) </code></pre> <p>How should this be indented? Many thanks.</p>
[ { "answer_id": 272227, "author": "LeppyR64", "author_id": 16592, "author_profile": "https://Stackoverflow.com/users/16592", "pm_score": 4, "selected": false, "text": "SELECT\n column1,\n column2\nFROM\n table1\nWHERE\n column3 IN ( \n SELECT TOP(1)\n column4\n FROM\n ...
2008/11/07
[ "https://Stackoverflow.com/questions/272210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35483/" ]
272,270
<pre><code> &lt;object height="25" width="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt; &lt;param value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" name="movie"/&gt; &lt;param value="high" name="quality"/&gt; &lt;param value="#FFFFFF" name="bgcolor"/&gt; &lt;param value="opaque" name="wmode"/&gt; &lt;embed height="25" width="75" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#FFFFFF" quality="high" src="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK"/&gt; &lt;/object&gt; </code></pre> <p>I am having to insert this legacy markup into a new site that I'm building. Problem is its using an <code>&lt;embed&gt;</code> tag. </p> <p>Would I just do away with the <code>&lt;embed&gt;</code> and put some content in as an alternative, for those that do not have flash? Basically I'm just trying to bring this piece of html into the 21st century.</p>
[ { "answer_id": 272308, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 2, "selected": false, "text": "<P> <!-- First, try the Python applet -->\n<OBJECT title=\"The Earth as seen from space\" \n ...
2008/11/07
[ "https://Stackoverflow.com/questions/272270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
272,313
<p>I have the requirement to support different Master pages on my application (ASP.NET MVC). What is the recommended way to:</p> <ol> <li>Pass the master page name to the view from.</li> <li>Store the master page (in session, or something) so it sticks during a user's visit.</li> </ol>
[ { "answer_id": 460828, "author": "Slee", "author_id": 34548, "author_profile": "https://Stackoverflow.com/users/34548", "pm_score": 4, "selected": true, "text": "Public Class CustomBaseController\n Inherits System.Web.Mvc.Controller\n\n Protected Overrides Function View(ByVal viewN...
2008/11/07
[ "https://Stackoverflow.com/questions/272313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7277/" ]
272,360
<p>If so, does it effectively deprecate the <code>visibility</code> property?</p> <p>(I realize that Internet Explorer does not yet support this CSS2 property.) <br/> <a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)#Properties" rel="noreferrer">Comparisons of layout engines</a></p> <p><a href="https://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone">See also: What is the difference between visibility:hidden and display:none</a></p>
[ { "answer_id": 272380, "author": "Andrew Bullock", "author_id": 28543, "author_profile": "https://Stackoverflow.com/users/28543", "pm_score": 2, "selected": false, "text": "opacity: 0.6;\n-moz-opacity: 0.6;\nfilter: alpha(opacity=60);\n" }, { "answer_id": 272381, "author": "D...
2008/11/07
[ "https://Stackoverflow.com/questions/272360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14749/" ]