qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
289,843
<p>Can anyone give me details of </p> <blockquote> <p>runtime error 3734</p> </blockquote> <p>in Access vba.</p> <p>For reference i am getting it from a code in the following thread</p> <p><a href="https://stackoverflow.com/questions/233026/how-to-run-a-loop-of-queries-in-access">How to run a loop of queries in a...
[ { "answer_id": 290068, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 1, "selected": true, "text": "<p>It seems that you are using ADO in the current database without saving. You must save before running code that contains ...
2008/11/14
[ "https://Stackoverflow.com/questions/289843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31132/" ]
Can anyone give me details of > > runtime error 3734 > > > in Access vba. For reference i am getting it from a code in the following thread [How to run a loop of queries in access?](https://stackoverflow.com/questions/233026/how-to-run-a-loop-of-queries-in-access) ``` Sub plausibt_check() Dim rs As DAO.Recor...
It seems that you are using ADO in the current database without saving. You must save before running code that contains ADO.
289,900
<p>I am working on turbo C on windows where char takes one byte.Now my problem is with the below union.</p> <pre><code>union a { unsigned char c:2; }b; void main() { printf("%d",sizeof(b)); \\or even sizeof(union a) } </code></pre> <p><p>This program is printing output as 2 where as union should be taking only 1 by...
[ { "answer_id": 289919, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 1, "selected": false, "text": "<p>I'm not sure where you find the requirement that the union must be precisely the minimum size. An object must be at le...
2008/11/14
[ "https://Stackoverflow.com/questions/289900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31116/" ]
I am working on turbo C on windows where char takes one byte.Now my problem is with the below union. ``` union a { unsigned char c:2; }b; void main() { printf("%d",sizeof(b)); \\or even sizeof(union a) } ``` This program is printing output as 2 where as union should be taking only 1 byte. Why is it so? for struct ...
[Turbo C is based on 8086 microprocessor which has two byte word boundary](http://web.archive.org/web/20080627072007/http://cunion.blogspot.com/2008/01/why-we-cannot-use-relation-and-logical.html). The atomic reading and writing is typically bound to CPU's architecture, so the compiler is adding some slack bytes to ali...
289,909
<p>I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?</p>
[ { "answer_id": 289981, "author": "jalf", "author_id": 33213, "author_profile": "https://Stackoverflow.com/users/33213", "pm_score": 1, "selected": false, "text": "<p>Building it isn't difficult.\nThey have a fairly good expanaltion of the default process here:\n<a href=\"http://www.boost...
2008/11/14
[ "https://Stackoverflow.com/questions/289909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13220/" ]
I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?
The [BoostPro Computing](http://www.boostpro.com/) folks maintain the Boost installer for Windows but it usually take a few weeks for them to put new versions online. It's not yet up for 1.37. There's no Visual Studio solution (remember, Boost targets *many* platforms) though there is an effort to also support [buildi...
289,914
<p>I know what I'm looking for is probably a security hole, but since I managed to do it in Oracle and SQL Server, I'll give it a shot:</p> <p>I'm looking for a way to execute a shell command from a SQL script on MySQL. It is possible to create and use a new stored procedure if necessary.</p> <p>Notice: I'm not looki...
[ { "answer_id": 289943, "author": "Eigir", "author_id": 37007, "author_profile": "https://Stackoverflow.com/users/37007", "pm_score": 0, "selected": false, "text": "<p>According to <a href=\"http://forums.mysql.com/read.php?10,198595,198899#msg-198899\" rel=\"nofollow noreferrer\">this po...
2008/11/14
[ "https://Stackoverflow.com/questions/289914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9941/" ]
I know what I'm looking for is probably a security hole, but since I managed to do it in Oracle and SQL Server, I'll give it a shot: I'm looking for a way to execute a shell command from a SQL script on MySQL. It is possible to create and use a new stored procedure if necessary. Notice: I'm not looking for the SYSTEM...
You might want to consider writing your scripts in a more featureful scripting language, like Perl, Python, PHP, or Ruby. All of these languages have libraries to run SQL queries. There is no built-in method in the stored procedure language for running shell commands. This is considered a bad idea, not only because it...
289,916
<p>I always hear that using "lastInsertId" (or mysql_insert_id() if you're not using PDO) is evil. In case of triggers it obviously is, because it could return something that's totally not the last ID that your INSERT created.</p> <pre><code>$DB-&gt;exec("INSERT INTO example (column1) VALUES ('test')"); // Usually ret...
[ { "answer_id": 289928, "author": "Peter Howe", "author_id": 24106, "author_profile": "https://Stackoverflow.com/users/24106", "pm_score": 0, "selected": false, "text": "<p>It's not sophisticated and it's not efficient, but if the data you've inserted include unique fields, then a SELECT ...
2008/11/14
[ "https://Stackoverflow.com/questions/289916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
I always hear that using "lastInsertId" (or mysql\_insert\_id() if you're not using PDO) is evil. In case of triggers it obviously is, because it could return something that's totally not the last ID that your INSERT created. ``` $DB->exec("INSERT INTO example (column1) VALUES ('test')"); // Usually returns your newly...
If you go the route of ADOdb (<http://adodb.sourceforge.net/>), then you can create the insert ID *before hand* and explicitly specific the ID when inserting. This can be implemented portably (ADOdb supports a ton of different databases...) and guarantees you're using the correct insert ID. The PostgreSQL SERIAL data...
289,936
<p>How to get the number of years between two <code>java.util.Date</code>?</p> <p><strong>Note:</strong> using only <code>java.util.Date</code></p>
[ { "answer_id": 289947, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": false, "text": "<p>How accurate do you need to be? If approximate is good enough, then I'd do</p>\n\n<pre><code>long msDiff = date1.ge...
2008/11/14
[ "https://Stackoverflow.com/questions/289936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How to get the number of years between two `java.util.Date`? **Note:** using only `java.util.Date`
How accurate do you need to be? If approximate is good enough, then I'd do ``` long msDiff = date1.getTime() - date2.getTime(); int yearDiff = (int)(msDiff / 1000 / 60 / 60 / 24 / 365.25); ```
289,951
<p>Can I use Xpath node set function position() in Delphi's function selectNodes() to select only a certain number of element from a node list? If I do like this: </p> <pre><code>selectNodes('Item[1]') </code></pre> <p>its all fine and I get the element with index 1, but when I try </p> <pre><code>selectNodes('Item...
[ { "answer_id": 289968, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 0, "selected": false, "text": "<p>selectNodes requires a string, so you should try:</p>\n\n<pre><code>selectNodes('Item[position()&lt;10]')\n</code>...
2008/11/14
[ "https://Stackoverflow.com/questions/289951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26207/" ]
Can I use Xpath node set function position() in Delphi's function selectNodes() to select only a certain number of element from a node list? If I do like this: ``` selectNodes('Item[1]') ``` its all fine and I get the element with index 1, but when I try ``` selectNodes('Item[position()<10]') ``` I get excepti...
This is not really a Delphi question I think, but an MSXML one. Check the [MSXML docs](http://msdn.microsoft.com/en-us/library/ms763742(VS.85).aspx) or rather the [MS XPath docs](http://msdn.microsoft.com/en-us/library/ms256115(VS.85).aspx). Hmm, according to the [XPath examples](http://msdn.microsoft.com/en-us/librar...
289,965
<p>I would like to create a simple program (in Java) which edits text files - particularly one which performs inserting arbitrary pieces of text at random positions in a text file. This feature is part of a larger program I am currently writing.</p> <p>Reading the description about java.util.RandomAccessFile, it appea...
[ { "answer_id": 289991, "author": "Brendan Cashman", "author_id": 5814, "author_profile": "https://Stackoverflow.com/users/5814", "pm_score": 2, "selected": false, "text": "<p>I believe the only way to insert text into an existing text file is to read the original file and write the conte...
2008/11/14
[ "https://Stackoverflow.com/questions/289965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37651/" ]
I would like to create a simple program (in Java) which edits text files - particularly one which performs inserting arbitrary pieces of text at random positions in a text file. This feature is part of a larger program I am currently writing. Reading the description about java.util.RandomAccessFile, it appears that an...
Okay, this question is pretty old, but FileChannels exist since Java 1.4 and I don't know why they aren't mentioned anywhere when dealing with the problem of replacing or inserting content in files. [FileChannels](http://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html) are fast, use them. Here's a...
289,980
<p>Given the following class: </p> <pre><code>class TestClass { public void SetValue(int value) { Value = value; } public int Value { get; set; } } </code></pre> <p>I can do </p> <pre><code>TestClass tc = new TestClass(); Action&lt;int&gt; setAction = tc.SetValue; setAction.Invoke(12); </code></pre> <p>which is...
[ { "answer_id": 289985, "author": "Kieron", "author_id": 5791, "author_profile": "https://Stackoverflow.com/users/5791", "pm_score": 2, "selected": false, "text": "<p>Properties are really wrappers around methods in .Net, so using reflection you should be able to get the delegate (set_PRO...
2008/11/14
[ "https://Stackoverflow.com/questions/289980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143/" ]
Given the following class: ``` class TestClass { public void SetValue(int value) { Value = value; } public int Value { get; set; } } ``` I can do ``` TestClass tc = new TestClass(); Action<int> setAction = tc.SetValue; setAction.Invoke(12); ``` which is all good. Is it possible to do the same thing using th...
You could create the delegate using reflection : ``` Action<int> valueSetter = (Action<int>)Delegate.CreateDelegate(typeof(Action<int>), tc, tc.GetType().GetProperty("Value").GetSetMethod()); ``` or create a delegate to an anonymous method which sets the property; ``` Action<int> valueSetter = v => tc.Value = v; `...
289,997
<p>What does "Overloaded"/"Overload" mean in regards to programming?</p>
[ { "answer_id": 290003, "author": "Filip Frącz", "author_id": 21704, "author_profile": "https://Stackoverflow.com/users/21704", "pm_score": 6, "selected": true, "text": "<p>It means that you are providing a function (method or operator) with the same name, but with a different signature.\...
2008/11/14
[ "https://Stackoverflow.com/questions/289997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21559/" ]
What does "Overloaded"/"Overload" mean in regards to programming?
It means that you are providing a function (method or operator) with the same name, but with a different signature. For example: ``` void doSomething(); int doSomething(string x); int doSomething(int a, int b, int c); ```
290,007
<p>Imagine you had a group of product categories organized in a nice tree hierarchy and you wanted to provide hackable urls to browse these. You could do something like this</p> <pre><code>/catalog/categorya/categoryb/categoryc </code></pre> <p>You could then quite easily figure out which category you should list the...
[ { "answer_id": 290020, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://Stackoverflow.com/users/3937", "pm_score": 1, "selected": false, "text": "<p>Those all look fine (except for the one with the colon).</p>\n\n<p>The key is what to do when they guess wrong -- don'...
2008/11/14
[ "https://Stackoverflow.com/questions/290007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25319/" ]
Imagine you had a group of product categories organized in a nice tree hierarchy and you wanted to provide hackable urls to browse these. You could do something like this ``` /catalog/categorya/categoryb/categoryc ``` You could then quite easily figure out which category you should list the products for (note that t...
Deep paths irk me. They're hideous to share. ``` /product/1234/oblivion --> direct page /product/oblivion --> /product/1234/oblivion if oblivion is a unique product, --> ~ Diambiguation page if oblivion is not a unqiue product. /product/1234/notoblivion -> /product/1234/oblivion /categories/79/adventure --> play...
290,018
<p>I have a Repeater control on ASPX-page defined like this:</p> <pre><code>&lt;asp:Repeater ID="answerVariantRepeater" runat="server" onitemdatabound="answerVariantRepeater_ItemDataBound"&gt; &lt;ItemTemplate&gt; &lt;asp:RadioButton ID="answerVariantRadioButton" runat="server" GroupName="a...
[ { "answer_id": 290259, "author": "HectorMac", "author_id": 1400, "author_profile": "https://Stackoverflow.com/users/1400", "pm_score": 3, "selected": true, "text": "<p>Since You are using javascript already to handle the radio button click event on the client, you could update a hidden f...
2008/11/14
[ "https://Stackoverflow.com/questions/290018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11256/" ]
I have a Repeater control on ASPX-page defined like this: ``` <asp:Repeater ID="answerVariantRepeater" runat="server" onitemdatabound="answerVariantRepeater_ItemDataBound"> <ItemTemplate> <asp:RadioButton ID="answerVariantRadioButton" runat="server" GroupName="answerVariants" T...
Since You are using javascript already to handle the radio button click event on the client, you could update a hidden field with the selected value at the same time. Your server code would then just access the selected value from the hidden field.
290,035
<p>Does anyone know in .Net 2.0 - .Net 3.5 how to load a jpeg into a System.Windows.Forms.WebControl as a byte-array and with the right mimetypes set so it will show?</p> <p>Something like:<br></p> <pre><code>webBrowser1.DocumentStream = new MemoryStream(File.ReadAllBytes("mypic.jpg")); webBrowser1.DocumentType = "ap...
[ { "answer_id": 290986, "author": "Ian Boyd", "author_id": 12597, "author_profile": "https://Stackoverflow.com/users/12597", "pm_score": 0, "selected": false, "text": "<p>You cannot do it. You cannot stuff images into Microsoft's web-browser control.</p>\n\n<p>The limitation comes from th...
2008/11/14
[ "https://Stackoverflow.com/questions/290035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37643/" ]
Does anyone know in .Net 2.0 - .Net 3.5 how to load a jpeg into a System.Windows.Forms.WebControl as a byte-array and with the right mimetypes set so it will show? Something like: ``` webBrowser1.DocumentStream = new MemoryStream(File.ReadAllBytes("mypic.jpg")); webBrowser1.DocumentType = "application/jpeg"; ``` ...
You have to implement an async pluggable protocol, e.g. IClassFactory, IInternetProtocol... Then you use CoInternetGetSession to register your protocol. When IE calls your implementation, you can serve your image data from memory/provide mime type. It's a bit tedious, but doable. Look at IInternetProtocol and pluggabl...
290,038
<p>In C++, is the return type considered part of the function signature? and no overloading is allowed with just return type modified.</p>
[ { "answer_id": 290048, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 8, "selected": true, "text": "<p>Normal functions do not include the return type in their signature.</p>\n<p><sub>(<em>note</em>: i've rew...
2008/11/14
[ "https://Stackoverflow.com/questions/290038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
In C++, is the return type considered part of the function signature? and no overloading is allowed with just return type modified.
Normal functions do not include the return type in their signature. (*note*: i've rewritten this answer, and the comments below don't apply to this revision - see the edit-history for details). ### Introduction However, the matter about functions and function declarations in the Standard is complicated. There are tw...
290,043
<p>I’m trying to make the routing module works with default action or controller, but it doesn’t. I always face with 404 page not found. Did I forget to do something? I really like routing in ASP.NET MVC feature, but I’m not sure I could do the same in MR. I’m using IIS7 with the build from castle trunk for .NET 3.5.</...
[ { "answer_id": 290081, "author": "jishi", "author_id": 33663, "author_profile": "https://Stackoverflow.com/users/33663", "pm_score": 1, "selected": false, "text": "<p>How are you configuring the routing? I had issues myself when trying to manage the routing-rules from web.config, but mov...
2008/11/14
[ "https://Stackoverflow.com/questions/290043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35719/" ]
I’m trying to make the routing module works with default action or controller, but it doesn’t. I always face with 404 page not found. Did I forget to do something? I really like routing in ASP.NET MVC feature, but I’m not sure I could do the same in MR. I’m using IIS7 with the build from castle trunk for .NET 3.5.
If you're on IIS7, you need the routing module registration in the system.webServer/httpModules node. The system.web/httpHandlers and httpModules are AFAIK ignored by IIS7. MonoRail routing definitely works; we have it up and running happily. Here're config and global.asax.cs snippets: ``` <system.web> <auth...
290,049
<p>Can this be done without MVC? Is there an easy way to abstract or encapsulate navigational logic? </p> <p>I currently have quite a lot of the following in my code behinds (and I know it's probably not the best thing to be doing):</p> <pre><code>protected void btnNext_Click(object sender, EventArgs e) { ... ...
[ { "answer_id": 290103, "author": "Andrew Van Slaars", "author_id": 8087, "author_profile": "https://Stackoverflow.com/users/8087", "pm_score": 3, "selected": true, "text": "<p>You may want to consider using the Web.sitemap file to hold your navigation information.</p>\n\n<p>You could als...
2008/11/14
[ "https://Stackoverflow.com/questions/290049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15613/" ]
Can this be done without MVC? Is there an easy way to abstract or encapsulate navigational logic? I currently have quite a lot of the following in my code behinds (and I know it's probably not the best thing to be doing): ``` protected void btnNext_Click(object sender, EventArgs e) { ... if (condition1) { ...
You may want to consider using the Web.sitemap file to hold your navigation information. You could also look into the Routing library that was built for MVC in one of the previews, they split those classes off into the System.Web.Routing namespace and from what I've heard, it can be used with WebForms now. I'm not sur...
290,061
<p>I just came over this syntax in some of the questions in this forum, but Google and any other searchengine tends to block out anything but letters and number in the search so it is impossible to search out "=>".</p> <p>So can anyone tell me what it is and how it is used? </p>
[ { "answer_id": 290063, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "<p>It's the lambda operator.</p>\n\n<p>From C# 3 to C# 5, this was only used for <a href=\"http://msdn.microsoft.com/en-u...
2008/11/14
[ "https://Stackoverflow.com/questions/290061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37643/" ]
I just came over this syntax in some of the questions in this forum, but Google and any other searchengine tends to block out anything but letters and number in the search so it is impossible to search out "=>". So can anyone tell me what it is and how it is used?
It's the lambda operator. From C# 3 to C# 5, this was only used for [lambda expressions](http://msdn.microsoft.com/en-us/library/bb397687.aspx). These are basically a shorter form of the [anonymous methods](http://msdn.microsoft.com/en-us/library/0yw3tz5k.aspx) introduced in C# 2, but can also be converted into [expre...
290,087
<p>I'm trying to build a method that will receive a Linq table, and should return a List&lt;> of values that will be a DropDownList Datasource.</p> <p>This is what I've got till now:</p> <pre><code>public static List&lt;Structs.NameValuePair&gt; GenDropDownItens&lt;T&gt;(string ValueField , string TextField ) where T...
[ { "answer_id": 290127, "author": "Daniel M", "author_id": 36559, "author_profile": "https://Stackoverflow.com/users/36559", "pm_score": 0, "selected": false, "text": "<p>Table.Select( t => t.field1, t.field2 )</p>\n\n<p>Also check out Scott Gutherie's blog series <a href=\"http://weblogs...
2008/11/14
[ "https://Stackoverflow.com/questions/290087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32415/" ]
I'm trying to build a method that will receive a Linq table, and should return a List<> of values that will be a DropDownList Datasource. This is what I've got till now: ``` public static List<Structs.NameValuePair> GenDropDownItens<T>(string ValueField , string TextField ) where T: class ``` What i don't know how ...
Project the result of your LINQ2SQL query into a System.Collections.Generic.KeyValuePair object like so: ``` ddl.DataSource = DataContext.Table.Select(o => new KeyValuePair<string, string>(o.ID, o.DisplayField)); ddl.DataBind(); ``` You will then want to set the DataValueField and DataTextField attributes on the Dr...
290,090
<p>I'm a bit new to jQuery and hope somebody can help me out.</p> <p>I'm trying to change an element (li) to another element (div) after the (li) has been dropped.</p> <p>Sample code:</p> <pre><code>$("#inputEl&gt;li").draggable({ revert: true, opacity: 0.4, helper: "clone" }); $("#dropEl") .droppa...
[ { "answer_id": 290555, "author": "Ben Koehler", "author_id": 11996, "author_profile": "https://Stackoverflow.com/users/11996", "pm_score": 2, "selected": false, "text": "<p>So, what you want is to keep your original list intact and drop list items into dropEl?\nHow about this:</p>\n\n<pr...
2008/11/14
[ "https://Stackoverflow.com/questions/290090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37667/" ]
I'm a bit new to jQuery and hope somebody can help me out. I'm trying to change an element (li) to another element (div) after the (li) has been dropped. Sample code: ``` $("#inputEl>li").draggable({ revert: true, opacity: 0.4, helper: "clone" }); $("#dropEl") .droppable({ accept: ".drag",...
So, what you want is to keep your original list intact and drop list items into dropEl? How about this: ``` drop: function(ev,ui) { $(this).append("<div>Some content</div>"); } ``` Or, if you want to replace the list elements with a div element and also have the div element draggable, you could try this: ``` d...
290,112
<p>I have a Panel and I am adding controls inside this panel. But there is a specific control that I would like to float. How would I go about doing that?</p> <p>pnlOverheadDetails is the panel name</p> <pre><code>pnlOverheadDetails.Controls.Add(lnkCalcOverhead); </code></pre> <p>The control named lnkCalcOverhead i...
[ { "answer_id": 290131, "author": "Jeromy Irvine", "author_id": 8223, "author_profile": "https://Stackoverflow.com/users/8223", "pm_score": 6, "selected": true, "text": "<p>If you have a CSS class defined for the control, you could do this before calling the <code>Controls.Add</code> meth...
2008/11/14
[ "https://Stackoverflow.com/questions/290112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4144/" ]
I have a Panel and I am adding controls inside this panel. But there is a specific control that I would like to float. How would I go about doing that? pnlOverheadDetails is the panel name ``` pnlOverheadDetails.Controls.Add(lnkCalcOverhead); ``` The control named lnkCalcOverhead is the control I'd like to float. ...
If you have a CSS class defined for the control, you could do this before calling the `Controls.Add` method: ``` lnkCalcOverhead.CssClass = "MyClass"; ``` If you want to use the style attribute directly, try this: ``` lnkCalcOverhead.Style.Add("float", "left"); ```
290,116
<p>I'm trying to create number of Evenement instances and set the date for them:</p> <pre><code> for (int i=2004; i&lt;2009; i++){ evenementen.add(new Evenement("Rock Werchter", "Rock", "Werchter", 200000, (Date)formatter.parse(i+"/07/03"))); </code></pre> <p>But I can't seem t...
[ { "answer_id": 290143, "author": "Powerlord", "author_id": 15880, "author_profile": "https://Stackoverflow.com/users/15880", "pm_score": 2, "selected": false, "text": "<p>You may want to use Calendar to create your dates.</p>\n\n<pre><code>for (int i=2004; i&lt;2009; i++) {\n Calendar...
2008/11/14
[ "https://Stackoverflow.com/questions/290116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to create number of Evenement instances and set the date for them: ``` for (int i=2004; i<2009; i++){ evenementen.add(new Evenement("Rock Werchter", "Rock", "Werchter", 200000, (Date)formatter.parse(i+"/07/03"))); ``` But I can't seem to get it to work, Any ideas?
You may want to use Calendar to create your dates. ``` for (int i=2004; i<2009; i++) { Calendar cal = Calendar.getInstance(); cal.clear(); // Calendar.JULY may be different depending on the JDK language cal.set(i, Calendar.JULY, 3); // Alternatively, cal.set(i, 6, 3); evenementen.add(new Evenement...
290,121
<p>My website has been giving me intermittent errors when trying to perform <em>any</em> Ajax activities. The message I get is</p> <pre><code>Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by...
[ { "answer_id": 290135, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 6, "selected": true, "text": "<p>There is an excellent blog entry by Eilon Lipton. It contains of lot of tips on how to avoid this error:</p>\n\n<p><stron...
2008/11/14
[ "https://Stackoverflow.com/questions/290121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2995/" ]
My website has been giving me intermittent errors when trying to perform *any* Ajax activities. The message I get is ``` Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Wri...
There is an excellent blog entry by Eilon Lipton. It contains of lot of tips on how to avoid this error: **[Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it](http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-...
290,133
<p>Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly we do not have any Perl skills in-house. This is what happens when Marketing people circumvent their in-house IT team!<...
[ { "answer_id": 290145, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 2, "selected": false, "text": "<p>This isn't so much a Perl question as it's a database question, and there is no good way to know how many results yo...
2008/11/14
[ "https://Stackoverflow.com/questions/290133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6898/" ]
Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly we do not have any Perl skills in-house. This is what happens when Marketing people circumvent their in-house IT team! I ...
A really simple way would be: ``` $sth->execute(); my $first = 1; while (my $ref = $sth->fetchrow_hashref()) { if( $first ) { print "We currently have the following vacancies:\n"; $first = 0; } my $temp = $template; ... } if( $first ) { print "No vacancies found\n"; } ```
290,163
<p>Does anyone know of a Java library that provides a useful abstraction for analyzing and manipulating arbitrary relational database schemata? I'm thinking of something that could do things like</p> <pre><code>LibraryClass dbLib = ...; DbSchema schema = dbLib.getSchema("my_schema"); List&lt;DbTable&gt; tables = schem...
[ { "answer_id": 290179, "author": "digitalsanctum", "author_id": 22436, "author_profile": "https://Stackoverflow.com/users/22436", "pm_score": 0, "selected": false, "text": "<p>I haven't used it in years but Hibernate used to have <a href=\"http://www.hibernate.org/255.html\" rel=\"nofoll...
2008/11/14
[ "https://Stackoverflow.com/questions/290163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7034/" ]
Does anyone know of a Java library that provides a useful abstraction for analyzing and manipulating arbitrary relational database schemata? I'm thinking of something that could do things like ``` LibraryClass dbLib = ...; DbSchema schema = dbLib.getSchema("my_schema"); List<DbTable> tables = schema.getTables(); ``` ...
[DdlUtils](http://db.apache.org/ddlutils/) has what you're looking for. You can read/write schemas to/from XML (in Torque format) or a live database, or even define the database schema in pure Java. Better yet, read the on-line doco, it's quite good.
290,187
<p>I have a script that takes a command and executes it on a remote host. It works fine, for example:</p> <pre><code>$ rexec "ant build_all" </code></pre> <p>will execute the "ant build_all" command on the remote system (passing it through SSH, etc).</p> <p>Because I'm lazy, I want to set up an alias for this comma...
[ { "answer_id": 290203, "author": "J.D. Fitz.Gerald", "author_id": 11542, "author_profile": "https://Stackoverflow.com/users/11542", "pm_score": 0, "selected": false, "text": "<p>You can do it as a function, not an alias:</p>\n\n<pre><code>function rant { rexec \"ant $1\"; }\n</code></pre...
2008/11/14
[ "https://Stackoverflow.com/questions/290187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16226/" ]
I have a script that takes a command and executes it on a remote host. It works fine, for example: ``` $ rexec "ant build_all" ``` will execute the "ant build\_all" command on the remote system (passing it through SSH, etc). Because I'm lazy, I want to set up an alias for this command (and ultimately, several other...
For all arguments, this will work. ``` function rant () { rexec "ant $*" } ``` You may need to adjust the quoting, depending on what arguments you're passing.
290,213
<p>When I serialize;</p> <pre><code>public class SpeedDial { public string Value { get; set; } public string TextTR { get; set; } public string TextEN { get; set; } public string IconId { get; set; } } </code></pre> <p>It results:</p> <pre><code>&lt;SpeedDial&gt; &lt;Value&gt;110&lt;/Value&gt; ...
[ { "answer_id": 290312, "author": "JSC", "author_id": 37311, "author_profile": "https://Stackoverflow.com/users/37311", "pm_score": 1, "selected": false, "text": "<p>I won't do it if I were you, because you make your serializer dependent of your business objects. For lowercase you could u...
2008/11/14
[ "https://Stackoverflow.com/questions/290213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35012/" ]
When I serialize; ``` public class SpeedDial { public string Value { get; set; } public string TextTR { get; set; } public string TextEN { get; set; } public string IconId { get; set; } } ``` It results: ``` <SpeedDial> <Value>110</Value> <TextTR>Yangın</TextTR> <TextEN>Fire</TextEN> ...
Three approaches leap to mind: 1: create a property to use for the serialization, and hide the others with `[XmlIgnore]` 2: implement `IXmlSerializable` and do it yourself 3: create a separate DTO just for the serialization Here's an example that re-factors the "text" portion into objects that `XmlSerializer` will li...
290,214
<p>Is it possible to retrieve variable set in <code>onreadystatechange</code> function from outside the function? <bR>--edit--<BR> Regarding execution of functions:<BR> If its possible i would like to execute ajaxFunction() with one click<BR> and then popup() with next click, or somehow wait for ajax function to end...
[ { "answer_id": 290217, "author": "Phil Jenkins", "author_id": 35496, "author_profile": "https://Stackoverflow.com/users/35496", "pm_score": 0, "selected": false, "text": "<p>Why not change <code>MyVariable</code>'s scope to outside of the function?</p>\n\n<pre><code>var MyVariable; \n...
2008/11/14
[ "https://Stackoverflow.com/questions/290214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27186/" ]
Is it possible to retrieve variable set in `onreadystatechange` function from outside the function? --edit-- Regarding execution of functions: If its possible i would like to execute ajaxFunction() with one click and then popup() with next click, or somehow wait for ajax function to end and then call for al...
The following code assumes that the ajax-request is synchronous: ``` function popup(){ ajaxFunction(); alert(MyVariable); } ``` But since synchronous requests are blocking the browser you should in almost all cases use asynchronous calls (If I remember correctly onreadystatechange should not be called on syn...
290,226
<p>I have a query that works on Postgresql 7.4 but not on Postgresql 8.3 with same database.</p> <p>Query:</p> <pre><code>SELECT * FROM login_session WHERE (now()-modified) &gt; timeout; </code></pre> <p>Gets the following error:</p> <pre><code>ERROR: operator does not exist: interval &gt; integer LINE 1: ...ELECT...
[ { "answer_id": 290419, "author": "Milen A. Radev", "author_id": 15785, "author_profile": "https://Stackoverflow.com/users/15785", "pm_score": 4, "selected": false, "text": "<p>There are a lot of changes between 7.4 and 8.3. Some of the most drastic were the removal of some automatic cast...
2008/11/14
[ "https://Stackoverflow.com/questions/290226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24595/" ]
I have a query that works on Postgresql 7.4 but not on Postgresql 8.3 with same database. Query: ``` SELECT * FROM login_session WHERE (now()-modified) > timeout; ``` Gets the following error: ``` ERROR: operator does not exist: interval > integer LINE 1: ...ELECT * FROM login_session WHERE (now()-modified) > tim...
``` create or replace function int2interval (x integer) returns interval as $$ select $1*'1 sec'::interval $$ language sql; create cast (integer as interval) with function int2interval (integer) as implicit; ``` ought to do it.
290,227
<p>What is the equivalent of Java's <code>System.currentTimeMillis()</code> in C#?</p>
[ { "answer_id": 290249, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 2, "selected": false, "text": "<p>The framework doesn't include the old seconds (or milliseconds) since 1970. The closest you get is DateTime.Ti...
2008/11/14
[ "https://Stackoverflow.com/questions/290227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
What is the equivalent of Java's `System.currentTimeMillis()` in C#?
An alternative: ``` private static readonly DateTime Jan1st1970 = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public static long CurrentTimeMillis() { return (long) (DateTime.UtcNow - Jan1st1970).TotalMilliseconds; } ```
290,238
<p>I'm trying to do something that gets a cs file in runtime from user make it meaningful to assembly get its properties, methods etc. </p> <p>Is there a way to do this by reflection in C#?</p>
[ { "answer_id": 290252, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>You can compile it reasonably easily using the <a href=\"http://msdn.microsoft.com/en-us/library/microsoft.csharp.csh...
2008/11/14
[ "https://Stackoverflow.com/questions/290238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4215/" ]
I'm trying to do something that gets a cs file in runtime from user make it meaningful to assembly get its properties, methods etc. Is there a way to do this by reflection in C#?
To compile a file on the fly you'll need to do something along these lines (where sourceCode is a string containg the code to compile): ``` CodeDomProvider codeProvider = new CSharpCodeProvider(); ICodeCompiler compiler = codeProvider.CreateCompiler(); // add compiler parameters CompilerParameters compilerParams = ne...
290,254
<p>Lets say I have a web app which has a page that may contain 4 script blocks - the script I write may be found in one of those blocks, but I do not know which one, that is handled by the controller. </p> <p>I bind some <code>onclick</code> events to a button, but I find that they sometimes execute in an order I did ...
[ { "answer_id": 290294, "author": "dowski", "author_id": 21712, "author_profile": "https://Stackoverflow.com/users/21712", "pm_score": 7, "selected": false, "text": "<p>If order is important you can create your own events and bind callbacks to fire when those events are triggered by other...
2008/11/14
[ "https://Stackoverflow.com/questions/290254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26188/" ]
Lets say I have a web app which has a page that may contain 4 script blocks - the script I write may be found in one of those blocks, but I do not know which one, that is handled by the controller. I bind some `onclick` events to a button, but I find that they sometimes execute in an order I did not expect. Is ther...
I had been trying for ages to generalize this kind of process, but in my case I was only concerned with the order of first event listener in the chain. If it's of any use, here is my jQuery plugin that binds an event listener that is always triggered before any others: \*\* *UPDATED inline with jQuery changes (thank...
290,285
<p>I have a module that sends an email to a specified email address but I want to default the email recipient to the portal administrator. How can I retrieve this information?</p>
[ { "answer_id": 290416, "author": "Douglas Anderson", "author_id": 5678, "author_profile": "https://Stackoverflow.com/users/5678", "pm_score": 2, "selected": false, "text": "<pre><code>' get the current portal\nDim portSettings As PortalSettings = PortalController.GetCurrentPortalSettings...
2008/11/14
[ "https://Stackoverflow.com/questions/290285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35165/" ]
I have a module that sends an email to a specified email address but I want to default the email recipient to the portal administrator. How can I retrieve this information?
If you are in the context of a control inheriting from `PortalModuleBase`, `PortalSettings` is available as a property, so it would just look like ``` PortalSettings.Email ```
290,287
<p>I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET</p> <p>Thanks!</p> <p>edit: Additional constraint: I ca...
[ { "answer_id": 290357, "author": "Douglas Anderson", "author_id": 5678, "author_profile": "https://Stackoverflow.com/users/5678", "pm_score": 3, "selected": true, "text": "<p>This is how I get the text out, I believe you can set set the selection range to a page, then you could test tha...
2008/11/14
[ "https://Stackoverflow.com/questions/290287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37685/" ]
I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET Thanks! edit: Additional constraint: I can't use any of the I...
This is how I get the text out, I believe you can set set the selection range to a page, then you could test that text, might be a little backwards from what you need but could be a place to start. ``` Microsoft.Office.Interop.Word.Application wordApplication = new Microsoft.Office.Interop.Word.Application(); object m...
290,296
<p>I'm working on a website that uses lots of png24 files, for transparency.</p> <p>I need to replace them with png8 files, as all the png fix style javascript workarounds for png24 cause IE6 to lock up randomly. </p> <p>See this link to get an idea of the symptoms IE6 displays - <a href="http://blogs.cozi.com/tech/2...
[ { "answer_id": 290356, "author": "Cheery", "author_id": 21711, "author_profile": "https://Stackoverflow.com/users/21711", "pm_score": 0, "selected": false, "text": "<p>Perhaps <a href=\"http://www.imagemagick.org/\" rel=\"nofollow noreferrer\">imagemagick</a> helps you out at converting ...
2008/11/14
[ "https://Stackoverflow.com/questions/290296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15479/" ]
I'm working on a website that uses lots of png24 files, for transparency. I need to replace them with png8 files, as all the png fix style javascript workarounds for png24 cause IE6 to lock up randomly. See this link to get an idea of the symptoms IE6 displays - <http://blogs.cozi.com/tech/2008/03/transparent-pngs-c...
The `file` utility on OSX can tell you the colour depth in a PNG file, e.g: ``` % file foo.png foo.png: PNG image data, 1514 x 1514, 8-bit grayscale, non-interlaced ```
290,297
<p>I have some content that i have to render as a excel file in browser. I was able to render a grid content to excel with the below code.</p> <pre><code> Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.xls"); Response.Charset = ""; Response.ContentType = "application/v...
[ { "answer_id": 290376, "author": "Wolf5", "author_id": 37643, "author_profile": "https://Stackoverflow.com/users/37643", "pm_score": 3, "selected": true, "text": "<p>I've been using the same kind of hacks to get grid data (html tagged) into excel.</p>\n\n<p>If it is HTML data you are wri...
2008/11/14
[ "https://Stackoverflow.com/questions/290297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20951/" ]
I have some content that i have to render as a excel file in browser. I was able to render a grid content to excel with the below code. ``` Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.xls"); Response.Charset = ""; Response.ContentType = "application/vnd.xls"; Sys...
I've been using the same kind of hacks to get grid data (html tagged) into excel. If it is HTML data you are writing there, just add <IMG SRC="MYFILENAME.JPG> into the HTML text where you want the images. What will happen, is that Excel will ask your server (asp.net app) for that file. You might have to add a full p...
290,305
<p>I have a problem trying to model a many-to-one relationship in NHibernate, where the object on the 'one' side has a unique constraint on a column. The problem is as follows:</p> <p>I have two tables, 'Person' and 'Country'. Each Person has one and only one Country associated with it. A Country can have many Persons...
[ { "answer_id": 291533, "author": "Sean Carpenter", "author_id": 729, "author_profile": "https://Stackoverflow.com/users/729", "pm_score": 3, "selected": false, "text": "<p>You need to assign a Country instance to the Country property of the Person instance (not just set the ID). Somethi...
2008/11/14
[ "https://Stackoverflow.com/questions/290305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a problem trying to model a many-to-one relationship in NHibernate, where the object on the 'one' side has a unique constraint on a column. The problem is as follows: I have two tables, 'Person' and 'Country'. Each Person has one and only one Country associated with it. A Country can have many Persons (really! ...
You need to assign a Country instance to the Country property of the Person instance (not just set the ID). Something like: ``` Person p = new Person(); p.Country = session.Load<Country>(countryId); session.Save(p); ``` Then NHibernate will know what to do. This will also not cause a DB hit to retrieve country, sin...
290,309
<p>I have SSRS Report being accessed from a Report Server. Is there any way I can give an error message of my own, if my report fails to open there? </p>
[ { "answer_id": 291533, "author": "Sean Carpenter", "author_id": 729, "author_profile": "https://Stackoverflow.com/users/729", "pm_score": 3, "selected": false, "text": "<p>You need to assign a Country instance to the Country property of the Person instance (not just set the ID). Somethi...
2008/11/14
[ "https://Stackoverflow.com/questions/290309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have SSRS Report being accessed from a Report Server. Is there any way I can give an error message of my own, if my report fails to open there?
You need to assign a Country instance to the Country property of the Person instance (not just set the ID). Something like: ``` Person p = new Person(); p.Country = session.Load<Country>(countryId); session.Save(p); ``` Then NHibernate will know what to do. This will also not cause a DB hit to retrieve country, sin...
290,313
<p>A few years ago I did a lot of work with CGI.pm. I'm evaluating using it again for a quick project. Can someone bring me up to speed on the current state of developing with CGI.pm in the "Web 2.0" world? What are the best libraries on CPAN to use with it? Are there clean ways to include jQuery, YUI, other CSS li...
[ { "answer_id": 290318, "author": "Adam Byrtek", "author_id": 36656, "author_profile": "https://Stackoverflow.com/users/36656", "pm_score": 2, "selected": false, "text": "<p>Consider using something more modern, for example <a href=\"http://www.catalystframework.org/\" rel=\"nofollow nore...
2008/11/14
[ "https://Stackoverflow.com/questions/290313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
A few years ago I did a lot of work with CGI.pm. I'm evaluating using it again for a quick project. Can someone bring me up to speed on the current state of developing with CGI.pm in the "Web 2.0" world? What are the best libraries on CPAN to use with it? Are there clean ways to include jQuery, YUI, other CSS libs, etc...
Personally, I'm no fan of Catalyst (too heavy for my taste) or Mason (mixing code and HTML is bad ju-ju), but I do quite well using CGI.pm for input[1], HTML::Template for output, and CGI::Ajax to provide AJAX functionality where called for. If you're looking at frameworks, you may also want to consider CGI::Applicati...
290,316
<p>I would like to search the bodies of all outlook items. I know how to do this for the four PIM items (Notes/Tasks/Appointments/Contacts). But the code is identical for all of them with the exception of casting the COM object to the specific item type (i.e., ContactItem, AppointmentItem, etc). Is there a parent cla...
[ { "answer_id": 290660, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 1, "selected": false, "text": "<p>Looking at the documentation, I don't see a class like you want.</p>\n\n<p>For Outlook 2007, the list of objects t...
2008/11/14
[ "https://Stackoverflow.com/questions/290316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24591/" ]
I would like to search the bodies of all outlook items. I know how to do this for the four PIM items (Notes/Tasks/Appointments/Contacts). But the code is identical for all of them with the exception of casting the COM object to the specific item type (i.e., ContactItem, AppointmentItem, etc). Is there a parent class fo...
Looking at the documentation, I don't see a class like you want. For Outlook 2007, the list of objects that can be in an Items collection is [here](http://msdn.microsoft.com/en-us/library/bb147566.aspx). It includes things like distribution lists that don't have a body, which makes what you want unlikely.
290,320
<p>I have a web server on port 80 and port 81. IE can connect to the server on either port. This worked fine until I installed an application with a file type (.TPJ) that had a MIME type of text/xml on the client PC. At that point IE no longer opened the web site, but offered to download a file <em>serverName.TPJ</em>....
[ { "answer_id": 290681, "author": "Wayne Johnston", "author_id": 37691, "author_profile": "https://Stackoverflow.com/users/37691", "pm_score": 2, "selected": false, "text": "<p>I found the answer. There is a left-over entry in the registry for the text/xml MIME type. It can be restored to...
2008/11/14
[ "https://Stackoverflow.com/questions/290320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37691/" ]
I have a web server on port 80 and port 81. IE can connect to the server on either port. This worked fine until I installed an application with a file type (.TPJ) that had a MIME type of text/xml on the client PC. At that point IE no longer opened the web site, but offered to download a file *serverName.TPJ*. The file ...
I found the answer. There is a left-over entry in the registry for the text/xml MIME type. It can be restored to the default value by re-registering the MSXML3.DLL. ``` regsvr32 msxml3.dll ```
290,322
<p>I'm trying to hide the "Title" field in a list. This doesn't seem to work:</p> <pre><code>SPList myList; ... SPField titleField = myList.Fields.GetField("Title"); //titleField.PushChangesToLists = true; &lt;-- doesn't seem to make a difference titleField.ShowInEditForm = false; titleField.ShowInDisplayForm = false;...
[ { "answer_id": 290350, "author": "Brian Liang", "author_id": 5853, "author_profile": "https://Stackoverflow.com/users/5853", "pm_score": 0, "selected": false, "text": "<p>Make sure you are grabbing a <em>new</em> SPWeb instance.</p>\n\n<pre><code>using (SPSite site = new SPSite(webUrl))\...
2008/11/14
[ "https://Stackoverflow.com/questions/290322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1287/" ]
I'm trying to hide the "Title" field in a list. This doesn't seem to work: ``` SPList myList; ... SPField titleField = myList.Fields.GetField("Title"); //titleField.PushChangesToLists = true; <-- doesn't seem to make a difference titleField.ShowInEditForm = false; titleField.ShowInDisplayForm = false; titleField.ShowI...
Try this: ``` field.Hidden = true; field.Update(); ```
290,326
<p>Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form:</p> <pre> &lt;element1> &lt;element2> someData &lt;/element2> &lt;/element1> </pre> <p>instead of:</p> <pre>&lt;element1>&lt;element2>someData&lt;/element2>&lt;/element1></pre> <p>If this i...
[ { "answer_id": 290501, "author": "Spencer Kormos", "author_id": 8528, "author_profile": "https://Stackoverflow.com/users/8528", "pm_score": 1, "selected": false, "text": "<p>If you're using the iterating method (XMLEventReader), can't you just attach a new line '\\n' character to the rel...
2008/11/14
[ "https://Stackoverflow.com/questions/290326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142/" ]
Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form: ``` <element1> <element2> someData </element2> </element1> ``` instead of: ``` <element1><element2>someData</element2></element1> ``` If this is not possible in woodstox, is there any other ...
Via the JDK: `transformer.setOutputProperty(OutputKeys.INDENT, "yes");`.
290,335
<p>I have a table cell, and I want a div within it to always be at the bottom left corner. The following works fine in IE and Safari, but Firefox is positioning the <code>div</code> absolutely on the page, not within the cell (code based on the solution solution <a href="https://stackoverflow.com/questions/104953/posi...
[ { "answer_id": 290371, "author": "Boris Smirnov", "author_id": 35513, "author_profile": "https://Stackoverflow.com/users/35513", "pm_score": 1, "selected": false, "text": "<p>See if this works for you. Not sure of the exact ature of the problem but it has something to do with using td wi...
2008/11/14
[ "https://Stackoverflow.com/questions/290335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96/" ]
I have a table cell, and I want a div within it to always be at the bottom left corner. The following works fine in IE and Safari, but Firefox is positioning the `div` absolutely on the page, not within the cell (code based on the solution solution [here](https://stackoverflow.com/questions/104953/position-an-html-elem...
According to the [W3C](http://www.w3.org/TR/CSS21/visuren.html#propdef-position), position:relative has no effect on table cells: > > "The effect of 'position:relative' on > table-row-group, table-header-group, > table-footer-group, table-row, > table-column-group, table-column, > table-cell, and table-caption el...
290,347
<p>I need to use sendmail from Macs in an office. At the moment, I can get it to work on the two development Macs (which I think is due to MAMP being installed and working), but getting it to go on the others seems to be a problem...</p> <p>I assume it's down to some config issue, and hope there's someway to fix it (w...
[ { "answer_id": 290381, "author": "Denis Hennessy", "author_id": 35958, "author_profile": "https://Stackoverflow.com/users/35958", "pm_score": 3, "selected": true, "text": "<p>Note that it's postfix that you have running on your mac, not sendmail.</p>\n\n<p>The problem is that the machine...
2008/11/14
[ "https://Stackoverflow.com/questions/290347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35961/" ]
I need to use sendmail from Macs in an office. At the moment, I can get it to work on the two development Macs (which I think is due to MAMP being installed and working), but getting it to go on the others seems to be a problem... I assume it's down to some config issue, and hope there's someway to fix it (without res...
Note that it's postfix that you have running on your mac, not sendmail. The problem is that the machine mx01.xxx.uk[212.x.x.134] is configured to block mail relaying (accepting an email over SMTP and sending it on to the final mail server). The postfix configuration files are normally stored in /etc/postfix so you cou...
290,368
<p>How can I go through all external links in a div with javascript, adding (or appending) a class and alt-text?</p> <p>I guess I need to fetch all objects inside the div element, then check if each object is a , and check if the href attributen starts with http(s):// (should then be an external link), then add conten...
[ { "answer_id": 290445, "author": "Josh", "author_id": 2204759, "author_profile": "https://Stackoverflow.com/users/2204759", "pm_score": 0, "selected": false, "text": "<p>This can be accomplished pretty easily with <a href=\"http://www.jquery.com\" rel=\"nofollow noreferrer\">Jquery</a>. ...
2008/11/14
[ "https://Stackoverflow.com/questions/290368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I go through all external links in a div with javascript, adding (or appending) a class and alt-text? I guess I need to fetch all objects inside the div element, then check if each object is a , and check if the href attributen starts with http(s):// (should then be an external link), then add content to the a...
This one is tested: ``` <style type="text/css"> .AddedClass { background-color: #88FF99; } </style> <script type="text/javascript"> window.onload = function () { var re = /^(https?:\/\/[^\/]+).*$/; var currentHref = window.location.href.replace(re, '$1'); var reLocal = new RegExp('^' + currentHref.replace(/\./...
290,386
<p>Has anyone seen this type of IE display problem?</p> <p><a href="http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg" rel="nofollow noreferrer">Example http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg</a></p> <p>Note that it is doing some sort of word-wrap/duplication when it renders.</p> <p>The code f...
[ { "answer_id": 290407, "author": "Boris Smirnov", "author_id": 35513, "author_profile": "https://Stackoverflow.com/users/35513", "pm_score": 2, "selected": false, "text": "<p>There is a number of ways to do this. </p>\n\n<p>On jquery.com it is part of background image applied the body ta...
2008/11/14
[ "https://Stackoverflow.com/questions/290386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16437/" ]
Has anyone seen this type of IE display problem? [Example http://xs133.xs.to/xs133/08465/ie\_problem910.jpg.xs.jpg](http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg) Note that it is doing some sort of word-wrap/duplication when it renders. The code for the brown box and the text that should be in it is: ``...
There is a number of ways to do this. On jquery.com it is part of background image applied the body tag. You can have a header section which has background aligned to the bottom as an image and bottom padding that prevents text/content from overlaying that part. Finally you could use thick border if you want to jus...
290,397
<p>I have a list of articles, and each article belongs to a section.</p> <pre><code>class Section(models.Model): name = models.CharField(max_length=200) def __unicode__(self): return self.name class Article(models.Model): section = models.ForeignKey(Section) headline = models.CharField(max_length=200) ...
[ { "answer_id": 290414, "author": "Jeb", "author_id": 31830, "author_profile": "https://Stackoverflow.com/users/31830", "pm_score": -1, "selected": false, "text": "<p>I think you can use forloop.parentloop.counter inside of the inner loop to achieve the numbering you're after.</p>\n" },...
2008/11/14
[ "https://Stackoverflow.com/questions/290397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437/" ]
I have a list of articles, and each article belongs to a section. ``` class Section(models.Model): name = models.CharField(max_length=200) def __unicode__(self): return self.name class Article(models.Model): section = models.ForeignKey(Section) headline = models.CharField(max_length=200) # ... ``` I ...
Following Jeb's suggeston in a comment, I created a [custom template tag](http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags). I replaced `{{ forloop.counter }}` with `{% counter %}`, a tag that simply prints how many times it's been called. Here's the code for my counter ta...
290,402
<p>Out of curiosity, anyone knows the particulars of the internal implementation of </p> <pre><code>ListControl.SelectedIndex = (int) &lt;new valueIndex&gt; </code></pre> <p>VS </p> <pre><code>ListControl.SelectedValue = &lt;new value&gt;.ToString() </code></pre> <p>I'm having difficulties with a custom validation ...
[ { "answer_id": 290414, "author": "Jeb", "author_id": 31830, "author_profile": "https://Stackoverflow.com/users/31830", "pm_score": -1, "selected": false, "text": "<p>I think you can use forloop.parentloop.counter inside of the inner loop to achieve the numbering you're after.</p>\n" },...
2008/11/14
[ "https://Stackoverflow.com/questions/290402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3403/" ]
Out of curiosity, anyone knows the particulars of the internal implementation of ``` ListControl.SelectedIndex = (int) <new valueIndex> ``` VS ``` ListControl.SelectedValue = <new value>.ToString() ``` I'm having difficulties with a custom validation object we've built here to process all validation in one swee...
Following Jeb's suggeston in a comment, I created a [custom template tag](http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags). I replaced `{{ forloop.counter }}` with `{% counter %}`, a tag that simply prints how many times it's been called. Here's the code for my counter ta...
290,424
<p>I would want to do something like:</p> <pre><code>&gt;&gt;&gt; lst = [1, 2, 3, 4, 5] &gt;&gt;&gt; lst.find(lambda x: x % 2 == 0) 2 &gt;&gt;&gt; lst.findall(lambda x: x % 2 == 0) [2, 4] </code></pre> <p>Is there anything nearing such behavior in Python's standard libraries?</p> <p>I know it's very easy to roll-you...
[ { "answer_id": 290440, "author": "John Montgomery", "author_id": 5868, "author_profile": "https://Stackoverflow.com/users/5868", "pm_score": 8, "selected": true, "text": "<p>You can use the filter method:</p>\n\n<pre><code>&gt;&gt;&gt; lst = [1, 2, 3, 4, 5]\n&gt;&gt;&gt; filter(lambda x:...
2008/11/14
[ "https://Stackoverflow.com/questions/290424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8206/" ]
I would want to do something like: ``` >>> lst = [1, 2, 3, 4, 5] >>> lst.find(lambda x: x % 2 == 0) 2 >>> lst.findall(lambda x: x % 2 == 0) [2, 4] ``` Is there anything nearing such behavior in Python's standard libraries? I know it's very easy to roll-your-own here, but I'm looking for a more standard way.
You can use the filter method: ``` >>> lst = [1, 2, 3, 4, 5] >>> filter(lambda x: x % 2 == 0, lst) [2, 4] ``` or a list comprehension: ``` >>> lst = [1, 2, 3, 4, 5] >>> [x for x in lst if x %2 == 0] [2, 4] ``` to find a single element, you could try: ``` >>> next(x for x in lst if x % 2 == 0) 2 ``` Though that...
290,436
<p>Presently I have a some legacy code, which generates the op code. If the code has more number of macros then the code generation takes so much of time (In terms of hours!!). I have gone through the logic, they are handling the macro by searching for it and doing a replace of each variable in it some thing like inlin...
[ { "answer_id": 290512, "author": "Vinay", "author_id": 28641, "author_profile": "https://Stackoverflow.com/users/28641", "pm_score": 0, "selected": false, "text": "<p>I have an application which has its own grammer. It supports all types of datatypes that a typical compiler supports (Eve...
2008/11/14
[ "https://Stackoverflow.com/questions/290436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28641/" ]
Presently I have a some legacy code, which generates the op code. If the code has more number of macros then the code generation takes so much of time (In terms of hours!!). I have gone through the logic, they are handling the macro by searching for it and doing a replace of each variable in it some thing like inlining...
You **must** tokenize your input before starting this kind of process. (I can't recommend the famous [Dragon Book](http://en.wikipedia.org/wiki/21st_Century_Compilers) highly enough - even the ancient edition stood the test of time, the updated 2006 version looks great). Compiling is the sort of job that's best split u...
290,449
<p>Hello I was writing a Regular Expression (first time in my life I might add) but I just can't figure out how to do what I want. So far, so good since I already allow only Letters and spaces (as long as it's not the first character) now what I'm missing is that I don't want to allow any numbers in between the charact...
[ { "answer_id": 290472, "author": "Graeme Perrow", "author_id": 1821, "author_profile": "https://Stackoverflow.com/users/1821", "pm_score": 1, "selected": false, "text": "<p>If you only want to allow letters and spaces, then what you have is almost correct:</p>\n\n<pre><code>/^[a-zA-Z][\\...
2008/11/14
[ "https://Stackoverflow.com/questions/290449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28586/" ]
Hello I was writing a Regular Expression (first time in my life I might add) but I just can't figure out how to do what I want. So far, so good since I already allow only Letters and spaces (as long as it's not the first character) now what I'm missing is that I don't want to allow any numbers in between the characters...
OK, what you need is: ``` /^[a-zA-Z][\sa-zA-Z]*$/ ``` This matches: ``` ^ - start of line [a-zA-Z] - any letter [\sa-zA-Z]* - zero or more letters or spaces $ - the end of the line ``` If you want to ensure that it also ends in a letter then put another ``` [a-zA-Z] ``` before the `$`. N...
290,459
<p>I am reworking some ui in an application written by freelance .Net developers from another country. </p> <p>I am not going to go into how bad the code is and entangled the code with structure content and presentation are... </p> <p>But one of the things I notice is that menu for accessing the parts of the app is ...
[ { "answer_id": 290486, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>A LinkButton is just that--an anchor tag with javascript that submits the page's form. If you don't want that behavior, do...
2008/11/14
[ "https://Stackoverflow.com/questions/290459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35513/" ]
I am reworking some ui in an application written by freelance .Net developers from another country. I am not going to go into how bad the code is and entangled the code with structure content and presentation are... But one of the things I notice is that menu for accessing the parts of the app is made with Button c...
You could re-style the buttons to look like links, then you can maintain any server-side code, and not have to rely on javascript like the LinkButton does. ``` .linkButton { background-color: transparent; border-style: none; color: /* Something nice */ cursor: pointer; text-align: left; text-decorati...
290,465
<p>Does anyone know of a way to paste over a visually selected area without having the selection placed in the default register?</p> <p>I know I can solve the problem by always pasting from an explicit register. But it's a pain in the neck to type <kbd>"</kbd><kbd>x</kbd><kbd>p</kbd> instead of just <kbd>p</kbd></p>
[ { "answer_id": 290543, "author": "Gowri", "author_id": 3253, "author_profile": "https://Stackoverflow.com/users/3253", "pm_score": -1, "selected": false, "text": "<p>try -</p>\n\n<pre><code>:set guioptions-=a\n:set guioptions-=A\n</code></pre>\n" }, { "answer_id": 290723, "au...
2008/11/14
[ "https://Stackoverflow.com/questions/290465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37708/" ]
Does anyone know of a way to paste over a visually selected area without having the selection placed in the default register? I know I can solve the problem by always pasting from an explicit register. But it's a pain in the neck to type `"``x``p` instead of just `p`
`"{register}p` won't work as you describe. It will replace the selection with the content of the register. You will have instead to do something like: ``` " I haven't found how to hide this function (yet) function! RestoreRegister() let @" = s:restore_reg return '' endfunction function! s:Repl() let s:restore...
290,484
<p>I am writing a silly little app in C++ to test one of my libraries. I would like the app to display a list of commands to the user, allow the user to type a command, and then execute the action associated with that command. Sounds simple enough. In C# I would end up writing a list/map of commands like so:</p> <pre>...
[ { "answer_id": 290516, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": true, "text": "<p>A very common technique is to use function pointers, or boost::function, indexed by the item name, or by ...
2008/11/14
[ "https://Stackoverflow.com/questions/290484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21704/" ]
I am writing a silly little app in C++ to test one of my libraries. I would like the app to display a list of commands to the user, allow the user to type a command, and then execute the action associated with that command. Sounds simple enough. In C# I would end up writing a list/map of commands like so: ``` clas...
A very common technique is to use function pointers, or boost::function, indexed by the item name, or by having a vector of them and indexing by the item index for this job. Simple example using the item name: ``` void exit_me(); /* exits the program */ void help(); /* displays help */ std::map< std::string, boost::f...
290,488
<p>This isn't my code; I am trying to figure out what exactly this does. This is a part of a big, ancient system written in C (actually it was written 4 years ago, but most likely written by a late 80s programmer mentality). Part of the code:</p> <pre><code>char DestFile[256]; char DestFile2[256]; //This part is just...
[ { "answer_id": 290521, "author": "Soraz", "author_id": 24610, "author_profile": "https://Stackoverflow.com/users/24610", "pm_score": 5, "selected": true, "text": "<p>You are correct.</p>\n\n<p>In C a string is an array of chars terminated by a character with ASCII code 0.</p>\n\n<p>So, f...
2008/11/14
[ "https://Stackoverflow.com/questions/290488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34395/" ]
This isn't my code; I am trying to figure out what exactly this does. This is a part of a big, ancient system written in C (actually it was written 4 years ago, but most likely written by a late 80s programmer mentality). Part of the code: ``` char DestFile[256]; char DestFile2[256]; //This part is just to show an ex...
You are correct. In C a string is an array of chars terminated by a character with ASCII code 0. So, first, DestFile is copied to DestFile2 Then a scan from the right is performed, to find the right-most occurrence of '.' This returns a pointer to the char that matches, or null if no occurrence is found. So now you...
290,503
<p>Let's say you got a file containing texts (from 1 to N) separated by a $ How can a slit the file so the end result is N files? </p> <blockquote> <p>text1 with newlines $<br> text2 $etc... $<br> textN</p> </blockquote> <p>I'm thinking something with awk or sed but is there any available unix app that already...
[ { "answer_id": 290519, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 3, "selected": true, "text": "<p>Maybe <code>split -p</code> <em>pattern</em>?</p>\n\n<p>Hmm. That may not be exactly what you want. It doesn't spli...
2008/11/14
[ "https://Stackoverflow.com/questions/290503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23051/" ]
Let's say you got a file containing texts (from 1 to N) separated by a $ How can a slit the file so the end result is N files? > > text1 with newlines $ > > text2 $etc... $ > > textN > > > I'm thinking something with awk or sed but is there any available unix app that already perform that kind of task?
Maybe `split -p` *pattern*? Hmm. That may not be exactly what you want. It doesn't split a line, it only starts a new file when it sees the pattern. And it seems to be supported only on BSD-related systems. You could use something like: ``` awk 'BEGIN {RS = "$"} { ... }' ``` **edit:** You might find some inspirati...
290,513
<p>I need an regular expression pattern to only accept positive whole numbers. It can also accept a single zero.</p> <p>I do not want to accept decimals, negative number and numbers with leading zeros.</p> <p>Any suggestions?</p>
[ { "answer_id": 290530, "author": "3Doubloons", "author_id": 25818, "author_profile": "https://Stackoverflow.com/users/25818", "pm_score": 3, "selected": false, "text": "<pre><code>/([1-9][0-9]*)|0/\n</code></pre>\n" }, { "answer_id": 290531, "author": "Robert Gamble", "au...
2008/11/14
[ "https://Stackoverflow.com/questions/290513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
I need an regular expression pattern to only accept positive whole numbers. It can also accept a single zero. I do not want to accept decimals, negative number and numbers with leading zeros. Any suggestions?
``` ^(0|[1-9][0-9]*)$ ```
290,523
<p>What im wondering how to do is when someone edits a list item and it goes through my event code that is fired when a change is made and save is hit, i dont want anyone to be able to edit that list item itself while its still processnig that request. So i was wondering if while in that event i can disable the individ...
[ { "answer_id": 293109, "author": "Bjørn Furuknap", "author_id": 28382, "author_profile": "https://Stackoverflow.com/users/28382", "pm_score": 3, "selected": true, "text": "<p>Not sure if I understand exactly what you are want.</p>\n\n<p>Try adding a field, hidden if you like, to the list...
2008/11/14
[ "https://Stackoverflow.com/questions/290523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18431/" ]
What im wondering how to do is when someone edits a list item and it goes through my event code that is fired when a change is made and save is hit, i dont want anyone to be able to edit that list item itself while its still processnig that request. So i was wondering if while in that event i can disable the individual...
Not sure if I understand exactly what you are want. Try adding a field, hidden if you like, to the list or content type to use as a flag. When you enter your event code, make sure you check the flag first and if not set, set it and do your stuff. After you have done your stuff, unset the flag. Here is some code to i...
290,527
<p>Similar to <a href="https://stackoverflow.com/questions/288794/does-c-optimize-the-concatenation-of-string-literals">this</a> question, but for VB.NET since I learned this is a language thing.</p> <p>For instance, would the compiler know to translate</p> <blockquote> <p>Dim s As String = "test " + "this " + "f...
[ { "answer_id": 290541, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>While I'm looking it up, <a href=\"http://www.microsoft.com/downloads/details.aspx?FamilyID=39DE1DD0-F775-40BF-A191-0...
2008/11/14
[ "https://Stackoverflow.com/questions/290527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
Similar to [this](https://stackoverflow.com/questions/288794/does-c-optimize-the-concatenation-of-string-literals) question, but for VB.NET since I learned this is a language thing. For instance, would the compiler know to translate > > Dim s As String = "test " + "this " + > "function" > > > to ``` Dim s As S...
Yes. It Does. I only tested VS 2008 but I strongly suspect previous versions did as well. VB.NET ``` Public Class Class1 Dim s As String = "test " + "this " + "function" Public Function test() As String Return s End Function End Class ``` I.L. - Notice the string "test this function" ``` { ...
290,535
<p>Using jQuery, what's the best way to find the next form element on the page, starting from an arbitrary element? When I say form element I mean <code>&lt;input&gt;</code>, <code>&lt;select&gt;</code>, <code>&lt;button&gt;</code> or <code>&lt;textarea&gt;</code>.</p> <p>In the following examples, the element with t...
[ { "answer_id": 290604, "author": "jckeyes", "author_id": 17881, "author_profile": "https://Stackoverflow.com/users/17881", "pm_score": 2, "selected": false, "text": "<p>You could give each form item an id (or unique class name) that identified it as a form element and also gave it an ind...
2008/11/14
[ "https://Stackoverflow.com/questions/290535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Using jQuery, what's the best way to find the next form element on the page, starting from an arbitrary element? When I say form element I mean `<input>`, `<select>`, `<button>` or `<textarea>`. In the following examples, the element with the id "this" is the arbitrary starting point, and the element with the id "next...
kudos, What about using .index? e.g `$(':input:eq(' + ($(':input').index(this) + 1) + ')');`
290,537
<p>I have a solution with many projects. There is actually a Core project and a few plugins. I changed OutputPath for all plugins so all binaries end up in the Core bin\debug folder. (this is necessary as the Core do not have a reference on plugins, hence it does not "include" plugins binaries when it is compiled.)</p>...
[ { "answer_id": 290568, "author": "Jeromy Irvine", "author_id": 8223, "author_profile": "https://Stackoverflow.com/users/8223", "pm_score": 2, "selected": false, "text": "<p>Rather than changing the output location of the plug-ins, what you could do is create a post-build script (Properti...
2008/11/14
[ "https://Stackoverflow.com/questions/290537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37706/" ]
I have a solution with many projects. There is actually a Core project and a few plugins. I changed OutputPath for all plugins so all binaries end up in the Core bin\debug folder. (this is necessary as the Core do not have a reference on plugins, hence it does not "include" plugins binaries when it is compiled.) So ba...
Rather than changing the output location of the plug-ins, what you could do is create a post-build script (Properties \ Build Events tab) for them that will copy the them to the Core folder. That would prevent the confusion with output folders. This command line should do the trick for you: ``` copy "$(TargetPath)" "...
290,545
<p>I am adapting a little rmi client-server application. I have written several things :</p> <pre><code>HelloInterface -&gt; A Hello World interface for RMI Server -&gt; The server app' Client -&gt; The client app' </code></pre> <p>Nothing special, but... I have put my hands in a new RMISecurityManager, which calls a...
[ { "answer_id": 291993, "author": "Greg Case", "author_id": 462, "author_profile": "https://Stackoverflow.com/users/462", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>IMHO the meaning of this is that a thread is (implicitly) created and gets the NativeRMISecurityManager as...
2008/11/14
[ "https://Stackoverflow.com/questions/290545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26465/" ]
I am adapting a little rmi client-server application. I have written several things : ``` HelloInterface -> A Hello World interface for RMI Server -> The server app' Client -> The client app' ``` Nothing special, but... I have put my hands in a new RMISecurityManager, which calls a JNI method and checks the permissi...
> > IMHO the meaning of this is that a thread is (implicitly) created and gets the NativeRMISecurityManager as its default SecurityManager. > > > This is true, though it is not the cause of your error; the problem has to do with the use of ThreadLocal. The key property of a ThreadLocal is that every calling thread...
290,548
<p>How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct.</p>
[ { "answer_id": 290558, "author": "stephbu", "author_id": 12702, "author_profile": "https://Stackoverflow.com/users/12702", "pm_score": 5, "selected": false, "text": "<p>Probably easiest way is to PInvoke LogonUser Win32 API.e.g.</p>\n\n<blockquote>\n <p><a href=\"http://www.pinvoke.net/...
2008/11/14
[ "https://Stackoverflow.com/questions/290548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct.
If you work on .NET 3.5 or newer, you can use the `System.DirectoryServices.AccountManagement` namespace and easily verify your credentials: ``` // create a "principal context" - e.g. your domain (could be machine, too) using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOURDOMAIN")) { // valida...
290,559
<p>I want to write a script that will stop a scheduled task on a remote computer, do some stuff, and then start the schedule task back up.</p> <p>How can I do it?</p>
[ { "answer_id": 290613, "author": "Mattias Andersson", "author_id": 32841, "author_profile": "https://Stackoverflow.com/users/32841", "pm_score": 3, "selected": false, "text": "<p><strong>Note:</strong>\n<a href=\"http://en.wikipedia.org/wiki/Schtasks\" rel=\"nofollow noreferrer\">\"schta...
2008/11/14
[ "https://Stackoverflow.com/questions/290559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32899/" ]
I want to write a script that will stop a scheduled task on a remote computer, do some stuff, and then start the schedule task back up. How can I do it?
Here's what I found. stop: ``` schtasks /end /s <machine name> /tn <task name> ``` start: ``` schtasks /run /s <machine name> /tn <task name> C:\>schtasks /? SCHTASKS /parameter [arguments] Description: Enables an administrator to create, delete, query, change, run and end scheduled tasks on a local or ...
290,590
<p>For both .NET Winforms and Windows Presentation Foundation, if I have a text box that the user has just entered text into, and a button, if the user clicks the button the "LostFocus" event fires before the button click event fires. However if the user uses a keyboard shortcut for the button (e.g. Button's text is "...
[ { "answer_id": 290661, "author": "Quibblesome", "author_id": 1143, "author_profile": "https://Stackoverflow.com/users/1143", "pm_score": 1, "selected": false, "text": "<p>What would happen if you did this first of all in the button handler? (or perhaps subclass the button and override On...
2008/11/14
[ "https://Stackoverflow.com/questions/290590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For both .NET Winforms and Windows Presentation Foundation, if I have a text box that the user has just entered text into, and a button, if the user clicks the button the "LostFocus" event fires before the button click event fires. However if the user uses a keyboard shortcut for the button (e.g. Button's text is "&But...
You could try tracking whether or not the lost focus logic has occured before firing the button logic. You shouldn't really have code directly in the handler anyway. You could do something like this: ``` public partial class Form1 : Form { private Boolean _didLostFocusLogic; public Form1() ...
290,596
<p>Sql server complaining about this IF NOT EXISTS statement, saying that there is 'incorrect syntax near the keyword 'OR'.</p> <p>My query:</p> <pre><code>IF NOT EXISTS ( (SELECT * FROM Users where userID = 1) OR (SELECT * FROM sales WHERE saleID = 1) ) ...
[ { "answer_id": 290611, "author": "Andy Lester", "author_id": 8454, "author_profile": "https://Stackoverflow.com/users/8454", "pm_score": 2, "selected": false, "text": "<p>you want IF NOT EXISTS ( SELECT... ) AND NOT EXISTS ( SELECT .... )</p>\n" }, { "answer_id": 290618, "aut...
2008/11/14
[ "https://Stackoverflow.com/questions/290596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Sql server complaining about this IF NOT EXISTS statement, saying that there is 'incorrect syntax near the keyword 'OR'. My query: ``` IF NOT EXISTS ( (SELECT * FROM Users where userID = 1) OR (SELECT * FROM sales WHERE saleID = 1) ) BEGIN // ...
try it this way instead ``` IF NOT EXISTS (SELECT 1 FROM Users where userID = 1) AND NOT EXISTS (SELECT 1 FROM sales WHERE saleID = 1) BEGIN -- blah blah blah END ``` or, if you insist on a disjunction: ``` IF NOT ( EXISTS (SELECT 1 FROM Users where userID = 1) OR EXISTS (SELECT 1...
290,610
<p>I have a table which has a field <code>sort_id</code>. In this field there are numbers from 1 to n, that define the order of the data sets. Now I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that "finds" the gaps and changes the <code>sort_id</code> field accordin...
[ { "answer_id": 290641, "author": "Mladen Prajdic", "author_id": 31345, "author_profile": "https://Stackoverflow.com/users/31345", "pm_score": 0, "selected": false, "text": "<p>for sql server 2005:\nthis is how you get the new sequence:</p>\n\n<pre><code>SELECT row_number() over(order by ...
2008/11/14
[ "https://Stackoverflow.com/questions/290610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35903/" ]
I have a table which has a field `sort_id`. In this field there are numbers from 1 to n, that define the order of the data sets. Now I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that "finds" the gaps and changes the `sort_id` field according to the modifications. ...
Mladen and Arvo have good ideas, but unfortunately in MySQL you can't `SELECT` and `UPDATE` the same table in the same statement (even in a subquery). This is a known limitation of MySQL. Here's a solution that uses MySQL user variables: ``` SET @i := 0; UPDATE mytable SET sort_id = (@i := @i + 1) ORDER BY sort_id; ...
290,632
<p><strong>Original Question</strong></p> <p>I am writting a logging class where the goal is to be able to do this:</p> <pre><code>// thread one Logger() &lt;&lt; "Some string" &lt;&lt; std::ios::hex &lt;&lt; 45; // thread two Logger() &lt;&lt; L"Some wide string" &lt;&lt; std::endl; </code></pre> <p>Currently my Lo...
[ { "answer_id": 290644, "author": "Lodle", "author_id": 23339, "author_profile": "https://Stackoverflow.com/users/23339", "pm_score": 0, "selected": false, "text": "<p>why not do it the printf way and use the multi parameter method (with the three dots ...). This still gives you alot of f...
2008/11/14
[ "https://Stackoverflow.com/questions/290632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19476/" ]
**Original Question** I am writting a logging class where the goal is to be able to do this: ``` // thread one Logger() << "Some string" << std::ios::hex << 45; // thread two Logger() << L"Some wide string" << std::endl; ``` Currently my Logger header looks something like this: ``` #pragma once; #include <ostream>...
You can use friend definition, which will define the operator in the surrounding namespace of the class, and make it only visible to operator overloading resolution (not callable manually using the ::operator<<... syntax): ``` class Logger { public: Logger(); ~Logger(); std::ostream* out_stream; temp...
290,652
<p>My stored procedure has an output parameter:</p> <pre><code>@ID INT OUT </code></pre> <p>How can I retrieve this using ado.net?</p> <pre><code>using (SqlConnection conn = new SqlConnection(...)) { SqlCommand cmd = new SqlCommand("sproc", conn); cmd.CommandType = CommandType.StoredProcedure; // add pa...
[ { "answer_id": 290676, "author": "WACM161", "author_id": 12255, "author_profile": "https://Stackoverflow.com/users/12255", "pm_score": 5, "selected": false, "text": "<p>Not my code, but a good example i think</p>\n\n<p>source: <a href=\"http://www.eggheadcafe.com/PrintSearchContent.asp?L...
2008/11/14
[ "https://Stackoverflow.com/questions/290652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My stored procedure has an output parameter: ``` @ID INT OUT ``` How can I retrieve this using ado.net? ``` using (SqlConnection conn = new SqlConnection(...)) { SqlCommand cmd = new SqlCommand("sproc", conn); cmd.CommandType = CommandType.StoredProcedure; // add parameters conn.Open(); // **...
The other response shows this, but essentially you just need to create a `SqlParameter`, set the `Direction` to `Output`, and add it to the `SqlCommand`'s `Parameters` collection. Then execute the stored procedure and get the value of the parameter. Using your code sample: ``` // SqlConnection and SqlCommand are IDis...
290,668
<p>If I simply wrap my query with:</p> <pre><code>BEGIN TRANSACTION COMMIT TRANSACTION </code></pre> <p>If anything fails inside of that, will it automatically rollback?</p> <p>From looking at other code, they seem to check for an error, if there is an error then they do a GOTO statement which then calls ROLLBACK...
[ { "answer_id": 290684, "author": "Nathan Feger", "author_id": 8563, "author_profile": "https://Stackoverflow.com/users/8563", "pm_score": 2, "selected": false, "text": "<p>yes it is important to explicitly rollback the transaction in the case that it does not work. </p>\n\n<p>I usually...
2008/11/14
[ "https://Stackoverflow.com/questions/290668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If I simply wrap my query with: ``` BEGIN TRANSACTION COMMIT TRANSACTION ``` If anything fails inside of that, will it automatically rollback? From looking at other code, they seem to check for an error, if there is an error then they do a GOTO statement which then calls ROLLBACK TRANSACTION But that seems like a...
I typically do something like this inside my stored procedures. It keeps things nice and safe and passes along any errors that I encounter. ``` SET XACT_ABORT ON; BEGIN TRY BEGIN TRANSACTION; -- Code goes here COMMIT TRANSACTION; END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION; ...
290,679
<p>Over the years, I think I have seen and tried every conceivable way of generating stub data structures (fake data) for complex object graphs. It always gets hairy in java.</p> <pre><code> * * * * A---B----C----D----E </code></pre> <p>(Pardon cheap UML) </p> <p>The key issue is that there are certain re...
[ { "answer_id": 292064, "author": "Ted Naleid", "author_id": 8912, "author_profile": "https://Stackoverflow.com/users/8912", "pm_score": 3, "selected": true, "text": "<p>You might find the <a href=\"http://martinfowler.com/bliki/ObjectMother.html\" rel=\"nofollow noreferrer\">Object Mothe...
2008/11/14
[ "https://Stackoverflow.com/questions/290679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
Over the years, I think I have seen and tried every conceivable way of generating stub data structures (fake data) for complex object graphs. It always gets hairy in java. ``` * * * * A---B----C----D----E ``` (Pardon cheap UML) The key issue is that there are certain relationships between the values, s...
You might find the [Object Mother](http://martinfowler.com/bliki/ObjectMother.html) pattern to be useful. I've used this on my current Groovy/Grails project to help me create example data. It's not groovy specific, but a dynamic language can often make it easier to create something like this using duck typing and clos...
290,699
<p>I need to have a set of overloaded functions in my code but I get convertion wanrings. Here is a test code:</p> <pre><code>#include windows.h void f(DWORD arg){...} //void f(SIZE_T arg){} void main(void) { DWORD dword=0; SIZE_T size_t=dword; f(size_t); } </code></pre> <p>The compiler gives warning:</p> <pre><...
[ { "answer_id": 290712, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 4, "selected": false, "text": "<p><code>size_t</code> is guaranteed to be an unsigned integral type, but the number of bits it has isn't specified....
2008/11/14
[ "https://Stackoverflow.com/questions/290699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to have a set of overloaded functions in my code but I get convertion wanrings. Here is a test code: ``` #include windows.h void f(DWORD arg){...} //void f(SIZE_T arg){} void main(void) { DWORD dword=0; SIZE_T size_t=dword; f(size_t); } ``` The compiler gives warning: ``` test.cpp(11) : warning C4244: 'a...
`size_t` is guaranteed to be an unsigned integral type, but the number of bits it has isn't specified. It could be equal to a `DWORD` (32 bits), or it could be 64 bits on a 64-bit platform. For maximal portability, you shouldn't assume it has a certain number of bits, which is what the compiler is warning you about. If...
290,774
<p>How can I get rid of: </p> <pre><code>&lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..."/&gt; </code></pre> <p>Completely !</p>
[ { "answer_id": 290780, "author": "dub", "author_id": 30022, "author_profile": "https://Stackoverflow.com/users/30022", "pm_score": 2, "selected": false, "text": "<p>I think you can disable it in machine.config :</p>\n\n<p>&lt; Pages enableViewState=\"false\"/></p>\n\n<p>That should disab...
2008/11/14
[ "https://Stackoverflow.com/questions/290774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35513/" ]
How can I get rid of: ``` <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..."/> ``` Completely !
You need to add the EnableViewState="false" to the @Page directive in the Default.aspx file. ``` <%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="Sample._Default" EnableViewState="false" %> ``` Then, add the following code to the Default.aspx.cs file. This removes the hidden field...
290,778
<p>I'm having a problem with a administrative app I'm working on. I'm build an interface for stopping, starting and querying various services across 40 or so servers. </p> <p>I'm looking at service.controller and have been successful in stopping and starting various services with button events but now I'm trying to ...
[ { "answer_id": 290907, "author": "Dan R", "author_id": 24222, "author_profile": "https://Stackoverflow.com/users/24222", "pm_score": 3, "selected": true, "text": "<p>You can trigger the periodic service check by using a Timer object. You can run your service queries on the Elapsed event....
2008/11/14
[ "https://Stackoverflow.com/questions/290778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35760/" ]
I'm having a problem with a administrative app I'm working on. I'm build an interface for stopping, starting and querying various services across 40 or so servers. I'm looking at service.controller and have been successful in stopping and starting various services with button events but now I'm trying to figure out a...
You can trigger the periodic service check by using a Timer object. You can run your service queries on the Elapsed event. ``` private void t_Elapsed(object sender, ElapsedEventArgs e) { // Check service statuses } ``` As for displaying statuses in a text box, you should be able to use the ToStri...
290,786
<p>Do you know what's the format of the DepartureWindow parameter for sabre web-services' OTA_AirLowFareSearch call? Whatever I pass, it shows me an error.</p> <p>This is the entire documentation for those parameters (I kid you not):</p> <pre><code>&lt;!--"DepartureDateTime" represents the date and time of departure....
[ { "answer_id": 347440, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>You must specify time within window in DepartureDateTime</p>\n\n<pre><code> &lt;ns1:DepartureDateTime&gt;2009-01-03T15:00:0...
2008/11/14
[ "https://Stackoverflow.com/questions/290786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Do you know what's the format of the DepartureWindow parameter for sabre web-services' OTA\_AirLowFareSearch call? Whatever I pass, it shows me an error. This is the entire documentation for those parameters (I kid you not): ``` <!--"DepartureDateTime" represents the date and time of departure.--> <DepartureDateTime>...
You must specify time within window in DepartureDateTime ``` <ns1:DepartureDateTime>2009-01-03T15:00:00</ns1:DepartureDateTime> <ns1:DepartureWindow>11001559</ns1:DepartureWindow> ``` works fine for me
290,799
<p>I'm programming in FORTRAN and C on an SGI running Irix 6.5, but this should be applicable to all Unix-like systems. How do I find which library I need to link to my program when I get an "unresolved text symbol" link error? Here's an example of what I'm seeing from the linker:</p> <pre><code>ld32: ERROR 33 Unre...
[ { "answer_id": 290815, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 4, "selected": true, "text": "<p>You can use the <code>nm</code> command to list the dynamic symbols from a shared library:</p>\n\n<pre><code>nm -D...
2008/11/14
[ "https://Stackoverflow.com/questions/290799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6688/" ]
I'm programming in FORTRAN and C on an SGI running Irix 6.5, but this should be applicable to all Unix-like systems. How do I find which library I need to link to my program when I get an "unresolved text symbol" link error? Here's an example of what I'm seeing from the linker: ``` ld32: ERROR 33 Unresolved text symb...
You can use the `nm` command to list the dynamic symbols from a shared library: ``` nm -D /lib/libc.so.6 ``` and then `grep` for the symbol you are looking for. Omit the -D for static libraries. You can use this in a loop or with xargs to scan multiple libraries. I usually just use google (assuming the symbol is fr...
290,806
<p>I might be one anal programmer, but I like code that looks good from a distance. I just found myself lining up a CSS style so that instead of this:</p> <pre><code>#divPreview { text-align: center; vertical-align: middle; border: #779 1px solid; overflow: auto; width: 210px; height: 128px; ...
[ { "answer_id": 290812, "author": "Steve", "author_id": 22712, "author_profile": "https://Stackoverflow.com/users/22712", "pm_score": 3, "selected": false, "text": "<p>I'd probably go even further and do this :</p>\n\n<pre><code>#divPreview {\n width : 210px;\n he...
2008/11/14
[ "https://Stackoverflow.com/questions/290806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11397/" ]
I might be one anal programmer, but I like code that looks good from a distance. I just found myself lining up a CSS style so that instead of this: ``` #divPreview { text-align: center; vertical-align: middle; border: #779 1px solid; overflow: auto; width: 210px; height: 128px; background-c...
**Any code style that makes you reorder things when code changes is bad.** It would screw up diffs. You are using a version control system right? There's a few other things that would make your code prettier, but screw up diffs. Imagine this code: ``` int foo = 42; int fooBar = 1024; ``` Now let's make it prettie...
290,840
<p>Let's say I have a table:</p> <pre> i j --- a 1 a 2 a 3 a 4 b 5 b 6 b 7 b 8 b 9 </pre> <p>Obvoiusly <code>SELECT a, GROUP_CONCAT(b SEPARATOR ',') GROUP BY a</code> would give me</p> <pre> a 1,2,3,4 b 5,6,7,8,9 </pre> <p>But what if I want to get only a LIMITED number of results, like 2, for example:</p> <pre>...
[ { "answer_id": 293327, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 0, "selected": false, "text": "<p>One solution would be to limit the rows in the group to the top two, before computing the aggregate.</p>\n\n<pre><c...
2008/11/14
[ "https://Stackoverflow.com/questions/290840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37141/" ]
Let's say I have a table: ``` i j --- a 1 a 2 a 3 a 4 b 5 b 6 b 7 b 8 b 9 ``` Obvoiusly `SELECT a, GROUP_CONCAT(b SEPARATOR ',') GROUP BY a` would give me ``` a 1,2,3,4 b 5,6,7,8,9 ``` But what if I want to get only a LIMITED number of results, like 2, for example: ``` a 1,2 b 5,6 ``` Any ideas?
Best way is to use `SUBSTRING_INDEX()` and `GROUP_CONCAT()`. ``` SELECT i, SUBSTRING_INDEX( GROUP_CONCAT(j), ',', 2) FROM mytable GROUP BY i; ``` You don't have to know the length of `j` field here.
290,860
<p>I'm attempting to get my first ASP.NET web page working on windows using <a href="http://www.mono-project.com/Main_Page" rel="nofollow noreferrer">Mono</a> and the XSP web server.</p> <p>I'm following this chaps <a href="http://www.codeproject.com/KB/cross-platform/introtomono2.aspx" rel="nofollow noreferrer">examp...
[ { "answer_id": 292084, "author": "Jacksonh", "author_id": 6803, "author_profile": "https://Stackoverflow.com/users/6803", "pm_score": 1, "selected": false, "text": "<p>Can you paste the command line you are using to start xsp? If you are just running a single webapp something like this ...
2008/11/14
[ "https://Stackoverflow.com/questions/290860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30317/" ]
I'm attempting to get my first ASP.NET web page working on windows using [Mono](http://www.mono-project.com/Main_Page) and the XSP web server. I'm following this chaps [example](http://www.codeproject.com/KB/cross-platform/introtomono2.aspx). The [first part](http://www.codeproject.com/KB/cross-platform/introtomono1.a...
Hey i don't know how to get the "code behind" stuff working but i've found a workaround that i'm happy with. I thought i'd post it up here for the benefit of others. Basically you move the code behind into the main page and it works great just by using the XSD command and no parameters. ``` <%@ Page Language="C#" %>...
290,867
<p>How do I serialize a 'Type'?</p> <p>I want to serialize to XML an object that has a property that is a type of an object. The idea is that when it is deserialized I can create an object of that type.</p> <pre><code>public class NewObject { } [XmlRoot] public class XmlData { private Type t; public Type T...
[ { "answer_id": 290916, "author": "Filip Frącz", "author_id": 21704, "author_profile": "https://Stackoverflow.com/users/21704", "pm_score": 2, "selected": false, "text": "<p>You could potentially implement the <a href=\"http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixml...
2008/11/14
[ "https://Stackoverflow.com/questions/290867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9516/" ]
How do I serialize a 'Type'? I want to serialize to XML an object that has a property that is a type of an object. The idea is that when it is deserialized I can create an object of that type. ``` public class NewObject { } [XmlRoot] public class XmlData { private Type t; public Type T { get { r...
XML serialization serializes only the public fields and property values of an object into an XML stream. **XML serialization does not include type information.** For example, if you have a Book object that exists in the Library namespace, there is no guarantee that it will be deserialized into an object of the same typ...
290,875
<p>&lt;rant-mode&gt; Have you ever seen a programming language that does not allow to add comments to the code? Welcome to the world of RTML (may it burn in hell)! &lt;/rant-mode&gt;</p> <h2>Question</h2> <blockquote> <p>What is the best technique (if any) you've adopted to comment your RTML code?</p> </blockquote>...
[ { "answer_id": 290990, "author": "Osama Al-Maadeed", "author_id": 25544, "author_profile": "https://Stackoverflow.com/users/25544", "pm_score": 0, "selected": false, "text": "<p>I just had a look at RTML,I wouldn't like working with it directly (it's very ugly).</p>\n\n<p>It seems that t...
2008/11/14
[ "https://Stackoverflow.com/questions/290875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31415/" ]
<rant-mode> Have you ever seen a programming language that does not allow to add comments to the code? Welcome to the world of RTML (may it burn in hell)! </rant-mode> Question -------- > > What is the best technique (if any) you've adopted to comment your RTML code? > > > Thank you!
To create a comment in RTML, click on your template, then `New`, and in the textbox that says Simple, type (in quotes) your comment. ``` "**************** My comment and stuff ******************" ``` If you want to comment out a piece of code, insert your code after a `MULTI` which groups multiple RTML statements an...
290,884
<p>The very common beginner mistake is when you try to use a class property &quot;statically&quot; without making an instance of that class. It leaves you with the mentioned error message:</p> <blockquote> <p>You can either make the non static method static or make an instance of that class to use its properties.</p> <...
[ { "answer_id": 290895, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 7, "selected": false, "text": "<p>The method you are trying to call is an instance-level method; you do not have an instance.</p>\n\n<p><code>static...
2008/11/14
[ "https://Stackoverflow.com/questions/290884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37740/" ]
The very common beginner mistake is when you try to use a class property "statically" without making an instance of that class. It leaves you with the mentioned error message: > > You can either make the non static method static or make an instance of that class to use its properties. > > > **What the reason behi...
You can't call something that doesn't exist. Since you haven't created an object, the non-static method doesn't exist yet. A static method (by definition) always exists.
290,885
<p>I've got a strange problem with SQL Server 2000, and I just can't think of a reason for this to happen.</p> <p>There are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure:</p> <pre><code>(VARCHAR(11), INT, DATETIME) /* can't change this, so don't sugge...
[ { "answer_id": 290933, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 0, "selected": false, "text": "<p><a href=\"http://www.sqlservercentral.com/Forums/Topic464285-146-2.aspx\" rel=\"nofollow noreferrer\">From SqlServerCent...
2008/11/14
[ "https://Stackoverflow.com/questions/290885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18771/" ]
I've got a strange problem with SQL Server 2000, and I just can't think of a reason for this to happen. There are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure: ``` (VARCHAR(11), INT, DATETIME) /* can't change this, so don't suggest I should */ ``` ...
> > Why does it switch from an Index Seek > to an Index Scan? > > > This is largely a guess, but here goes: In the first case ('Foo'), MSSQL recognize that the value being search for is a perfect match for the first part of the index on t1, and therefore uses the index to find a record in t1 (Index Seek, possibl...
290,896
<p>Say I have this simple form:</p> <pre><code>class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True) </code></pre> <p>And I have a default value for one field but not the other. So I set it up like this:</p> <pre><code>default_data = {'first_na...
[ { "answer_id": 290910, "author": "Jack M.", "author_id": 3421, "author_profile": "https://Stackoverflow.com/users/3421", "pm_score": 1, "selected": false, "text": "<p>From the django docs is this:</p>\n\n<pre><code>from django import forms\nclass ContactForm(forms.Form):\n subject = f...
2008/11/14
[ "https://Stackoverflow.com/questions/290896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13009/" ]
Say I have this simple form: ``` class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True) ``` And I have a default value for one field but not the other. So I set it up like this: ``` default_data = {'first_name','greg'} form1=ContactForm(default_...
Form constructor has `initial` param that allows to provide default values for fields.
290,899
<p>How exactly using VB6 can I can call any Windows shell command as you would from the command-line?</p> <p>For example, something as trivial as:</p> <pre><code>echo foo </code></pre>
[ { "answer_id": 290906, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 3, "selected": false, "text": "<p>Shell and ShellExecute?</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/aa242087.aspx\" rel=\"noreferrer\"...
2008/11/14
[ "https://Stackoverflow.com/questions/290899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
How exactly using VB6 can I can call any Windows shell command as you would from the command-line? For example, something as trivial as: ``` echo foo ```
Here's how you do it : ``` Shell "cmd echo foo", vbNormalFocus ```
290,913
<p>In C++, is it possible to have a base plus derived class implement a single interface?</p> <p>For example:</p> <pre><code>class Interface { public: virtual void BaseFunction() = 0; virtual void DerivedFunction() = 0; }; class Base { public: virtual void BaseFunction(){} }; class D...
[ { "answer_id": 290921, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "<p>C++ doesn't notice the function inherited from Base already implements <code>BaseFunction</code>: The fun...
2008/11/14
[ "https://Stackoverflow.com/questions/290913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12567/" ]
In C++, is it possible to have a base plus derived class implement a single interface? For example: ``` class Interface { public: virtual void BaseFunction() = 0; virtual void DerivedFunction() = 0; }; class Base { public: virtual void BaseFunction(){} }; class Derived : public Base,...
C++ doesn't notice the function inherited from Base already implements `BaseFunction`: The function has to be implemented explicitly in a class derived from `Interface`. Change it this way: ``` class Interface { public: virtual void BaseFunction() = 0; virtual void DerivedFunction() = 0; }; class ...
290,923
<p>I have a file in cvs that has Sticky Options set to <code>-kk</code>. This replaces all cvs keywords with just the keyword name to facilitate diffs. For example, <code>$Author: Alex B$</code> becomes <code>$Author$</code>. </p> <p>How do I disable the <code>-kk</code> behavior and get back to "normal" cvs whe...
[ { "answer_id": 290945, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 3, "selected": true, "text": "<pre><code>cvs update -kkv &lt;filename&gt;\n</code></pre>\n\n<p>will reset the sticky options to <code>keyword</code> and...
2008/11/14
[ "https://Stackoverflow.com/questions/290923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6180/" ]
I have a file in cvs that has Sticky Options set to `-kk`. This replaces all cvs keywords with just the keyword name to facilitate diffs. For example, `$Author: Alex B$` becomes `$Author$`. How do I disable the `-kk` behavior and get back to "normal" cvs where keywords are substituted in? I've tried `rm`'ing the file...
``` cvs update -kkv <filename> ``` will reset the sticky options to `keyword` and `value` **Edit:** Corrected `checkout` to `update`, thanks to [Alex B](https://stackoverflow.com/users/6180/alex-b) for the correction.
290,927
<p>Is it expensive?</p> <p>I am developing an HtmlHelper that renders directly to Response.Output in order to save unnecesary string creation and I need to choose between: </p> <pre><code>&lt;% Validator.RenderClient(Response.Output); %&gt; </code></pre> <p>and</p> <pre><code>&lt;% Validator.RenderClient(); %&gt; <...
[ { "answer_id": 290949, "author": "oglester", "author_id": 2017, "author_profile": "https://Stackoverflow.com/users/2017", "pm_score": 2, "selected": false, "text": "<p>from reflector </p>\n\n<pre><code>public static HttpContext get_Current()\n{\n return (ContextBase.Current as HttpCon...
2008/11/14
[ "https://Stackoverflow.com/questions/290927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4264/" ]
Is it expensive? I am developing an HtmlHelper that renders directly to Response.Output in order to save unnecesary string creation and I need to choose between: ``` <% Validator.RenderClient(Response.Output); %> ``` and ``` <% Validator.RenderClient(); %> ``` and get the textWriter from HttpContext.Current.Res...
@Dawkins 100 runs is too few, you need to run about 10000 times several times and repeat it and then take the average of that to get a reliable result. The margin of error is to big in your example, but it's the right way to go. Here's what i did: ``` var results1 = new List<long>(); var results2 = new List<long>();...
290,952
<p>Suppose I have #define foo in various header files. It may expand to some different things. I would like to know (when compiling a .cc file) when a #define is encountered, to what it will expand, it which file it is and where it got included from.</p> <p>Is it possible? If not, are there any partial solutions that ...
[ { "answer_id": 290998, "author": "user7305", "author_id": 7305, "author_profile": "https://Stackoverflow.com/users/7305", "pm_score": 0, "selected": false, "text": "<p>Use #warning. It's described <a href=\"http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Diagnostics.html#Diagnostics\" rel=\"...
2008/11/14
[ "https://Stackoverflow.com/questions/290952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9403/" ]
Suppose I have #define foo in various header files. It may expand to some different things. I would like to know (when compiling a .cc file) when a #define is encountered, to what it will expand, it which file it is and where it got included from. Is it possible? If not, are there any partial solutions that may help? ...
Use -E : ``` # shows preprocessed source with cpp internals removed g++ -E -P file.cc # shows preprocessed source kept with macros and include directives g++ -E -dD -dI -P file.cc ``` The internals above are line-markers for gcc which are kinda confusing when you read the output. `-P` strips them ``` -E Stop a...
290,980
<p>I have a Windows forms project (VS 2005, .net 2.0). The solution has references to 9 projects. Everything works and compiles fine on one of my computers. When I move it to a second computer, 8 out of the 9 project compile with no problem. When I try to compile the 9th project (the main project for the application - ...
[ { "answer_id": 290994, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 2, "selected": false, "text": "<p>Check the references section of each project in the solutions explorer... Look for references to third party ve...
2008/11/14
[ "https://Stackoverflow.com/questions/290980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
I have a Windows forms project (VS 2005, .net 2.0). The solution has references to 9 projects. Everything works and compiles fine on one of my computers. When I move it to a second computer, 8 out of the 9 project compile with no problem. When I try to compile the 9th project (the main project for the application - pro...
I just got it to build by doing the following: There had been a licenses file in the Properties of the project in question. After deleting the file (it was no longer needed) the project was able to build successfully. So it looks like that was the culprit.
290,982
<p>I have a block of code that works and I wanted to ask what exactly is happening here?</p> <pre><code>Class&lt;?&gt; normalFormClass = null; </code></pre> <p>---added---</p> <p>The wildcard "<code>&lt;?&gt;</code>" is the part that is confusing for me. Why would this be used rather than not using it (generics)?</...
[ { "answer_id": 290987, "author": "Pyrolistical", "author_id": 21838, "author_profile": "https://Stackoverflow.com/users/21838", "pm_score": 0, "selected": false, "text": "<p>I doubt this is homework, since I've never been in a class that talked about reflection.</p>\n\n<p>But this is a s...
2008/11/14
[ "https://Stackoverflow.com/questions/290982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34475/" ]
I have a block of code that works and I wanted to ask what exactly is happening here? ``` Class<?> normalFormClass = null; ``` ---added--- The wildcard "`<?>`" is the part that is confusing for me. Why would this be used rather than not using it (generics)?
That means it can be a Class of any type. ? is a wildcard denoting the set of all types, or 'any'. So you can later do ``` Integer normalForm = new Integer(); normalFormClass = normalForm.getClass(); ``` or ``` String normalForm = new String(); normalFormClass = normalForm.getClass(); ``` If you are not aware of ...
290,996
<p>How do I get the HTTP status code (eg 200 or 500) after calling curl_easy_perform? </p>
[ { "answer_id": 291006, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 8, "selected": true, "text": "<p><a href=\"http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html\" rel=\"noreferrer\">http://curl.haxx.se/libcurl/c/...
2008/11/14
[ "https://Stackoverflow.com/questions/290996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23524/" ]
How do I get the HTTP status code (eg 200 or 500) after calling curl\_easy\_perform?
<http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html> ``` CURLINFO_RESPONSE_CODE Pass a pointer to a long to receive the last received HTTP or FTP code. This option was known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier. This will be zero if no server response code has been received. Note that a proxy's CO...
290,997
<p>We have the TAncestor class which has a virtual method GetFile.<br> We will have some TDescendant = class(TAncestor) which may override GetFile.<br> We want to insure that in such a case those overriden methods do not call inherited in their implementation.<br> But if they don't implement GetFile and just use the on...
[ { "answer_id": 291046, "author": "Steve", "author_id": 22712, "author_profile": "https://Stackoverflow.com/users/22712", "pm_score": 1, "selected": false, "text": "<p>When you implement the ancestor, override the method, but don't call inherited inside the method.</p>\n\n<pre><code>proce...
2008/11/14
[ "https://Stackoverflow.com/questions/290997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9842/" ]
We have the TAncestor class which has a virtual method GetFile. We will have some TDescendant = class(TAncestor) which may override GetFile. We want to insure that in such a case those overriden methods do not call inherited in their implementation. But if they don't implement GetFile and just use the one from...
No. There is no way to force code outside your control to *not* call something that is otherwise perfectly accessible. The best you can do is strongly discourage the practice in the documentation for the class. What are the consequences if a descendant calls the inherited method? If it means the program stops working,...
291,003
<p>The JUnit framework contains 2 <code>Assert</code> classes (in different packages, obviously) and the methods on each appear to be very similar. Can anybody explain why this is?</p> <p>The classes I'm referring to are: <a href="http://junit.org/junit/javadoc/4.5/junit/framework/Assert.html" rel="noreferrer"><code>j...
[ { "answer_id": 291032, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 3, "selected": false, "text": "<p>I believe they are refactoring from <code>junit.framework</code> to <code>org.junit</code> and <code>junit.framework.Asse...
2008/11/14
[ "https://Stackoverflow.com/questions/291003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
The JUnit framework contains 2 `Assert` classes (in different packages, obviously) and the methods on each appear to be very similar. Can anybody explain why this is? The classes I'm referring to are: [`junit.framework.Assert`](http://junit.org/junit/javadoc/4.5/junit/framework/Assert.html) and [`org.junit.Assert`](ht...
The old method (of JUnit 3) was to mark the test-classes by extending `junit.framework.TestCase`. That inherited `junit.framework.Assert` itself and your test class gained the ability to call the assert methods this way. Since version 4 of JUnit, the framework uses `Annotations` for marking tests. So you no longer nee...
291,015
<p>I'm writing a small page to show the employees in our company. I've written a query to pull the info from our database. Then I'm binding that to a GridView to do the dirty work. Here is the query.</p> <pre><code>"SELECT tblEmpID.empid AS [Empl ID], tblEmpID.posno AS [Pos #], [name] &amp; ""&lt;br /&gt;"" &amp; [...
[ { "answer_id": 291092, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 0, "selected": false, "text": "<p>If you are doing this for read-only purposes, you may want to consider using the repeater control. Then, you can return...
2008/11/14
[ "https://Stackoverflow.com/questions/291015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340/" ]
I'm writing a small page to show the employees in our company. I've written a query to pull the info from our database. Then I'm binding that to a GridView to do the dirty work. Here is the query. ``` "SELECT tblEmpID.empid AS [Empl ID], tblEmpID.posno AS [Pos #], [name] & ""<br />"" & [jcn] & ""("" & [jcc] & "")""...
Try setting HtmlEncode="False" on the column in the GridView. That should stop it from encoding your markup.
291,031
<p>Writing a JSP page, what exactly does the <code>&lt;c:out&gt;</code> do? I've noticed that the following both has the same result:</p> <pre><code>&lt;p&gt;The person's name is &lt;c:out value="${person.name}" /&gt;&lt;/p&gt; &lt;p&gt;The person's name is ${person.name}&lt;/p&gt; </code></pre>
[ { "answer_id": 291042, "author": "Will Wagner", "author_id": 25468, "author_profile": "https://Stackoverflow.com/users/25468", "pm_score": 2, "selected": false, "text": "<p>Older versions of JSP did not support the second syntax.</p>\n" }, { "answer_id": 291047, "author": "kr...
2008/11/14
[ "https://Stackoverflow.com/questions/291031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
Writing a JSP page, what exactly does the `<c:out>` do? I've noticed that the following both has the same result: ``` <p>The person's name is <c:out value="${person.name}" /></p> <p>The person's name is ${person.name}</p> ```
`c:out` escapes HTML characters so that you can avoid cross-site scripting. if `person.name = <script>alert("Yo")</script>` the script will be executed in the second case, but not when using `c:out`
291,037
<p>What is the easiest way to set the contents of an <code>&lt;asp:ContentPlaceHolder&gt;</code> programmatically? I imagine ill have to do a <code>Master.FindControl</code> call?</p>
[ { "answer_id": 291052, "author": "dev.e.loper", "author_id": 37759, "author_profile": "https://Stackoverflow.com/users/37759", "pm_score": 0, "selected": false, "text": "<p>If you are adding controls to a blank page then you do Page.Controls.Add()....no?</p>\n" }, { "answer_id": ...
2008/11/14
[ "https://Stackoverflow.com/questions/291037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
What is the easiest way to set the contents of an `<asp:ContentPlaceHolder>` programmatically? I imagine ill have to do a `Master.FindControl` call?
If your page inherits from a MasterPage, then you should have an asp:Content control on your page with some id, like so: ``` <asp:Content runat="server" ID="myContent" ContentPlaceHolderID="masterContent"> </asp:Content> ``` You should be able to reference this in your codebehind and add whatever you want to it. ``...
291,057
<p>I am new to C#. I wanted to do a simple program with some type of loops. I wanted my program to loop through the numbers that the user enters and if it is less than a number then write keep guessing,but once they enter the number 25 i wanted it to say Merry Christmas.. Please Help</p> <pre><code>int number; do {...
[ { "answer_id": 291072, "author": "Gavin Miller", "author_id": 33226, "author_profile": "https://Stackoverflow.com/users/33226", "pm_score": 1, "selected": false, "text": "<pre><code>int number;\n\ndo\n{\n Console.WriteLine(\"Guess a number between 20 through 25\");\n number = int.P...
2008/11/14
[ "https://Stackoverflow.com/questions/291057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am new to C#. I wanted to do a simple program with some type of loops. I wanted my program to loop through the numbers that the user enters and if it is less than a number then write keep guessing,but once they enter the number 25 i wanted it to say Merry Christmas.. Please Help ``` int number; do { Console.Wr...
Try the following: ``` int number = 0; while (number != 25) { Console.WriteLine("Guess a number between 20 through 25"); number = int.Parse(Console.ReadLine()); if (number != 25) Console.WriteLine("Keep guessing"); else Console.WriteLine("Merry Christmas"); } ```
291,059
<p>I'm creating an asp.net app with just some lite data access from xml files. However, I need to be able to authenticate administrative users (via forms) to manage that data. I don't want to stand up a sql db just for authentication purposes. I'd like to use xml, but not sure about security with that. Any suggesti...
[ { "answer_id": 291072, "author": "Gavin Miller", "author_id": 33226, "author_profile": "https://Stackoverflow.com/users/33226", "pm_score": 1, "selected": false, "text": "<pre><code>int number;\n\ndo\n{\n Console.WriteLine(\"Guess a number between 20 through 25\");\n number = int.P...
2008/11/14
[ "https://Stackoverflow.com/questions/291059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10693/" ]
I'm creating an asp.net app with just some lite data access from xml files. However, I need to be able to authenticate administrative users (via forms) to manage that data. I don't want to stand up a sql db just for authentication purposes. I'd like to use xml, but not sure about security with that. Any suggestions? Cu...
Try the following: ``` int number = 0; while (number != 25) { Console.WriteLine("Guess a number between 20 through 25"); number = int.Parse(Console.ReadLine()); if (number != 25) Console.WriteLine("Keep guessing"); else Console.WriteLine("Merry Christmas"); } ```
291,065
<p>let me tell you a bit about where this question came from. I have been playing around with the SDK of Serious Sam 2, a first person shooter which runs on the Serious Engine 2. This engine introduces something called MetaData. MetaData is used in the engine to serialize classes and be able to edit them in the editor ...
[ { "answer_id": 291142, "author": "Serge Wautier", "author_id": 12379, "author_profile": "https://Stackoverflow.com/users/12379", "pm_score": 1, "selected": false, "text": "<p>If this engine runs on Windows, one idea that comes to mind is resources. There are Windows APIs to modify the co...
2008/11/14
[ "https://Stackoverflow.com/questions/291065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37472/" ]
let me tell you a bit about where this question came from. I have been playing around with the SDK of Serious Sam 2, a first person shooter which runs on the Serious Engine 2. This engine introduces something called MetaData. MetaData is used in the engine to serialize classes and be able to edit them in the editor env...
This looks somewhat similar to Qt's moc (meta object compiler). In Qt's case, it generates extra C++ source files which are then compiled and linked together with the original source files. A possible implementation in your example would be for the generated files to implement a set of functions which can be called to...