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
240,765
<p>I've got a lot of similar oracle jobs I need to create, and I'd like to do it programatically. </p> <p>Where does the Oracle store the job library (schema/table)?</p> <p>(yes, I know I might be running with scissors)</p>
[ { "answer_id": 240779, "author": "Joseph Bui", "author_id": 3275, "author_profile": "https://Stackoverflow.com/users/3275", "pm_score": 0, "selected": false, "text": "<p>Views: USER_JOBS, DBA_JOBS or ALL_JOBS</p>\n" }, { "answer_id": 240943, "author": "Leigh Riffel", "aut...
2008/10/27
[ "https://Stackoverflow.com/questions/240765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/685/" ]
I've got a lot of similar oracle jobs I need to create, and I'd like to do it programatically. Where does the Oracle store the job library (schema/table)? (yes, I know I might be running with scissors)
For [DBMS\_JOBS](http://www.psoug.org/reference/dbms_job.html) you can use... ``` dbms_job.submit( JOB OUT BINARY_INTEGER, WHAT IN VARCHAR2, NEXT_DATE IN DATE DEFAULT SYSDATE, INTERVAL IN VARCHAR2 DEFAULT 'NULL', NO_PARSE IN BOOLEAN DEFAULT FALSE, INSTANCE IN BINARY_INTEGER DE...
240,774
<p>I'm having a small problem in Java. I have an interface called Modifiable. Objects implementing this interface are Modifiable.</p> <p>I also have a ModifyCommand class (with the Command pattern) that receive two Modifiable objects (to swap them in a list further on - that's not my question, I designed that solution...
[ { "answer_id": 240806, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 0, "selected": false, "text": "<p>Did you define the signature exactly as it is in object?</p>\n\n<pre><code>public Object clone() throws CloneNotS...
2008/10/27
[ "https://Stackoverflow.com/questions/240774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10687/" ]
I'm having a small problem in Java. I have an interface called Modifiable. Objects implementing this interface are Modifiable. I also have a ModifyCommand class (with the Command pattern) that receive two Modifiable objects (to swap them in a list further on - that's not my question, I designed that solution already)....
If you're using java 1.5 or higher, you can get the behavior you want and remove casting this way: ``` public interface Modifiable<T extends Modifiable<T>> extends Cloneable { T clone(); } public class Foo implements Modifiable<Foo> { public Foo clone() { //this is required return null; //todo: real w...
240,778
<p>I have a 4 side convex Polygon defined by 4 points in 2D, and I want to be able to generate random points inside it.</p> <p>If it really simplifies the problem, I can limit the polygon to a parallelogram, but a more general answer is preferred.</p> <p>Generating random points until one is inside the polygon wouldn...
[ { "answer_id": 240790, "author": "PierreBdR", "author_id": 7136, "author_profile": "https://Stackoverflow.com/users/7136", "pm_score": 6, "selected": true, "text": "<p>A. If you can restrict your input to parallelogram, this is really simple:</p>\n\n<ol>\n<li>Take two random numbers betw...
2008/10/27
[ "https://Stackoverflow.com/questions/240778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1815/" ]
I have a 4 side convex Polygon defined by 4 points in 2D, and I want to be able to generate random points inside it. If it really simplifies the problem, I can limit the polygon to a parallelogram, but a more general answer is preferred. Generating random points until one is inside the polygon wouldn't work because i...
A. If you can restrict your input to parallelogram, this is really simple: 1. Take two random numbers between 0 and 1. We'll call then `u` and `v`. 2. If your parallelogram is defined by the points ABCD such that AB, BC, CD and DA are the sides, then take your point as being: ``` p = A + (u * AB) + (v * AD) ``` Wh...
240,788
<p>Can I call a stored procedure in Oracle via a database link?</p> <p>The database link is functional so that syntax such as...</p> <pre><code>SELECT * FROM myTable@myRemoteDB </code></pre> <p>is functioning. But is there a syntax for...</p> <pre><code>EXECUTE mySchema.myPackage.myProcedure('someParameter')@myRem...
[ { "answer_id": 240798, "author": "Justin Cave", "author_id": 10397, "author_profile": "https://Stackoverflow.com/users/10397", "pm_score": 7, "selected": true, "text": "<p>The syntax is</p>\n\n<pre><code>EXEC mySchema.myPackage.myProcedure@myRemoteDB( 'someParameter' );\n</code></pre>\n"...
2008/10/27
[ "https://Stackoverflow.com/questions/240788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13930/" ]
Can I call a stored procedure in Oracle via a database link? The database link is functional so that syntax such as... ``` SELECT * FROM myTable@myRemoteDB ``` is functioning. But is there a syntax for... ``` EXECUTE mySchema.myPackage.myProcedure('someParameter')@myRemoteDB ```
The syntax is ``` EXEC mySchema.myPackage.myProcedure@myRemoteDB( 'someParameter' ); ```
240,836
<p>I'm currently working on a project where a section of the code looks like this:</p> <pre><code>Select Case oReader.Name Case &quot;NameExample1&quot; Me.Elements.NameExample1.Value = oReader.ReadString ' ... Case &quot;NameExampleN&quot; Me.Elements.NameExampleN.Value = oReader.ReadSt...
[ { "answer_id": 241143, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "<p>Others have answered perfectly reasonably, but just in case this is a performance-sensitive piece of code, you might w...
2008/10/27
[ "https://Stackoverflow.com/questions/240836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20/" ]
I'm currently working on a project where a section of the code looks like this: ``` Select Case oReader.Name Case "NameExample1" Me.Elements.NameExample1.Value = oReader.ReadString ' ... Case "NameExampleN" Me.Elements.NameExampleN.Value = oReader.ReadString ' ... End Select ``...
Others have answered perfectly reasonably, but just in case this is a performance-sensitive piece of code, you might want to compile the reflective calls into delegates. I've got a [blog entry](http://codeblog.jonskeet.uk/2008/08/09/making-reflection-fly-and-exploring-delegates) about turning [MethodBase.Invoke](http:...
240,850
<p>I am having an issue when using <code>LoadControl( type, Params )</code>. Let me explain...</p> <p>I have a super simple user control (ascx)</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewState="false" %&gt; &lt;asp:Label runa...
[ { "answer_id": 240866, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": -1, "selected": false, "text": "<p>Per the asp.net page lifecycle your controls are not fully added in pre-render, why don't you just load the va...
2008/10/27
[ "https://Stackoverflow.com/questions/240850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31128/" ]
I am having an issue when using `LoadControl( type, Params )`. Let me explain... I have a super simple user control (ascx) ``` <%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewState="false" %> <asp:Label runat="server" ID="lblTitle" /> <asp:Label ru...
I have tried the following code as well - which yields the same result (i.e. both lblTitle and lblDescription are null) ``` protected void Page_Load(object sender, EventArgs e) { if (_ErrorMessage != null) { lblTitle.Text = _ErrorMessage.Message; lblDescription.Text = _ErrorMessage.Description;...
240,874
<p>When you have a derived class, is there an simpler way to refer to a variable from a method other than:</p> <pre><code>BaseClass::variable </code></pre> <p><strong>EDIT</strong> <br>As it so happens, I found a page that explained this issue using functions instead: <a href="http://www.parashift.com/c++-faq-lite/te...
[ { "answer_id": 240881, "author": "Dima", "author_id": 13313, "author_profile": "https://Stackoverflow.com/users/13313", "pm_score": 4, "selected": true, "text": "<p>If the base class member variable is protected or public than you can just refer to it by name in any member function of th...
2008/10/27
[ "https://Stackoverflow.com/questions/240874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73/" ]
When you have a derived class, is there an simpler way to refer to a variable from a method other than: ``` BaseClass::variable ``` **EDIT** As it so happens, I found a page that explained this issue using functions instead: [Template-Derived-Classes Errors](http://www.parashift.com/c++-faq-lite/templates.html#faq-...
If the base class member variable is protected or public than you can just refer to it by name in any member function of the derived class. If it is private to the base class the compiler will not let the derived class access it at all. Example: ``` class Base { protected: int a; private: int b; }; class Derive...
240,876
<p>I have this code</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main(int argc,char **argv) { unsigned long long num1 = 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
[ { "answer_id": 240888, "author": "Paul Nathan", "author_id": 26227, "author_profile": "https://Stackoverflow.com/users/26227", "pm_score": 0, "selected": false, "text": "<p>unsigned int represents a system word. Today, that word will max out at either 2^32 -1 or 2^64 - 1, depending on wh...
2008/10/27
[ "https://Stackoverflow.com/questions/240876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8715/" ]
I have this code ``` #include <iostream> using namespace std; int main(int argc,char **argv) { unsigned long long num1 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
Your result is larger than the long long type - you need to look at a [BigInteger](http://mattmccutchen.net/bigint/) or arbitrary precision library, something like [gmp](http://gmplib.org/)
240,903
<p>I'm looking for a library that can deal with RDF and OWL data.</p> <p>So far I have found:</p> <ul> <li><a href="http://razor.occams.info/code/semweb/" rel="nofollow noreferrer">semweb</a> (no owl support for all I know)</li> <li><a href="http://rowlex.nc3a.nato.int/HowToUse.aspx" rel="nofollow noreferrer">rowlex<...
[ { "answer_id": 240966, "author": "IAdapter", "author_id": 30453, "author_profile": "https://Stackoverflow.com/users/30453", "pm_score": 2, "selected": false, "text": "<p>I researched this just a bit several months ago. One of the more interesting\nprojects I could find is:\n<a href=\"htt...
2008/10/27
[ "https://Stackoverflow.com/questions/240903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13466/" ]
I'm looking for a library that can deal with RDF and OWL data. So far I have found: * [semweb](http://razor.occams.info/code/semweb/) (no owl support for all I know) * [rowlex](http://rowlex.nc3a.nato.int/HowToUse.aspx) (more of a 'browser' application) Your recommendations: * [LinqToRdf](https://code.google.com/p/...
[ROWLEX](http://rowlex.nc3a.nato.int) is actually very cool (uses [SemWeb](http://razor.occams.info/code/semweb/) internally). It is not just a browser app but rather an SDK written in C#. If you use ROWLEX, you do not directly interact with the tripples of RDF anymore (though you can), but gives an object oriented loo...
240,918
<p>I'd like to create a view in Sharepoint that has a filter based on a date field. </p> <p>The filter should be >= Today and &lt;- Today + 90 days. </p> <p>I found a reference to the </p> <pre><code>&lt;Today OffsetDays=”5” /&gt; </code></pre> <p>CAML function and could probably use this by setting the view usin...
[ { "answer_id": 241075, "author": "AdamBT", "author_id": 22426, "author_profile": "https://Stackoverflow.com/users/22426", "pm_score": 3, "selected": true, "text": "<p>This can be done OTB using the filter dropdowns when modifying or creating a view:</p>\n\n<p><a href=\"http://img91.image...
2008/10/27
[ "https://Stackoverflow.com/questions/240918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31679/" ]
I'd like to create a view in Sharepoint that has a filter based on a date field. The filter should be >= Today and <- Today + 90 days. I found a reference to the ``` <Today OffsetDays=”5” /> ``` CAML function and could probably use this by setting the view using the API. My question is how do i set this using...
This can be done OTB using the filter dropdowns when modifying or creating a view: [Filter Image](http://img91.imageshack.us/my.php?image=filterew5.png) [alt text http://img91.imageshack.us/my.php?image=filterew5.png](http://img91.imageshack.us/my.php?image=filterew5.png) Edit: Fixed image
240,946
<p>I want my WPF ComboBox's ItemsSource property to be bound to MyListObject's MyList property. The problem is that when I update the MyList property in code, the WPF ComboBox is not reflecting the update. I am raising the PropertyChanged event after I perform the update, and I thought WPF was supposed to automatical...
[ { "answer_id": 240983, "author": "Aaron Fischer", "author_id": 5618, "author_profile": "https://Stackoverflow.com/users/5618", "pm_score": 3, "selected": true, "text": "<p>You are binding to a list of strings. That list class does not implement Inotifyproperty. You should use an observab...
2008/10/27
[ "https://Stackoverflow.com/questions/240946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132931/" ]
I want my WPF ComboBox's ItemsSource property to be bound to MyListObject's MyList property. The problem is that when I update the MyList property in code, the WPF ComboBox is not reflecting the update. I am raising the PropertyChanged event after I perform the update, and I thought WPF was supposed to automatically re...
You are binding to a list of strings. That list class does not implement Inotifyproperty. You should use an observablecollection instead. I also notice in your code behind you declare ``` Private obj As New MyListObject ``` This is not the static resource you bound the combo box to. So your add call would not be re...
240,948
<p>I'm working on a small app where I can generate a list of barcodes. I have the correct fonts installed on my computer. Right now I am printing them directly to a webpage and it works properly in Chrome and IE 7, but not Firefox. Does anyone know what Firefox would be doing differently than IE and Chrome?</p> <p>Her...
[ { "answer_id": 240956, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 2, "selected": false, "text": "<p>Using non-standard fonts on web pages is a big pain in the ass. To make it easier you can use <a href=\"http://w...
2008/10/27
[ "https://Stackoverflow.com/questions/240948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1444511/" ]
I'm working on a small app where I can generate a list of barcodes. I have the correct fonts installed on my computer. Right now I am printing them directly to a webpage and it works properly in Chrome and IE 7, but not Firefox. Does anyone know what Firefox would be doing differently than IE and Chrome? Here is my co...
A simpler solution might be to generate images server side to generate the bar codes. That way you don't have to rely on the user having a font installed and you don't have to access the font in your html.
240,949
<p>I have a set of templates for emails that my app sends out. The templates have codes embedded in them that correspond to properties of my business object. </p> <p>Is there a more elegant way than calling </p> <pre><code>string.Replace("{!MyProperty!}", item.MyProperty.ToString()) </code></pre> <p>a zillion times...
[ { "answer_id": 240953, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 2, "selected": false, "text": "<p>First of all, when I do this I use StringBuilder.Replace() as I have found that its performance is much better ...
2008/10/27
[ "https://Stackoverflow.com/questions/240949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a set of templates for emails that my app sends out. The templates have codes embedded in them that correspond to properties of my business object. Is there a more elegant way than calling ``` string.Replace("{!MyProperty!}", item.MyProperty.ToString()) ``` a zillion times? Maybe XMLTransform, regular exp...
First of all, when I do this I use StringBuilder.Replace() as I have found that its performance is much better suited when working with 3 or more replacements. Of course there are other ways of doing it, but I've found that it is not usually worth the extra effort to try other items. You might be able to use Reflecti...
241,003
<p>Is there some way to get a value from the last inserted row?</p> <p>I am inserting a row where the PK will automatically increase, and I would like to get this PK. Only the PK is guaranteed to be unique in the table.</p> <p>I am using Java with a JDBC and PostgreSQL.</p>
[ { "answer_id": 241016, "author": "svrist", "author_id": 86, "author_profile": "https://Stackoverflow.com/users/86", "pm_score": 3, "selected": false, "text": "<p>The sequences in postgresql are transaction safe. So you can use the </p>\n\n<pre><code>currval(sequence)\n</code></pre>\n\n<p...
2008/10/27
[ "https://Stackoverflow.com/questions/241003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26567/" ]
Is there some way to get a value from the last inserted row? I am inserting a row where the PK will automatically increase, and I would like to get this PK. Only the PK is guaranteed to be unique in the table. I am using Java with a JDBC and PostgreSQL.
With PostgreSQL you can do it via the RETURNING keyword: [PostgresSQL - RETURNING](http://www.postgresql.org/docs/8.3/interactive/sql-insert.html) ``` INSERT INTO mytable( field_1, field_2,... ) VALUES ( value_1, value_2 ) RETURNING anyfield ``` It will return the value of "anyfield". "anyfield" may be a sequence o...
241,009
<p>In a Visual Basic project, I created a homemade TabControl in order to fix a visual bug. The control works properly, however whenever I modify the form using my tab, Visual Studio adds MyProject in front of the control in its declaration:</p> <pre><code>Me.tabMenu = New MyProject.MyClass 'Gives a BC30002 compile e...
[ { "answer_id": 241077, "author": "John Rudy", "author_id": 14048, "author_profile": "https://Stackoverflow.com/users/14048", "pm_score": 0, "selected": false, "text": "<p>By default, Visual Basic .NET assigned a default namespace to your project. (I believe the default is, in fact, <code...
2008/10/27
[ "https://Stackoverflow.com/questions/241009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25818/" ]
In a Visual Basic project, I created a homemade TabControl in order to fix a visual bug. The control works properly, however whenever I modify the form using my tab, Visual Studio adds MyProject in front of the control in its declaration: ``` Me.tabMenu = New MyProject.MyClass 'Gives a BC30002 compile error ``` If I...
I've seen this before when you have a public module with the same name as your default namespace (project name). If that's the case, either rename the module or the default namespace and the problem should go away,.
241,015
<p>I have a backup server that automatically backs up my live site, both files and database.</p> <p>On the live site, the text looks fine, but when you view the mirrored version of it, it displays '?' within some of the text. This text is stored within the news database table.</p> <p>Here is a screenshot of it being on...
[ { "answer_id": 241024, "author": "Benjamin Lee", "author_id": 29009, "author_profile": "https://Stackoverflow.com/users/29009", "pm_score": 1, "selected": false, "text": "<p>Unicode or other character set characters falling through?</p>\n\n<p>I have seen similar \"strange\" characters sh...
2008/10/27
[ "https://Stackoverflow.com/questions/241015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
I have a backup server that automatically backs up my live site, both files and database. On the live site, the text looks fine, but when you view the mirrored version of it, it displays '?' within some of the text. This text is stored within the news database table. Here is a screenshot of it being on the live serve...
The following articles will be useful: *[10.3 Specifying Character Sets and Collations](http://dev.mysql.com/doc/refman/5.0/en/charset-syntax.html)* *[10.4 Connection Character Sets and Collations](http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html)* After you connect to the database, issue the following...
241,034
<p>I have a very simple Java RMI Server that looks like the following:</p> <pre><code> import java.rmi.*; import java.rmi.server.*; public class CalculatorImpl extends UnicastRemoteObject implements Calculator { private String mServerName; public CalculatorImpl(String serverName) throws R...
[ { "answer_id": 241214, "author": "Clayton", "author_id": 1449, "author_profile": "https://Stackoverflow.com/users/1449", "pm_score": 5, "selected": true, "text": "<p>In case anyone is having a similar problem, I figured out the answer myself. Here is my exit() method:</p>\n\n<pre><code>...
2008/10/27
[ "https://Stackoverflow.com/questions/241034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1449/" ]
I have a very simple Java RMI Server that looks like the following: ``` import java.rmi.*; import java.rmi.server.*; public class CalculatorImpl extends UnicastRemoteObject implements Calculator { private String mServerName; public CalculatorImpl(String serverName) throws RemoteException...
In case anyone is having a similar problem, I figured out the answer myself. Here is my exit() method: ``` public void exit() throws RemoteException { try{ // Unregister ourself Naming.unbind(mServerName); // Unexport; this will also remove us from the RMI runtime UnicastRemoteObje...
241,040
<p>I have a rich-text editor on my site that I'm trying to protect against XSS attacks. I think I have pretty much everything handled, but I'm still unsure about what to do with images. Right now I'm using the following regex to validate image URLs, which I'm assuming will block inline javascript XSS attacks: </p> <p...
[ { "answer_id": 241068, "author": "Jasper Bekkers", "author_id": 31486, "author_profile": "https://Stackoverflow.com/users/31486", "pm_score": 2, "selected": false, "text": "<p>Another thing to worry about is that you can easily embed PHP code inside an image and upload that most of the t...
2008/10/27
[ "https://Stackoverflow.com/questions/241040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
I have a rich-text editor on my site that I'm trying to protect against XSS attacks. I think I have pretty much everything handled, but I'm still unsure about what to do with images. Right now I'm using the following regex to validate image URLs, which I'm assuming will block inline javascript XSS attacks: ``` "https...
Another thing to worry about is that you can easily embed PHP code inside an image and upload that most of the time. The only thing an attack would then have to be able to do is find a way to include the image. (Only the PHP code will get executed, the rest is just echoed). Check the MIME-type won't help you with this ...
241,051
<p>I have nant set up to build my ASP.NET MVC project and it works fine locally. I add nant to a tools folder and add it to version control. TeamCity picks up my changes and starts the build but it fails.</p> <p>I believe I'm using the latest version of Nant and I have added the .net framework 3.5 to the nant.exe.co...
[ { "answer_id": 241318, "author": "Scott Saad", "author_id": 4916, "author_profile": "https://Stackoverflow.com/users/4916", "pm_score": 3, "selected": true, "text": "<p>If you're using the beta version of NAnt (which currently is the only way you'll get support for targeting anything gre...
2008/10/27
[ "https://Stackoverflow.com/questions/241051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9938/" ]
I have nant set up to build my ASP.NET MVC project and it works fine locally. I add nant to a tools folder and add it to version control. TeamCity picks up my changes and starts the build but it fails. I believe I'm using the latest version of Nant and I have added the .net framework 3.5 to the nant.exe.config. What a...
If you're using the beta version of NAnt (which currently is the only way you'll get support for targeting anything greater than the 2.0 framework), you maybe running into a registry problem. A similar problem was [reported by Tim Barcz](http://www.timbarcz.com/blog/NantSetupForVisualStudio2008AndNet35.aspx). Things ...
241,063
<p>I have a site that uses paypal to collect payments for electronically displayed data. Variables can't be passed with the URL through paypal (or I can't get them to work) so I have used cookies to pass the item number. However, a crafty user could, after the cookie writing part, enter the paypal redirect URL directly...
[ { "answer_id": 241074, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 4, "selected": false, "text": "<p>I don't think you're going to be able to do what you want in a single step with the approach you're taking because your c...
2008/10/27
[ "https://Stackoverflow.com/questions/241063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a site that uses paypal to collect payments for electronically displayed data. Variables can't be passed with the URL through paypal (or I can't get them to work) so I have used cookies to pass the item number. However, a crafty user could, after the cookie writing part, enter the paypal redirect URL directly in...
I don't think you're going to be able to do what you want in a single step with the approach you're taking because your code has no way of knowing if the transaction actually finished successfully or not. I think the only way the above approach will work is if you don't automatically send them over to the file they pa...
241,083
<p>I used to have a class in 1.1 for the Datagrid that inherited from the DataGridColumn class. This allowed me to create a check box column with a client-side un/check-all box in the header. Then as I designed my grid I would just add my custom column.</p> <p>I am currently on a project where I need similar functiona...
[ { "answer_id": 241127, "author": "devio", "author_id": 21336, "author_profile": "https://Stackoverflow.com/users/21336", "pm_score": 1, "selected": false, "text": "<p>I derived classes from System.Web.UI.WebControls.BoundField and .HyperLinkField\nYou might be interested in inheriting fr...
2008/10/27
[ "https://Stackoverflow.com/questions/241083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30492/" ]
I used to have a class in 1.1 for the Datagrid that inherited from the DataGridColumn class. This allowed me to create a check box column with a client-side un/check-all box in the header. Then as I designed my grid I would just add my custom column. I am currently on a project where I need similar functionality for t...
I inherited the BoundField and came up with this: Page Code: ``` <%@ register tagprefix="CAC" namespace="UI.Controls" assembly="UI.Controls" %> <asp:gridview id="grdPrint" runat="server" autogeneratecolumns="False"> <columns> <cac:checkallcolumn /> <asp:boundfield datafield="CompanyName" heade...
241,086
<p>I am setting up an Oracle connection for NHibernate for the first time. I have copied the Oracle.DataAccess.dll file into my bin folder. No matter what I try, I keep getting the same error:</p> <pre><code>Could not load type &gt;NHibernate.Driver.OracleDataClientDriver. Possible cause: no assembly name specified. ...
[ { "answer_id": 241129, "author": "Miki Watts", "author_id": 16172, "author_profile": "https://Stackoverflow.com/users/16172", "pm_score": 4, "selected": true, "text": "<p>Did you copy and paste the code? because there's an extra > in there, in the connection.driver_class line</p>\n" },...
2008/10/27
[ "https://Stackoverflow.com/questions/241086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
I am setting up an Oracle connection for NHibernate for the first time. I have copied the Oracle.DataAccess.dll file into my bin folder. No matter what I try, I keep getting the same error: ``` Could not load type >NHibernate.Driver.OracleDataClientDriver. Possible cause: no assembly name specified. ``` I am using ...
Did you copy and paste the code? because there's an extra > in there, in the connection.driver\_class line
241,088
<p>I have some Java code that uses curly braces in two ways</p> <pre><code>// Curly braces attached to an 'if' statement: if(node.getId() != null) { node.getId().apply(this); } // Curly braces by themselves: { List&lt;PExp&gt; copy = new ArrayList&lt;PExp&gt;(node.getArgs()); for(PExp e : copy) { ...
[ { "answer_id": 241090, "author": "Paweł Hajdan", "author_id": 9403, "author_profile": "https://Stackoverflow.com/users/9403", "pm_score": 2, "selected": false, "text": "<p>They make an inner scope. Variable declared inside these braces is not visible outside of them. This also applies to...
2008/10/27
[ "https://Stackoverflow.com/questions/241088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85/" ]
I have some Java code that uses curly braces in two ways ``` // Curly braces attached to an 'if' statement: if(node.getId() != null) { node.getId().apply(this); } // Curly braces by themselves: { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for(PExp e : copy) { e.apply(this); } }...
The only purpose of the extra braces is to provide scope-limit. The `List<PExp> copy` will only exist within those braces, and will have no scope outside of them. If this is generated code, I assume the code-generator does this so it can insert some code (such as this) without having to worry about how many times it h...
241,100
<p>I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let's say after a button is clicked.</p> <p>The reason I need this is I have set SelectionMode to FullRowSelect and I need to click 2-3 times to open the combo b...
[ { "answer_id": 241218, "author": "thismat", "author_id": 14045, "author_profile": "https://Stackoverflow.com/users/14045", "pm_score": 6, "selected": true, "text": "<p>I know this can't be the ideal solution but it does create a single click combo box that works within the cell.</p>\n\n<...
2008/10/27
[ "https://Stackoverflow.com/questions/241100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20353/" ]
I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let's say after a button is clicked. The reason I need this is I have set SelectionMode to FullRowSelect and I need to click 2-3 times to open the combo box. I want...
I know this can't be the ideal solution but it does create a single click combo box that works within the cell. ``` Private Sub cell_Click(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick DataGridView1.BeginEdit(True) If DataGridView1.Rows(e.RowInd...
241,134
<p>I was recently working with a <code>DateTime</code> object, and wrote something like this:</p> <pre><code>DateTime dt = DateTime.Now; dt.AddDays(1); return dt; // still today's date! WTF? </code></pre> <p>The intellisense documentation for <code>AddDays()</code> says it adds a day to the date, which it doesn't - i...
[ { "answer_id": 241138, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 6, "selected": false, "text": "<p>I saw this one posted the other day, and I think it is pretty obscure, and painful for those that don't know</p...
2008/10/27
[ "https://Stackoverflow.com/questions/241134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14606/" ]
I was recently working with a `DateTime` object, and wrote something like this: ``` DateTime dt = DateTime.Now; dt.AddDays(1); return dt; // still today's date! WTF? ``` The intellisense documentation for `AddDays()` says it adds a day to the date, which it doesn't - it actually *returns* a date with a day added to ...
``` private int myVar; public int MyVar { get { return MyVar; } } ``` Blammo. Your app crashes with no stack trace. Happens all the time. (Notice capital `MyVar` instead of lowercase `myVar` in the getter.)
241,142
<p>i want to be a good developer citizen, <a href="http://blogs.msdn.com/oldnewthing/archive/2005/08/22/454487.aspx" rel="nofollow noreferrer">pay my taxes</a>, and disable things if we're running over Remote Desktop, or running on battery.</p> <p>If we're running over remote desktop (or equivalently in a Terminal ser...
[ { "answer_id": 241157, "author": "Igal Tabachnik", "author_id": 8205, "author_profile": "https://Stackoverflow.com/users/8205", "pm_score": 0, "selected": false, "text": "<p>You could use WMI (Windows Management Instrumentation) to query the operating system about the battery status.</p>...
2008/10/27
[ "https://Stackoverflow.com/questions/241142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
i want to be a good developer citizen, [pay my taxes](http://blogs.msdn.com/oldnewthing/archive/2005/08/22/454487.aspx), and disable things if we're running over Remote Desktop, or running on battery. If we're running over remote desktop (or equivalently in a Terminal server session), we must disable animations and do...
I believe you can check [SystemInformation.PowerStatus](http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.powerstatus(VS.80).aspx) to see if it's on battery or not. ``` Boolean isRunningOnBattery = (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == PowerLi...
241,144
<p>I know that this is a very specific C++ and Qt related question, but maybe someone can help me, anyway ...</p> <p>See the code below: I want to display an image within a scroll area. The view port of the scroll area shall have a defined initial size. That means, if the image's size is bigger than the initial size o...
[ { "answer_id": 243561, "author": "Caleb Huitt - cjhuitt", "author_id": 9876, "author_profile": "https://Stackoverflow.com/users/9876", "pm_score": 0, "selected": false, "text": "<p>I don't think you can do exactly that very easily, which is (if I'm reading correctly), size the widget so ...
2008/10/27
[ "https://Stackoverflow.com/questions/241144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2012356/" ]
I know that this is a very specific C++ and Qt related question, but maybe someone can help me, anyway ... See the code below: I want to display an image within a scroll area. The view port of the scroll area shall have a defined initial size. That means, if the image's size is bigger than the initial size of the view...
I think that you are looking at the problem the wrong way. The QScrollArea is just a widget that you put in a frame or QMainWindow. The size of the widget is controlled by the layout of the widget that contains it. Take a look at this example from Trolltech: [Image Viewer Example](http://doc.qt.io/qt-5/qtwidgets-widge...
241,145
<p>How do you create a simple, custom rule using the jQuery Validate plugin (using <a href="http://jqueryvalidation.org/jQuery.validator.addMethod" rel="noreferrer"><code>addMethod</code></a>) that doesn't use a regex?</p> <p>For example, what function would create a rule that validates only if at least one of a group...
[ { "answer_id": 241202, "author": "Mark Spangler", "author_id": 456684, "author_profile": "https://Stackoverflow.com/users/456684", "pm_score": 9, "selected": false, "text": "<p>You can create a simple rule by doing something like this:</p>\n\n<pre><code>jQuery.validator.addMethod(\"great...
2008/10/27
[ "https://Stackoverflow.com/questions/241145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31869/" ]
How do you create a simple, custom rule using the jQuery Validate plugin (using [`addMethod`](http://jqueryvalidation.org/jQuery.validator.addMethod)) that doesn't use a regex? For example, what function would create a rule that validates only if at least one of a group of checkboxes is checked?
You can create a simple rule by doing something like this: ``` jQuery.validator.addMethod("greaterThanZero", function(value, element) { return this.optional(element) || (parseFloat(value) > 0); }, "* Amount must be greater than zero"); ``` And then applying this like so: ``` $('validatorElement').validate({ ...
241,150
<p>I want to filter the selectable dates on a datepicker. I basically need to filter by work days - i.e. make holidays and weekends not selectable.</p> <p>I know you can specify dates using a function in the beforeShowDate: and you can also use $.datepicker.noWeekends.</p> <p>Question is: can you do both?</p>
[ { "answer_id": 241244, "author": "Randy", "author_id": 9361, "author_profile": "https://Stackoverflow.com/users/9361", "pm_score": 4, "selected": true, "text": "<p>$.datepicker.noWeekends is a pretty simple bit of code:</p>\n\n<pre><code>function (date) { \n var day = date.getDay(); \...
2008/10/27
[ "https://Stackoverflow.com/questions/241150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1075/" ]
I want to filter the selectable dates on a datepicker. I basically need to filter by work days - i.e. make holidays and weekends not selectable. I know you can specify dates using a function in the beforeShowDate: and you can also use $.datepicker.noWeekends. Question is: can you do both?
$.datepicker.noWeekends is a pretty simple bit of code: ``` function (date) { var day = date.getDay(); return [day > 0 && day < 6, ""]; } ``` Since you're going to have to write up the function for holidays, you can just include this logic in that function too.
241,166
<p>Question: Is there any reason Autocomplete=off on a ASP:Textbox would not be working in IE 7?</p> <p>In case this is the best term for it, the IE Autocomplete feature is that drop down list like thing that drops down from textboxes and shows you past things you have typed in.</p> <p>I need the IE Autocomplete feat...
[ { "answer_id": 241172, "author": "BoboTheCodeMonkey", "author_id": 30532, "author_profile": "https://Stackoverflow.com/users/30532", "pm_score": 1, "selected": false, "text": "<p>Try this one:</p>\n\n<pre><code>someTextbox.Attributes.Add(\"autocomplete\", \"off\");\n</code></pre>\n" },...
2008/10/27
[ "https://Stackoverflow.com/questions/241166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21691/" ]
Question: Is there any reason Autocomplete=off on a ASP:Textbox would not be working in IE 7? In case this is the best term for it, the IE Autocomplete feature is that drop down list like thing that drops down from textboxes and shows you past things you have typed in. I need the IE Autocomplete feature to not work a...
Trying to clear out my unanswered questions that I've answered in the original post. ``` test.AutoCompleteType = AutoCompleteType.None; ```
241,185
<p>I'd like to write a MessageConverter class that can wrap another MessageConverter. This MessageConverter would call the child converter, which is assumed to generate a TextMessage. It would take the payload and GZIP compress it, creating a BytesMessage which is ultimately returned to the sender.</p> <p>The problem ...
[ { "answer_id": 241695, "author": "nsayer", "author_id": 13757, "author_profile": "https://Stackoverflow.com/users/13757", "pm_score": 2, "selected": true, "text": "<p>So I did, in fact, make one of these:</p>\n\n<pre><code> private static class FakeTextMessage implements TextMessage {...
2008/10/27
[ "https://Stackoverflow.com/questions/241185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13757/" ]
I'd like to write a MessageConverter class that can wrap another MessageConverter. This MessageConverter would call the child converter, which is assumed to generate a TextMessage. It would take the payload and GZIP compress it, creating a BytesMessage which is ultimately returned to the sender. The problem is in writ...
So I did, in fact, make one of these: ``` private static class FakeTextMessage implements TextMessage { public FakeTextMessage(Message m) { this.childMessage = m; } private String text; private Message childMessage; public void setText(String t) { this.text = t; } ...
241,193
<p>Is there a .dll version of the <a href="http://t3.dotgnu.info/blog/php/messy-programmers-beware.html" rel="nofollow noreferrer">inclued</a> extension for <a href="http://us2.php.net/manual/en/intro.inclued.php" rel="nofollow noreferrer">PHP</a>? The manual's link for <a href="http://pecl4win.php.net/ext.php/php_incl...
[ { "answer_id": 241219, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 0, "selected": false, "text": "<p>Isn't this their DLL download site? <a href=\"http://pecl4win.php.net/list_dlls.php\" rel=\"nofollow noreferrer\">http://p...
2008/10/27
[ "https://Stackoverflow.com/questions/241193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24181/" ]
Is there a .dll version of the [inclued](http://t3.dotgnu.info/blog/php/messy-programmers-beware.html) extension for [PHP](http://us2.php.net/manual/en/intro.inclued.php)? The manual's link for [Inclued on PECL4WIN](http://pecl4win.php.net/ext.php/php_inclued.dll) doesn't help. I don't have a compiler to build my own D...
Which version of PHP are you running? I know someone that can compile you a version. update ------ Alright, got this compiled - I've tested on my 5.2.6 build and it seems to work fine. I've been told there may be problems using it in a threaded environment (e.g. Windows) but that's only a maybe. Also: ``` [13:10] <...
241,236
<p>I'm trying to use the Grid from WPFToolkit, but I'm getting the error:</p> <pre><code>DisplayDataMapping.xaml (9,89): errorMC1000: Unknown build error, 'Could not load type 'System.Windows.Controls.Primitives.MultiSelector' from assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral, Public...
[ { "answer_id": 242381, "author": "Alex Janzik", "author_id": 22038, "author_profile": "https://Stackoverflow.com/users/22038", "pm_score": 2, "selected": false, "text": "<p>The WPF Toolkit is dependent on .NET Framework 3.5 SP1 (just in case you don't know already).</p>\n" }, { "...
2008/10/27
[ "https://Stackoverflow.com/questions/241236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to use the Grid from WPFToolkit, but I'm getting the error: ``` DisplayDataMapping.xaml (9,89): errorMC1000: Unknown build error, 'Could not load type 'System.Windows.Controls.Primitives.MultiSelector' from assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3...
The WPF Toolkit is dependent on .NET Framework 3.5 SP1 (just in case you don't know already).
241,238
<p>Could someone supply some code that would get the xpath of a System.Xml.XmlNode instance?</p> <p>Thanks!</p>
[ { "answer_id": 241251, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>There's no such thing as \"the\" xpath of a node. For any given node there may well be many xpath expressions which w...
2008/10/27
[ "https://Stackoverflow.com/questions/241238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5653/" ]
Could someone supply some code that would get the xpath of a System.Xml.XmlNode instance? Thanks!
Okay, I couldn't resist having a go at it. It'll only work for attributes and elements, but hey... what can you expect in 15 minutes :) Likewise there may very well be a cleaner way of doing it. It is superfluous to include the index on every element (particularly the root one!) but it's easier than trying to work out...
241,285
<p>I'm developing an algorithm to parse a number out of a series of short-ish strings. These strings are somewhat regular, but there's a few different general forms and several exceptions. I'm trying to build a set of regexes that will handle the various forms and exceptions; I'll apply them one after another to see if...
[ { "answer_id": 241288, "author": "Kip", "author_id": 18511, "author_profile": "https://Stackoverflow.com/users/18511", "pm_score": 2, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>X (\\(Y\\))? Z\n</code></pre>\n" }, { "answer_id": 241292, "author": "Konrad Rudolp...
2008/10/27
[ "https://Stackoverflow.com/questions/241285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3488/" ]
I'm developing an algorithm to parse a number out of a series of short-ish strings. These strings are somewhat regular, but there's a few different general forms and several exceptions. I'm trying to build a set of regexes that will handle the various forms and exceptions; I'll apply them one after another to see if I ...
``` (\d+)\s+(\(.*?\))?\s?Z ``` Note the escaped parentheses, and the `?` (zero or once) quantifiers. Any of the groups you don't want to capture can be (`?:` non-capture groups). I agree about the spaces. `\s` is a better option there. I also changed the quantifier to insure there are digits at the beginning. As far...
241,311
<p>The question is if a database connection should be passed in by reference or by value?</p> <p>For me I'm specifically questioning a PHP to MySQL connection, but I think it applies to all databases.</p> <p>I have heard that in PHP when you pass a variable to a function or object, that it is copied in memory and the...
[ { "answer_id": 241330, "author": "TJ L", "author_id": 12605, "author_profile": "https://Stackoverflow.com/users/12605", "pm_score": 3, "selected": false, "text": "<p>Call-time pass-by-reference is being depreciated,so I wouldn't use the method first described. Also, generally speaking, ...
2008/10/27
[ "https://Stackoverflow.com/questions/241311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
The question is if a database connection should be passed in by reference or by value? For me I'm specifically questioning a PHP to MySQL connection, but I think it applies to all databases. I have heard that in PHP when you pass a variable to a function or object, that it is copied in memory and therefore uses twice...
A PHP resource is a special type that already is a reference in itself. Passing it by value or explicitly by reference won't make a difference (ie, it's still a reference). You can check this for yourself under PHP4: ``` function get_connection() { $test = mysql_connect('localhost', 'user', 'password'); mysql_sele...
241,325
<p>When using <code>grep --color=always</code> I can get pretty color highlighting for regex matches.</p> <p>However, <code>grep</code> only returns lines with at least one match. Instead, I am looking for a way to simply highlight regex matches, while leaving all other input alone, without dropping lines without any...
[ { "answer_id": 241390, "author": "boxxar", "author_id": 15732, "author_profile": "https://Stackoverflow.com/users/15732", "pm_score": 2, "selected": false, "text": "<p>This little function works well in my ZShell:</p>\n\n<pre><code>function color_grep {\n sed s/$1/$fg[yellow]$1$termin...
2008/10/27
[ "https://Stackoverflow.com/questions/241325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29701/" ]
When using `grep --color=always` I can get pretty color highlighting for regex matches. However, `grep` only returns lines with at least one match. Instead, I am looking for a way to simply highlight regex matches, while leaving all other input alone, without dropping lines without any matches. I have tried to get co...
The simplest solution would be to use `egrep --color=always 'text|^'` which would match all line beginnings but only color the desired text.
241,327
<p>I'm looking for Python code that removes C and C++ comments from a string. (Assume the string contains an entire C source file.)</p> <p>I realize that I could .match() substrings with a Regex, but that doesn't solve nesting <code>/*</code>, or having a <code>//</code> inside a <code>/* */</code>.</p> <p>Ideally, I...
[ { "answer_id": 241329, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": false, "text": "<p>C (and C++) comments cannot be nested. Regular expressions work well:</p>\n\n<pre><code>//.*?\\n|/\\*.*?\\*/\n</co...
2008/10/27
[ "https://Stackoverflow.com/questions/241327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26251/" ]
I'm looking for Python code that removes C and C++ comments from a string. (Assume the string contains an entire C source file.) I realize that I could .match() substrings with a Regex, but that doesn't solve nesting `/*`, or having a `//` inside a `/* */`. Ideally, I would prefer a non-naive implementation that prop...
I don't know if you're familiar with `sed`, the UNIX-based (but Windows-available) text parsing program, but I've found a sed script [here](http://sed.sourceforge.net/grabbag/scripts/remccoms3.sed) which will remove C/C++ comments from a file. It's very smart; for example, it will ignore '//' and '/\*' if found in a st...
241,334
<p>I need to to iterate over the files in a directory and perform the following replacement.</p> <p><strong>Before:</strong></p> <blockquote> <p>Hello ${USER_NAME}, you live at ${HOME_ADDRESS}. It is now ${TIME}</p> </blockquote> <p><strong>After:</strong></p> <blockquote> <p>Hello ${userName}, you live at ...
[ { "answer_id": 241350, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": true, "text": "<p>The <code>-i</code> flag to sed will edit a file in-place. For XXX and YYY, you would use something like:</p>\n\n<pre><...
2008/10/27
[ "https://Stackoverflow.com/questions/241334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
I need to to iterate over the files in a directory and perform the following replacement. **Before:** > > Hello ${USER\_NAME}, you live at > ${HOME\_ADDRESS}. It is now ${TIME} > > > **After:** > > Hello ${userName}, you live at > ${homeAddress}. It is now ${time} > > > The number of different tokens tha...
The `-i` flag to sed will edit a file in-place. For XXX and YYY, you would use something like: ``` sed -i 's/USER_NAME/userName/g' ``` and so on. Update: I see that your question was really about changing "USER\_NAME" into "userName" automatically. You could try this Perl script: ``` sub convert { my $r = lc $...
241,339
<p>Here's what <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members" rel="noreferrer">MSDN has to say under <em>When to Use Static Classes</em></a>:</p> <blockquote> <pre><code>static class CompanyInfo { public static string GetCompa...
[ { "answer_id": 241351, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 5, "selected": false, "text": "<p>For C# 3.0, extension methods may only exist in top-level static classes.</p>\n" }, { "answer_id": 241369, ...
2008/10/27
[ "https://Stackoverflow.com/questions/241339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266/" ]
Here's what [MSDN has to say under *When to Use Static Classes*](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members): > > > ``` > static class CompanyInfo > { > public static string GetCompanyName() { return "CompanyName"; } > public ...
I wrote my thoughts of static classes in an earlier Stack Overflow answer: *[Class with single method -- best approach?](https://stackoverflow.com/questions/205689/class-with-single-method-best-approach#206481)* I used to love utility classes filled up with static methods. They made a great consolidation of helper met...
241,341
<p>(Bear with me, I promise this gets to shebang and windows.)</p> <p>I have about the simplest of WEBRick servers put together:</p> <pre><code>require 'webrick' include WEBrick s = HTTPServer.new(:Port=&gt;2000, :DocumentRoot=&gt;Dir::pwd) s.start </code></pre> <p>Couldn't be simpler. This basic server does accep...
[ { "answer_id": 241500, "author": "Onorio Catenacci", "author_id": 2820, "author_profile": "https://Stackoverflow.com/users/2820", "pm_score": 3, "selected": true, "text": "<p>I think what you want is to associate the file extension with Ruby. I don't think it's possible to get the !# no...
2008/10/27
[ "https://Stackoverflow.com/questions/241341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30997/" ]
(Bear with me, I promise this gets to shebang and windows.) I have about the simplest of WEBRick servers put together: ``` require 'webrick' include WEBrick s = HTTPServer.new(:Port=>2000, :DocumentRoot=>Dir::pwd) s.start ``` Couldn't be simpler. This basic server does accept http connections (firefox, internet ex...
I think what you want is to associate the file extension with Ruby. I don't think it's possible to get the !# notation to work on Windows but it is possible to get Windows to automatically launch a script with a particular interpreter (as in your second example). A good step by step discussion of what you'd want to do ...
241,388
<p>I'm looking at the following code snippet:</p> <pre><code>my @ret = &lt;someMethod&gt; return (undef) if( $DB_ERROR ); return (undef) unless ($#ret &gt;= 0); </code></pre> <p>Does <code>$#</code> just give you a count of elements in a array?</p>
[ { "answer_id": 241394, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 7, "selected": true, "text": "<p><code>$#arrayname</code> gives you the index of the last element, so if array <code>@ret</code> has 2 elements then <co...
2008/10/27
[ "https://Stackoverflow.com/questions/241388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31301/" ]
I'm looking at the following code snippet: ``` my @ret = <someMethod> return (undef) if( $DB_ERROR ); return (undef) unless ($#ret >= 0); ``` Does `$#` just give you a count of elements in a array?
`$#arrayname` gives you the index of the last element, so if array `@ret` has 2 elements then `$#ret` is 1. And, as noted by Barry Brown, an empty array gives -1. To get the length you can use the array in scalar context: ``` print scalar @ret; ```
241,396
<p>I produce server software and have been fine with all Linux environments so far, both for production and as deployment target. However, I want to provide a broader choice of target environments in the future and I'm also planning features that would consume and produce Office documents.</p> <p>As a first step, I am...
[ { "answer_id": 241394, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 7, "selected": true, "text": "<p><code>$#arrayname</code> gives you the index of the last element, so if array <code>@ret</code> has 2 elements then <co...
2008/10/27
[ "https://Stackoverflow.com/questions/241396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
I produce server software and have been fine with all Linux environments so far, both for production and as deployment target. However, I want to provide a broader choice of target environments in the future and I'm also planning features that would consume and produce Office documents. As a first step, I am looking f...
`$#arrayname` gives you the index of the last element, so if array `@ret` has 2 elements then `$#ret` is 1. And, as noted by Barry Brown, an empty array gives -1. To get the length you can use the array in scalar context: ``` print scalar @ret; ```
241,397
<p>How do you answer the following questions from managers, testers and other people in your team:</p> <p>In what build is bug #829 fixed? What tasks have been completed in our current test build?</p> <p>So simply put, how do you achieve traceability of your requirements, tasks and bugs right from them being reported...
[ { "answer_id": 241404, "author": "David Segonds", "author_id": 13673, "author_profile": "https://Stackoverflow.com/users/13673", "pm_score": 0, "selected": false, "text": "<p>We are tagging the source control check-in with the defect number that has been fixed or the enhancement number t...
2008/10/27
[ "https://Stackoverflow.com/questions/241397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30874/" ]
How do you answer the following questions from managers, testers and other people in your team: In what build is bug #829 fixed? What tasks have been completed in our current test build? So simply put, how do you achieve traceability of your requirements, tasks and bugs right from them being reported reporting throug...
We use [TRAC](http://trac.edgewall.org/) with [SVN](http://subversion.tigris.org/) in our Company and perform daily rolling builds to DEV / STAGING & STABLE environments with regular scheduled deployments (once a month... ish) to a PRODUCTION Environment. When a bug is reported, it's entered into TRAC and given a Tick...
241,402
<p>I'm wanting to add a class to the body tag without waiting for the DOM to load, but I'm wanting to know if the following approach would be valid. I'm more concerned with validity than whether the browsers support it for now.</p> <pre><code>&lt;body&gt; $("body").addClass("active"); ... &lt;/body&gt; </code></pr...
[ { "answer_id": 241418, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>If the element doesn't exist in the DOM, the search will fail to find it and the action won't be applied. If you c...
2008/10/27
[ "https://Stackoverflow.com/questions/241402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16124/" ]
I'm wanting to add a class to the body tag without waiting for the DOM to load, but I'm wanting to know if the following approach would be valid. I'm more concerned with validity than whether the browsers support it for now. ``` <body> $("body").addClass("active"); ... </body> ``` Thanks, Steve
The [.elementReady() plugin](http://plugins.jquery.com/project/elementReady) seems to be pretty close to what you're looking for. It operates by using a `setInterval` loop, that exits as soon as `document.getElementById()` returns an element for a given `id`. You could probably do a slight modification of that plugin...
241,405
<p>I have a string that I need to convert to the equivalent array of bytes in .NET. </p> <p>This ought to be easy, but I am having a brain cramp.</p>
[ { "answer_id": 241408, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 8, "selected": true, "text": "<p><a href=\"https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding?redirectedfrom=MSDN&amp;view=netframewo...
2008/10/27
[ "https://Stackoverflow.com/questions/241405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23862/" ]
I have a string that I need to convert to the equivalent array of bytes in .NET. This ought to be easy, but I am having a brain cramp.
[You need to use an encoding](https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding?redirectedfrom=MSDN&view=netframework-4.7.2) (`System.Text.Encoding`) to tell .NET what you expect as the output. For example, in [UTF-16 (= `System.Text.Encoding.Unicode`)](https://learn.microsoft.com/en-us/dotnet/api/syste...
241,407
<p>For this xml (in a SQL 2005 XML column): </p> <pre><code>&lt;doc&gt; &lt;a&gt;1&lt;/a&gt; &lt;b ba="1" bb="2" bc="3" /&gt; &lt;c bd="3"/&gt; &lt;doc&gt; </code></pre> <p>I'd like to be able to retrieve the names of the attributes (ba, bb, bc, bd) rather than the values <em>inside SQL Server 2005</em>. Well, X...
[ { "answer_id": 241687, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 4, "selected": true, "text": "<pre><code>DECLARE @xml as xml\nDECLARE @path as varchar(max)\nDECLARE @index int, @count int\n\nSET @xml = \n'&lt;doc&gt;\n...
2008/10/27
[ "https://Stackoverflow.com/questions/241407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30946/" ]
For this xml (in a SQL 2005 XML column): ``` <doc> <a>1</a> <b ba="1" bb="2" bc="3" /> <c bd="3"/> <doc> ``` I'd like to be able to retrieve the names of the attributes (ba, bb, bc, bd) rather than the values *inside SQL Server 2005*. Well, XPath certainly allows this with name() but SQL doesn't support that. Th...
``` DECLARE @xml as xml DECLARE @path as varchar(max) DECLARE @index int, @count int SET @xml = '<doc> <a>1</a> <b ba="1" bb="2" bc="3" /> <c bd="3"/> </doc>' SELECT @index = 1 SET @count = @xml.query('count(/doc/b/@*)').value('.','int') WHILE @index <= @count BEGIN SELECT @xml.value('local-name((/doc/b/@...
241,425
<p>I'm also interested in other Symbian SDKs that allow to set their emulator's IMEI.</p>
[ { "answer_id": 243026, "author": "michael aubert", "author_id": 17867, "author_profile": "https://Stackoverflow.com/users/17867", "pm_score": 0, "selected": false, "text": "<p>I have never actually tried that but here's my best guess:</p>\n\n<p>The emulator doesn't have a proper telephon...
2008/10/27
[ "https://Stackoverflow.com/questions/241425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15647/" ]
I'm also interested in other Symbian SDKs that allow to set their emulator's IMEI.
Emulator has hardcoded IMEI of '000000000000000'. Replace what with whatever you want to use and continue running your code. Symbian C++: ``` TPlpVariantMachineId imei; PlpVariant::GetMachineIdL(imei); imei.Copy(_L("123456789012345")); ``` Python for S60 (PyS60): ``` import sysinfo my_imei = s...
241,453
<p>I'm experimenting with JavaFX making a small game. </p> <p>I want to add sound. How?</p> <p>I tried <code>MediaPlayer</code> with <code>media</code> defined with relative <code>source</code> attribute like:</p> <pre><code>attribute media = Media{ source: "{__FILE__}/sound/hormpipe.mp3" } attribute pla...
[ { "answer_id": 247606, "author": "GuyWithDogs", "author_id": 9520, "author_profile": "https://Stackoverflow.com/users/9520", "pm_score": 1, "selected": false, "text": "<p>Just a guess, but is that file \"hornpipe.mp3\" and not \"hormpipe.mp3\" (with an m)?</p>\n" }, { "answer_id"...
2008/10/27
[ "https://Stackoverflow.com/questions/241453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1514822/" ]
I'm experimenting with JavaFX making a small game. I want to add sound. How? I tried `MediaPlayer` with `media` defined with relative `source` attribute like: ``` attribute media = Media{ source: "{__FILE__}/sound/hormpipe.mp3" } attribute player = MediaPlayer{ autoPlay:true media:media } ``` ...
Just a guess, but is that file "hornpipe.mp3" and not "hormpipe.mp3" (with an m)?
241,470
<p>I am designing a simple internal framework for handling time series data. Given that LINQ is my current toy hammer, I want to hit everything with it.</p> <p>I want to implement methods in class TimeSeries (Select(), Where() and so on) so that I can use LINQ syntax to handle time series data</p> <p>Some things are ...
[ { "answer_id": 241478, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p><code>Union</code> sounds like the right way to go - no query expression support, but I think it expresses what you m...
2008/10/27
[ "https://Stackoverflow.com/questions/241470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31890/" ]
I am designing a simple internal framework for handling time series data. Given that LINQ is my current toy hammer, I want to hit everything with it. I want to implement methods in class TimeSeries (Select(), Where() and so on) so that I can use LINQ syntax to handle time series data Some things are straight forward,...
If I'm understanding the question correctly, you want to join multiple sequences based on their position within the sequence? There isn't anything in the `System.Linq.Enumerable` class to do this as both the `Join` and `GroupJoin` methods are based on join keys. However, by coincidence I wrote a `PositionalJoin` metho...
241,512
<p>My HTML is as follows:</p> <pre><code>&lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="./"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/About"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/Contact"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And my css:</p> <pre><code>#nav { ...
[ { "answer_id": 241523, "author": "thismat", "author_id": 14045, "author_profile": "https://Stackoverflow.com/users/14045", "pm_score": 6, "selected": true, "text": "<p>Several options here, first I'll give you my normal practice when creating inline lists:</p>\n\n<pre><code>&lt;ul id=\"n...
2008/10/27
[ "https://Stackoverflow.com/questions/241512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My HTML is as follows: ``` <ul id="nav"> <li><a href="./">Home</a></li> <li><a href="/About">About</a></li> <li><a href="/Contact">Contact</a></li> </ul> ``` And my css: ``` #nav { display: inline; } ``` However the whitespace between the li's shows up. I can remove the whitespace by collapsing th...
Several options here, first I'll give you my normal practice when creating inline lists: ``` <ul id="navigation"> <li><a href="#" title="">Home</a></li> <li><a href="#" title="">Home</a></li> <li><a href="#" title="">Home</a></li> </ul> ``` Then the CSS to make it function as you intend: ``` #navigation li ...
241,526
<p>I've been tasked with build an accessible RSS feed for my company's job listings. I already have an RSS feed from our recruiting partner; so I'm transforming their RSS XML to our own proxy RSS feed to add additional data as well limit the number of items in the feed so we list on the latest jobs.</p> <p>The RSS val...
[ { "answer_id": 241562, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>I would do something like this:</p>\n\n<pre><code>char[] charToRemove = { (char)8217, (char)8216, (char)8220, (char)8221, (...
2008/10/27
[ "https://Stackoverflow.com/questions/241526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10922/" ]
I've been tasked with build an accessible RSS feed for my company's job listings. I already have an RSS feed from our recruiting partner; so I'm transforming their RSS XML to our own proxy RSS feed to add additional data as well limit the number of items in the feed so we list on the latest jobs. The RSS validates via...
I haven't yet worked with WordML, but assuming that its elements are in a different namespace from RSS, it should be quite simple to do with XSLT. Start with a basic identity transform (a stylesheet that add all nodes from the input doc "as is" to the output tree). You need these two templates: ``` <!-- Copy all el...
241,533
<p>I want to write a program that would print every combination of a set of variables to a text file, creating a word list. Each answer should be written on a separate line and write all of the results for 1 digit, 2 digits, and 3 digits to a single text file.</p> <p>Is there a simple way I can write a python program ...
[ { "answer_id": 241542, "author": "wprl", "author_id": 17847, "author_profile": "https://Stackoverflow.com/users/17847", "pm_score": 2, "selected": false, "text": "<p>It shouldn't be too hard in most languages. Does the following pseudo-code help?</p>\n\n<pre><code>for(int i=0; i &lt; 2^...
2008/10/27
[ "https://Stackoverflow.com/questions/241533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to write a program that would print every combination of a set of variables to a text file, creating a word list. Each answer should be written on a separate line and write all of the results for 1 digit, 2 digits, and 3 digits to a single text file. Is there a simple way I can write a python program that can a...
A naïve solution which solves the problem and is general enough for any application you might have is this: ``` def combinations(words, length): if length == 0: return [] result = [[word] for word in words] while length > 1: new_result = [] for combo in result: new_resul...
241,539
<p>I am extending a class defined in a library which I cannot change:</p> <pre><code>public class Parent { public void init(Map properties) { ... } } </code></pre> <p>If I am defining a class 'Child' that extends Parent and I am using Java 6 with generics, what is the best way to override the init method without ...
[ { "answer_id": 241921, "author": "Vladimir Dyuzhev", "author_id": 1163802, "author_profile": "https://Stackoverflow.com/users/1163802", "pm_score": 2, "selected": false, "text": "<p>Short answer: no way to do that.</p>\n\n<p>Unsatisfying answer: disable the (specific) warnings in your ID...
2008/10/27
[ "https://Stackoverflow.com/questions/241539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16399/" ]
I am extending a class defined in a library which I cannot change: ``` public class Parent { public void init(Map properties) { ... } } ``` If I am defining a class 'Child' that extends Parent and I am using Java 6 with generics, what is the best way to override the init method without getting unchecked warnings...
Yes, you have to declare the overriding method with the same signature as in the parent class, without adding any generics info. I think your best bet is to add the `@SuppressWarnings("unchecked")` annotation to the raw-type parameter, not the method, so you won't squelch other generics warnings you might have in your...
241,550
<p>What are some good jQuery Resources along with some gotchas when using it with ASP.Net?</p>
[ { "answer_id": 241588, "author": "Adam Lassek", "author_id": 1249, "author_profile": "https://Stackoverflow.com/users/1249", "pm_score": 3, "selected": false, "text": "<p>ASP.Net's autogenerated id's make using jQuery's selector syntax somewhat difficult.</p>\n\n<p>Two easy ways around t...
2008/10/27
[ "https://Stackoverflow.com/questions/241550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26931/" ]
What are some good jQuery Resources along with some gotchas when using it with ASP.Net?
One thing to note is that if you use WebMethods for Ajax, the response values will be returned wrapped in an object named 'd' for security reasons. You will have to unwrap that value, which is usually not a problem, unless you are using a component (such as the jqGrid plugin) that relies upon jquery ajax. To get around...
241,576
<p>Reporting Services 2000 Standard Edition (currently RTM but hope to have SP2 soon).</p> <p>I have a report which takes in a parameter - PlantID</p> <p>I'd like to email a pdf of this report every month to the 80 different plant managers</p> <p>So I have a table:</p> <pre><code>PlantID ManagerEmail 1 ...
[ { "answer_id": 241729, "author": "Jared", "author_id": 3442, "author_profile": "https://Stackoverflow.com/users/3442", "pm_score": 0, "selected": false, "text": "<p>That would be my first thought on how to do it also.</p>\n\n<p>You might also be able to set up a scheduled stored proc to ...
2008/10/27
[ "https://Stackoverflow.com/questions/241576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26086/" ]
Reporting Services 2000 Standard Edition (currently RTM but hope to have SP2 soon). I have a report which takes in a parameter - PlantID I'd like to email a pdf of this report every month to the 80 different plant managers So I have a table: ``` PlantID ManagerEmail 1 BillySmith@company.com 2 F...
A Data-Driven Subscription would be the ideal answer, but I see that Data-Driven Subscriptions are not available in RS 2000 Standard. [This Article](http://www.codeproject.com/KB/database/DataDrivenSubscriptions.aspx) discusses how to use a stored procedure to tweak a Reporting Services subscription and insert your ow...
241,579
<p>If I import a library to use a method, would it be worth it? Does importing take up a lot of memory?</p>
[ { "answer_id": 241583, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 3, "selected": false, "text": "<p>Importing such a module is not likely to cost that much memory that you should refrain from it, though in this ca...
2008/10/27
[ "https://Stackoverflow.com/questions/241579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31301/" ]
If I import a library to use a method, would it be worth it? Does importing take up a lot of memory?
borrowed from [here](http://www.perlmonks.org/?node_id=95456) ``` %mon2num = qw( jan 1 feb 2 mar 3 apr 4 may 5 jun 6 jul 7 aug 8 sep 9 oct 10 nov 11 dec 12 ); ``` and to retrieve ``` $mon2num{"jan"} ```
241,581
<p>I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option).</p> <p>However, when I try to link a simple sample filesystem app:</p> <pre><code>#include &lt;boost/filesystem.hpp> #include &lt;iostream> namespace f...
[ { "answer_id": 241583, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 3, "selected": false, "text": "<p>Importing such a module is not likely to cost that much memory that you should refrain from it, though in this ca...
2008/10/27
[ "https://Stackoverflow.com/questions/241581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4829/" ]
I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option). However, when I try to link a simple sample filesystem app: ``` #include <boost/filesystem.hpp> #include <iostream> namespace fs = boost::filesystem; int...
borrowed from [here](http://www.perlmonks.org/?node_id=95456) ``` %mon2num = qw( jan 1 feb 2 mar 3 apr 4 may 5 jun 6 jul 7 aug 8 sep 9 oct 10 nov 11 dec 12 ); ``` and to retrieve ``` $mon2num{"jan"} ```
241,605
<p>I am working with a device that requires me to generate a 16 bit CRC.</p> <p>The datasheet for the device says it needs the following CRC Definition:</p> <pre> CRC Type Length Polynomial Direction Preset Residue CRC-CCITT 16 bits x16 + x12 + x5 + 1 Forward FFFF (16) 1D0F (16) </pre...
[ { "answer_id": 241874, "author": "Zan Lynx", "author_id": 13422, "author_profile": "https://Stackoverflow.com/users/13422", "pm_score": 0, "selected": false, "text": "<p>The difference is in what the algorithm does with the two values. I just looked at a CRC algorithm myself and it look...
2008/10/27
[ "https://Stackoverflow.com/questions/241605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am working with a device that requires me to generate a 16 bit CRC. The datasheet for the device says it needs the following CRC Definition: ``` CRC Type Length Polynomial Direction Preset Residue CRC-CCITT 16 bits x16 + x12 + x5 + 1 Forward FFFF (16) 1D0F (16) ``` where preset=F...
You initialize the CRC register with the ***preset*** before feeding in your message. The ***residue*** is what should be left in the CRC register after feeding through a message, plus its correct CRC. If you just want to send a message, you won't see the residue value. But when the device runs your message+CRC throu...
241,622
<p>I am not as familiar with Oracle as I would like to be. I have some 250k records, and I want to display them 100 per page. Currently I have one stored procedure which retrieves all quarter of a million records to a dataset using a data adapter, and dataset, and the dataadapter.Fill(dataset) method on the results f...
[ { "answer_id": 241643, "author": "Brian Schmitt", "author_id": 30492, "author_profile": "https://Stackoverflow.com/users/30492", "pm_score": 8, "selected": true, "text": "<p>Something like this should work: <a href=\"http://weblogs.asp.net/fbouma/archive/2007/05/21/api-s-and-production-c...
2008/10/27
[ "https://Stackoverflow.com/questions/241622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18893/" ]
I am not as familiar with Oracle as I would like to be. I have some 250k records, and I want to display them 100 per page. Currently I have one stored procedure which retrieves all quarter of a million records to a dataset using a data adapter, and dataset, and the dataadapter.Fill(dataset) method on the results from t...
Something like this should work: [From Frans Bouma's Blog](http://weblogs.asp.net/fbouma/archive/2007/05/21/api-s-and-production-code-shouldn-t-be-designed-by-scientists.aspx) ``` SELECT * FROM ( SELECT a.*, rownum r__ FROM ( SELECT * FROM ORDERS WHERE CustomerID LIKE 'A%' ORDER BY OrderDa...
241,631
<p>I'm writing a web application that <em>dynamically</em> creates URL's based off of some input, to be consumed by a client at another time. For discussion sake these URL's can contain certain characters, like a <strong>forward slash (i.e. '/')</strong>, which should not be interpreted as part of the actual URL, but j...
[ { "answer_id": 241639, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 3, "selected": false, "text": "<p>You didn't say which language you're using, but PHP has the useful <code>urlencode</code> function and C# has <code>HttpUtil...
2008/10/27
[ "https://Stackoverflow.com/questions/241631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916/" ]
I'm writing a web application that *dynamically* creates URL's based off of some input, to be consumed by a client at another time. For discussion sake these URL's can contain certain characters, like a **forward slash (i.e. '/')**, which should not be interpreted as part of the actual URL, but just as an argument. For...
You didn't say which language you're using, but PHP has the useful `urlencode` function and C# has `HttpUtility.URLEncode` and `Server.UrlEncode` which should encode parts of your URL nicely. In case you need another way [this page](http://www.december.com/html/spec/esccodes.html) has a list of encoded values. E.g.: `...
241,634
<p>In Cygwin a space in a path has to be escaped with a backslash Not true in Windows, put the whole path in a quote</p> <p>Is there a way to convert to this automatically in Ruby?</p> <p>Otherwise, how in Ruby do I detect if I am running with Windows or Cygwin?</p>
[ { "answer_id": 241653, "author": "nobody", "author_id": 19405, "author_profile": "https://Stackoverflow.com/users/19405", "pm_score": 1, "selected": false, "text": "<p>Quoting paths in Cygwin ought to work fine.</p>\n" }, { "answer_id": 243465, "author": "theschmitzer", "...
2008/10/27
[ "https://Stackoverflow.com/questions/241634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2167252/" ]
In Cygwin a space in a path has to be escaped with a backslash Not true in Windows, put the whole path in a quote Is there a way to convert to this automatically in Ruby? Otherwise, how in Ruby do I detect if I am running with Windows or Cygwin?
<http://rant.rubyforge.org/> ``` sys.escape("foo bar") # gives on Windows: '"foo bar"' # other systems: 'foo\ bar' ```
241,645
<p>I have the Profile, CCK, and Views2 modules installed on a Drupal 6 site. I added a string field to the user profile. I can filter easily on preset values, thru the Views GUI builder, really nicely. However, I'd like the filter criteria to be dynamically set based on other environment variables (namely the <code>...
[ { "answer_id": 288544, "author": "alastairs", "author_id": 5296, "author_profile": "https://Stackoverflow.com/users/5296", "pm_score": 0, "selected": false, "text": "<p>There is the possibility, having looked at the sort of filters installed for my own site, that filters have to be based...
2008/10/27
[ "https://Stackoverflow.com/questions/241645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6824/" ]
I have the Profile, CCK, and Views2 modules installed on a Drupal 6 site. I added a string field to the user profile. I can filter easily on preset values, thru the Views GUI builder, really nicely. However, I'd like the filter criteria to be dynamically set based on other environment variables (namely the `$_SERVER['S...
You can create your own function like following to add your own filters. ``` <?php custom_views_embed_view($view_name, $display_id) { $view = views_get_view($view_name); $view->set_display($display_id); $id = $view->add_item($display_id, 'filter', 'node', 'created', array( 'value' => array('type'...
241,663
<pre><code>$fp_src=fopen('file','r'); $filter = stream_filter_prepend($fp_src, 'convert.iconv.ISO-8859-1/UTF-8'); while(fread($fp_src,4096)){ ++$count; if($count%1000==0) print ftell($fp_src)."\n"; } </code></pre> <p>When I run this the script ends up consuming ~ 200 MB of RAM after going through just 35MB ...
[ { "answer_id": 241701, "author": "Peter Bailey", "author_id": 8815, "author_profile": "https://Stackoverflow.com/users/8815", "pm_score": 0, "selected": false, "text": "<p>From what I'm reading <a href=\"http://us3.php.net/manual/en/function.stream-filter-register.php\" rel=\"nofollow no...
2008/10/27
[ "https://Stackoverflow.com/questions/241663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` $fp_src=fopen('file','r'); $filter = stream_filter_prepend($fp_src, 'convert.iconv.ISO-8859-1/UTF-8'); while(fread($fp_src,4096)){ ++$count; if($count%1000==0) print ftell($fp_src)."\n"; } ``` When I run this the script ends up consuming ~ 200 MB of RAM after going through just 35MB of the file. Runn...
You only need to register custom filters. iconv is built in. It's not the particular operation, using a stream filter for rot13 exhibits similar behavior.
241,673
<pre><code>if(!eregi("^([0-9a-z_\[\]\*\- ])+$", $subuser)) $form-&gt;setError($field, "* Username not alphanumeric"); </code></pre> <p>Can anybody tell me why it is not allowing characters such as <code>-</code> and <code>*</code>?</p> <pre><code>if(!eregi("^([0-9a-z])+$", $subuser)) $form-&gt;setError($field...
[ { "answer_id": 241680, "author": "Henning", "author_id": 29549, "author_profile": "https://Stackoverflow.com/users/29549", "pm_score": 3, "selected": false, "text": "<p>Your regex uses PCRE syntax, so you have to use preg_match() instead of eregi().</p>\n\n<p>Try this code instead:</p>\n...
2008/10/27
[ "https://Stackoverflow.com/questions/241673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29912/" ]
``` if(!eregi("^([0-9a-z_\[\]\*\- ])+$", $subuser)) $form->setError($field, "* Username not alphanumeric"); ``` Can anybody tell me why it is not allowing characters such as `-` and `*`? ``` if(!eregi("^([0-9a-z])+$", $subuser)) $form->setError($field, "* Username not alphanumeric"); ``` That is the origin...
For bracket expressions: To include a literal `]` in the list, make it the first character (following a possible `^`). To include a literal `-`, make it the first or last character, or the second endpoint of a range. To use a literal `-` as the first endpoint of a range, enclose it in `[.` and `.]` to make it a collat...
241,691
<p>Rather than scraping a Ruby version of this algorithm off the net I wanted to create my own based on its description <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="noreferrer">here</a>. However I cannot figure out two things</p> <pre><code>def primeSieve(n) primes = Array.new for i in 0..n-2...
[ { "answer_id": 241752, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 4, "selected": true, "text": "<p>The following seems to work. I took out the floating point arithmetic and squared instead of square rooting. I also...
2008/10/27
[ "https://Stackoverflow.com/questions/241691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2294/" ]
Rather than scraping a Ruby version of this algorithm off the net I wanted to create my own based on its description [here](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes). However I cannot figure out two things ``` def primeSieve(n) primes = Array.new for i in 0..n-2 primes[i] = i+2 end index = 0 w...
The following seems to work. I took out the floating point arithmetic and squared instead of square rooting. I also replaced the deletion loop with a "select" call. ``` while primes[index]**2 <= primes.last prime = primes[index] primes = primes.select { |x| x == prime || x%prime != 0 } index += 1 end...
241,715
<p>I am writing PHP code where I want to pass the session id myself using POST. I don't want a cookie to store the session, as it should get lost when the user gets out of the POST cycle.</p> <p>PHP automatically sets the cookie where available. I learned it is possible to change this behaviour by setting <code>sessio...
[ { "answer_id": 241719, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 5, "selected": false, "text": "<p>Use <a href=\"http://php.net/ini_set\" rel=\"noreferrer\">ini_set()</a>:</p>\n\n<pre><code>ini_set('session.use_cookies...
2008/10/27
[ "https://Stackoverflow.com/questions/241715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21974/" ]
I am writing PHP code where I want to pass the session id myself using POST. I don't want a cookie to store the session, as it should get lost when the user gets out of the POST cycle. PHP automatically sets the cookie where available. I learned it is possible to change this behaviour by setting `session.use_cookies` ...
err its possible to override the default settings of your host by creating your own .htaccess file and here's a great tutorial if you havent touched that yet <http://www.askapache.com/htaccess/apache-htaccess.html> or if you're too lazy to learn just create a ".htaccess" file (yes that's the filename) on your sites di...
241,725
<p>I'm trying to call a web service in an Excel Macro:</p> <pre><code>Set objHTTP = New MSXML.XMLHTTPRequest objHTTP.Open "post", "https://www.server.com/EIDEServer/EIDEService.asmx" objHTTP.setRequestHeader "Content-Type", "text/xml" objHTTP.setRequestHeader "SOAPAction", "PutSchedule" objHTTP.send strXML </cod...
[ { "answer_id": 241956, "author": "Ray Lu", "author_id": 11413, "author_profile": "https://Stackoverflow.com/users/11413", "pm_score": 3, "selected": true, "text": "<p>You SOAP action should also include namespace of the method\ne.g.</p>\n\n<pre><code>\"http://tempri.org/PutSchedule\"\n</...
2008/10/27
[ "https://Stackoverflow.com/questions/241725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1766771/" ]
I'm trying to call a web service in an Excel Macro: ``` Set objHTTP = New MSXML.XMLHTTPRequest objHTTP.Open "post", "https://www.server.com/EIDEServer/EIDEService.asmx" objHTTP.setRequestHeader "Content-Type", "text/xml" objHTTP.setRequestHeader "SOAPAction", "PutSchedule" objHTTP.send strXML ``` And I get bac...
You SOAP action should also include namespace of the method e.g. ``` "http://tempri.org/PutSchedule" ``` Find out what the namespace of your Service and add it in front of the method name PutSchedule.
241,727
<p>If I had the following select, and did not know the value to use to select an item in advance like in this <a href="https://stackoverflow.com/questions/196684/jquery-get-select-option-text">question</a> or the index of the item I wanted selected, how could I select one of the options with jQuery if I did know the te...
[ { "answer_id": 241743, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 5, "selected": true, "text": "<pre><code>var option;\n$('#list option').each(function() {\n if($(this).text() == 'Option C') {\n option ...
2008/10/27
[ "https://Stackoverflow.com/questions/241727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25335/" ]
If I had the following select, and did not know the value to use to select an item in advance like in this [question](https://stackoverflow.com/questions/196684/jquery-get-select-option-text) or the index of the item I wanted selected, how could I select one of the options with jQuery if I did know the text value like ...
``` var option; $('#list option').each(function() { if($(this).text() == 'Option C') { option = this; return false; } }); ```
241,746
<p>In a database prototype, I have a set of fields (like name, description, status) that are required in multiple, functionally different tables.</p> <p>These fields always have the same end user functionality for labeling, display, search, filtering etc. They are not part of a foreign key constraint. How should this ...
[ { "answer_id": 241764, "author": "Mark", "author_id": 26310, "author_profile": "https://Stackoverflow.com/users/26310", "pm_score": 1, "selected": false, "text": "<p>Normalisation is often best practice in any relational database (within reason). </p>\n\n<p>If you have fields like state ...
2008/10/27
[ "https://Stackoverflow.com/questions/241746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31317/" ]
In a database prototype, I have a set of fields (like name, description, status) that are required in multiple, functionally different tables. These fields always have the same end user functionality for labeling, display, search, filtering etc. They are not part of a foreign key constraint. How should this be modeled...
it sounds like you might be taking the idea of normalization a bit too far. remember, it's the idea that you're reducing redundancy in your **data**. your example seems to indicate you're worried about "redundancy" in the meta information of your database design. ultimately though, `user.name` and `user.description` a...
241,758
<p>In VB6 you can do this:</p> <pre><code>Dim a As Variant a = Array(1, 2, 3)</code></pre> <p>Can you do a similar thing in VB.NET with specific types, like so?:</p> <pre><code>Dim a() As Integer a = <strong>Array</strong>(1, 2, 3)</code></pre>
[ { "answer_id": 241762, "author": "Jonathan Allen", "author_id": 5274, "author_profile": "https://Stackoverflow.com/users/5274", "pm_score": 5, "selected": true, "text": "<pre><code>Dim a() As Integer = New Integer() {1, 2, 3}\n</code></pre>\n" }, { "answer_id": 241787, "autho...
2008/10/27
[ "https://Stackoverflow.com/questions/241758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1670/" ]
In VB6 you can do this: ``` Dim a As Variant a = Array(1, 2, 3) ``` Can you do a similar thing in VB.NET with specific types, like so?: ``` Dim a() As Integer a = **Array**(1, 2, 3) ```
``` Dim a() As Integer = New Integer() {1, 2, 3} ```
241,783
<p>I'm interfacing with a payment gateway and not having any luck with Net::SSLeay and its post_https subroutine. The payment gateway has issued me a client certificate that must be used for authentication. The Net::SSLeay perldoc has the following example:</p> <pre><code>($page, $response, %reply_headers) ...
[ { "answer_id": 241800, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 1, "selected": false, "text": "<p>The documentation is incorrect. In my copy (Net::SSLeay 1.04) post_https is shown in the documentation with the exa...
2008/10/28
[ "https://Stackoverflow.com/questions/241783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6406/" ]
I'm interfacing with a payment gateway and not having any luck with Net::SSLeay and its post\_https subroutine. The payment gateway has issued me a client certificate that must be used for authentication. The Net::SSLeay perldoc has the following example: ``` ($page, $response, %reply_headers) = post_https('w...
New versions of Net::SSLeay don't have the prototype that old versions have. Reading the source of old and new version I'd say the prototype was a bug (the code it calls can handle more variables than advertised). The solution I recommend is upgrading to a newer version of Net::SSLeay. If that is not possible, calling...
241,789
<p>I'm trying to parse an international datetime string similar to:</p> <pre><code>24-okt-08 21:09:06 CEST </code></pre> <p>So far I've got something like:</p> <pre><code>CultureInfo culture = CultureInfo.CreateSpecificCulture("nl-BE"); DateTime dt = DateTime.ParseExact("24-okt-08 21:09:06 CEST", "dd-MMM-yy HH:m...
[ { "answer_id": 241885, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 6, "selected": true, "text": "<p>AFAIK the time zone abbreviations are not recognized. However if you replace the abbreviation with the time zone offset, it ...
2008/10/28
[ "https://Stackoverflow.com/questions/241789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163/" ]
I'm trying to parse an international datetime string similar to: ``` 24-okt-08 21:09:06 CEST ``` So far I've got something like: ``` CultureInfo culture = CultureInfo.CreateSpecificCulture("nl-BE"); DateTime dt = DateTime.ParseExact("24-okt-08 21:09:06 CEST", "dd-MMM-yy HH:mm:ss ...", culture); ``` The proble...
AFAIK the time zone abbreviations are not recognized. However if you replace the abbreviation with the time zone offset, it will be OK. E.g.: ``` DateTime dt1 = DateTime.ParseExact("24-okt-08 21:09:06 CEST".Replace("CEST", "+2"), "dd-MMM-yy HH:mm:ss z", culture); DateTime dt2 = DateTime.ParseExact("24-okt-08 21:09:06 ...
241,790
<p>There have been a couple of questions that sort of dealt with this but not covering my exact question so here we go.</p> <p>For site settings, if these are stored in a database do you:</p> <ol> <li>retrieve them from the db every time someone makes a request</li> <li>store them in a session variable on login</li> ...
[ { "answer_id": 241820, "author": "John Lemp", "author_id": 12915, "author_profile": "https://Stackoverflow.com/users/12915", "pm_score": 0, "selected": false, "text": "<p>Generally I would put site settings in the web.config file, unless you are building an application that has multiple ...
2008/10/28
[ "https://Stackoverflow.com/questions/241790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29376/" ]
There have been a couple of questions that sort of dealt with this but not covering my exact question so here we go. For site settings, if these are stored in a database do you: 1. retrieve them from the db every time someone makes a request 2. store them in a session variable on login 3. ??????? For user specific s...
I prefer an approach like Glomek proposes... Caching the settings in the WebCache will greatly enhance speed of access. Consider the following: ``` #region Data Access private string GetSettingsFromDb(string settingName) { return ""; } private Dictionary<string,string> GetSettingsFromDb() { return new Dic...
241,819
<p>What's the difference between the two and when should I use each:</p> <pre><code>&lt;person&gt; &lt;firstname&gt;Joe&lt;/firstname&gt; &lt;lastname&gt;Plumber&lt;/lastname&gt; &lt;/person&gt; </code></pre> <p>versus</p> <pre><code>&lt;person firstname="Joe" lastname="Plumber" /&gt; </code></pre> <p>Tha...
[ { "answer_id": 241828, "author": "LeopardSkinPillBoxHat", "author_id": 22489, "author_profile": "https://Stackoverflow.com/users/22489", "pm_score": 2, "selected": false, "text": "<p>In my company, we would favour the 2nd approach.</p>\n\n<p>The way we think about it is that \"firstname\...
2008/10/28
[ "https://Stackoverflow.com/questions/241819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24059/" ]
What's the difference between the two and when should I use each: ``` <person> <firstname>Joe</firstname> <lastname>Plumber</lastname> </person> ``` versus ``` <person firstname="Joe" lastname="Plumber" /> ``` Thanks
There are element centric and attribute centric XML, in your example, the first one is element centric, the second is attribute centric. Most of the time, these two patterns are equivalent, however there are some exceptions. **Attribute centric** * Smaller size than element centric. * Not very interoperable, since m...
241,857
<p>I'm trying to use XPath to parse an XML document. One of my NSXMLElement's looks like the following, hypothetically speaking:</p> <pre><code>&lt;foo bar="yummy"&gt; </code></pre> <p>I'm trying to get the value for the attribute bar, however any interpretation of code I use, gives me back bar="woo", which means I n...
[ { "answer_id": 241888, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 2, "selected": false, "text": "<p>If you're trying to use the NSXMLDocument class on an iPhone, you're going to be sorely disappointed, because this c...
2008/10/28
[ "https://Stackoverflow.com/questions/241857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to use XPath to parse an XML document. One of my NSXMLElement's looks like the following, hypothetically speaking: ``` <foo bar="yummy"> ``` I'm trying to get the value for the attribute bar, however any interpretation of code I use, gives me back bar="woo", which means I need to do further string process...
The TouchXML API is supposed to be an exact duplicate of Apple's NSXML implementation, so it should be the same except you'll replaces all NS-Method's with C-Methods. > > The TouxhXML classes map directly to the NSXML classes. **NSXMLNode -> CXMLNode**, **NSXMLDocument -> CXMLDocument**, **NSXMLElement -> CXMLElement...
241,860
<p>Say I want to get the HTML of</p> <pre>http://www.google.com</pre> <p>as a String using some built-in classes of the Cocoa Touch framework.</p> <p>What is the least amount of code I need to write?</p> <p>I've gotten this far, but can't figure out how to progress. There must be an easier way.</p> <pre><code>CFHT...
[ { "answer_id": 241875, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 4, "selected": true, "text": "<p>The <i>quickest</i> way is to use NSString's <code>+stringWithContentsOfURL:</code> method. However, this is a modal ...
2008/10/28
[ "https://Stackoverflow.com/questions/241860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
Say I want to get the HTML of ``` http://www.google.com ``` as a String using some built-in classes of the Cocoa Touch framework. What is the least amount of code I need to write? I've gotten this far, but can't figure out how to progress. There must be an easier way. ``` CFHTTPMessageRef req; NSURL *url = [NSURL ...
The *quickest* way is to use NSString's `+stringWithContentsOfURL:` method. However, this is a modal call, and your application will be non-responsive while it runs. You can either move it to a background thread, or use the NSURLConnection class to make a proper, asynchronous request.
241,868
<p>My client has an old MS SQL 2000 database that uses varchar(50) fields to store names. He tried to use this database to capture some data (via a web form). Some of the form-fillers are from other countries, and the varchar fields went nutty when some of these folks entered their names. Is it possible to recover the ...
[ { "answer_id": 241944, "author": "staticsan", "author_id": 28832, "author_profile": "https://Stackoverflow.com/users/28832", "pm_score": 0, "selected": false, "text": "<p>You basically need to poke it through libiconv, converting it to UTF8. </p>\n\n<p>A full list of appropriate characte...
2008/10/28
[ "https://Stackoverflow.com/questions/241868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13700/" ]
My client has an old MS SQL 2000 database that uses varchar(50) fields to store names. He tried to use this database to capture some data (via a web form). Some of the form-fillers are from other countries, and the varchar fields went nutty when some of these folks entered their names. Is it possible to recover the dat...
Working from the 5th example. à is ascii #195 (C3). ¼ is ascii #188 (BC). I'd guess that Müller is meant to be Müller. If this is UTF-8, based upon <http://en.wikipedia.org/wiki/UTF-8#Description> We've got C3 BC = 1100 0011 1011 1100 Applying the UTF-8 mapping: (110) 00011 (10) 11 1100 0000 0000 1111 1100 ...
241,873
<p>i need to redirect all of the stdout of a program except the first line into a file. </p> <p>Is there a common unix program that removes lines from stdin and spits the rest out to stdout?</p>
[ { "answer_id": 241878, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": false, "text": "<p>tail -n +2 -f -</p>\n" }, { "answer_id": 241881, "author": "jwa", "author_id": 31933, "author_pr...
2008/10/28
[ "https://Stackoverflow.com/questions/241873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17076/" ]
i need to redirect all of the stdout of a program except the first line into a file. Is there a common unix program that removes lines from stdin and spits the rest out to stdout?
Others have already mentioned "tail". sed will also work: ``` sed 1d ``` As will Awk: ``` awk 'NR > 1' ```
241,892
<p>I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method.</p> <p>The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form.</p> <p>I can g...
[ { "answer_id": 1842812, "author": "artdanil", "author_id": 214178, "author_profile": "https://Stackoverflow.com/users/214178", "pm_score": 4, "selected": false, "text": "<p>According to <code>suds</code> <a href=\"https://fedorahosted.org/suds/wiki/Documentation#BASICUSAGE\" rel=\"norefe...
2008/10/28
[ "https://Stackoverflow.com/questions/241892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18138/" ]
I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method. The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form. I can get some informatio...
Okay, so SUDS does quite a bit of magic. A `suds.client.Client`, is built from a WSDL file: ``` client = suds.client.Client("http://mssoapinterop.org/asmx/simple.asmx?WSDL") ``` It downloads the WSDL and creates a definition in `client.wsdl`. When you call a method using SUDS via `client.service.<method>` it's actu...
241,897
<p>How do I alternate HTML table row colors using JSP?</p> <p>My CSS looks something like:</p> <pre><code>tr.odd {background-color: #EEDDEE} tr.even {background-color: #EEEEDD} </code></pre> <p>I want to use <code>&lt;c:forEach&gt;</code> to iterate over a collection. </p> <pre><code>&lt;c:forEach items="${element}...
[ { "answer_id": 241917, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 1, "selected": false, "text": "<p>I don't use JSP, so I can't give you an answer in your language, but here's what I do (using pseudo code)</p>\n\n<pre><code...
2008/10/28
[ "https://Stackoverflow.com/questions/241897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
How do I alternate HTML table row colors using JSP? My CSS looks something like: ``` tr.odd {background-color: #EEDDEE} tr.even {background-color: #EEEEDD} ``` I want to use `<c:forEach>` to iterate over a collection. ``` <c:forEach items="${element}" var="myCollection"> <tr> <td><c:out value="${element.fie...
Use the `varStatus` attribute on your `forEach` tag and JSTL will manage an instance of a [`javax.servlet.jsp.jstl.core.LoopTagStatus`](http://java.sun.com/products/jsp/jstl/1.1/docs/api/javax/servlet/jsp/jstl/core/LoopTagStatus.html) for you in the variable name you specify. You can then use a ternary operator to ea...
241,925
<p>I have a number of generated .sql files that I want to run in succession. I'd like to run them from a SQL statement in a query (i.e. Query Analyzer/Server Management Studio).<br> Is it possible to do something like this and if so what is the syntax for doing this?</p> <p>I'm hoping for something like:</p> <pre><c...
[ { "answer_id": 241940, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https://Stackoverflow.com/users/4337", "pm_score": 7, "selected": true, "text": "<p>use <a href=\"http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx\" rel=\"noreferrer\">xp_cmdshell</a> and ...
2008/10/28
[ "https://Stackoverflow.com/questions/241925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25719/" ]
I have a number of generated .sql files that I want to run in succession. I'd like to run them from a SQL statement in a query (i.e. Query Analyzer/Server Management Studio). Is it possible to do something like this and if so what is the syntax for doing this? I'm hoping for something like: ``` exec 'c:\temp\file0...
use [xp\_cmdshell](http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx) and [sqlcmd](http://msdn.microsoft.com/en-us/library/ms166559.aspx) ``` EXEC xp_cmdshell 'sqlcmd -S ' + @DBServerName + ' -d ' + @DBName + ' -i ' + @FilePathName ```
241,936
<p>The deceptively simple foundation of dynamic code generation within a C/C++ framework has already been covered in <a href="https://stackoverflow.com/questions/45408/">another question</a>. Are there any gentle introductions into topic with code examples? </p> <p>My eyes are starting to bleed staring at highly intr...
[ { "answer_id": 241963, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 2, "selected": false, "text": "<p>I'm not aware of any sources specifically related to JITs, but I imagine that it's pretty much like a normal compile...
2008/10/28
[ "https://Stackoverflow.com/questions/241936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1892/" ]
The deceptively simple foundation of dynamic code generation within a C/C++ framework has already been covered in [another question](https://stackoverflow.com/questions/45408/). Are there any gentle introductions into topic with code examples? My eyes are starting to bleed staring at highly intricate open source JIT ...
Well a pattern I've used in emulators goes something like this: ``` typedef void (*code_ptr)(); unsigned long instruction_pointer = entry_point; std::map<unsigned long, code_ptr> code_map; void execute_block() { code_ptr f; std::map<unsigned long, void *>::iterator it = code_map.find(instruction_pointer); ...
241,955
<p>I find myself writing code that looks like this a lot:</p> <pre><code>set&lt;int&gt; affected_items; while (string code = GetKeyCodeFromSomewhere()) { if (code == "some constant" || code == "some other constant") { affected_items.insert(some_constant_id); } else if (code == "yet another constant" ||...
[ { "answer_id": 241972, "author": "Don Neufeld", "author_id": 13097, "author_profile": "https://Stackoverflow.com/users/13097", "pm_score": 2, "selected": true, "text": "<p>Since you don't seem to care about the actual values in the set you could replace it with setting bits in an int. Y...
2008/10/28
[ "https://Stackoverflow.com/questions/241955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20889/" ]
I find myself writing code that looks like this a lot: ``` set<int> affected_items; while (string code = GetKeyCodeFromSomewhere()) { if (code == "some constant" || code == "some other constant") { affected_items.insert(some_constant_id); } else if (code == "yet another constant" || code == "the consta...
Since you don't seem to care about the actual values in the set you could replace it with setting bits in an int. You can also replace the linear time search logic with log time search logic. Here's the final code: ``` // Ahead of time you build a static map from your strings to bit values. std::map< std::string, int ...
241,960
<p>How do I drop a Groovlet into a Grails app? Say, for example, in web-app/groovlet.groovy</p> <pre> import java.util.Date if (session == null) { session = request.getSession(true); } if (session.counter == null) { session.counter = 1 } println """ &lt;html> &lt;head> &lt;title>Groovy Servlet&lt;/...
[ { "answer_id": 242030, "author": "kolrie", "author_id": 14540, "author_profile": "https://Stackoverflow.com/users/14540", "pm_score": 0, "selected": false, "text": "<p>The way I understand it, groovlets are used when you have a Servlet container with Groovy scripting support, </p>\n\n<p>...
2008/10/28
[ "https://Stackoverflow.com/questions/241960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I drop a Groovlet into a Grails app? Say, for example, in web-app/groovlet.groovy ``` import java.util.Date if (session == null) { session = request.getSession(true); } if (session.counter == null) { session.counter = 1 } println """ <html> <head> <title>Groovy Servlet</title> </head> ...
1. `grails install-templates` 2. Edit `src/templates/web/web.xml` to include your groovlet 3. `grails war` 4. deploy I've not personally done this to incorporate a groovlet, but this is the documented way to modify the deployed Grails `web.xml`
241,967
<p>I am playing with the new stuff of C#3.0 and I have this code (mostly taken from <a href="http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx" rel="noreferrer">MSDN</a>) but I can only get true,false,true... and not the real value :</p> <pre><code> int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; ...
[ { "answer_id": 241975, "author": "TheSoftwareJedi", "author_id": 18941, "author_profile": "https://Stackoverflow.com/users/18941", "pm_score": 6, "selected": true, "text": "<p>Change your \"Select\" to a \"Where\"</p>\n\n<pre><code> int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };\n\...
2008/10/28
[ "https://Stackoverflow.com/questions/241967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
I am playing with the new stuff of C#3.0 and I have this code (mostly taken from [MSDN](http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx)) but I can only get true,false,true... and not the real value : ``` int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var oddNumbers = numbers.Select(n => n % ...
Change your "Select" to a "Where" ``` int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var oddNumbers = numbers.Where(n => n % 2 == 1); Console.WriteLine("Odd Number:"); foreach (var x in oddNumbers) { Console.WriteLine(x); } ``` The "Select" method is creating a new list of the la...
241,989
<p>When I restart my apache2 and reload a page, the log file shows</p> <pre><code>boogie.tontut.fi - - [28/Oct/2008:03:27:49 +0200] "GET /test HTTP/1.1" 404 457 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3" </code></pre> <p>...as supposed to, as it's <code>03:27:49</...
[ { "answer_id": 242011, "author": "Kevin Hakanson", "author_id": 22514, "author_profile": "https://Stackoverflow.com/users/22514", "pm_score": 0, "selected": false, "text": "<p>Try and set your timezone explicitly in the <code>httpd.conf</code>:</p>\n\n<pre><code>SetEnv TZ GMT+2\n</code><...
2008/10/28
[ "https://Stackoverflow.com/questions/241989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30141/" ]
When I restart my apache2 and reload a page, the log file shows ``` boogie.tontut.fi - - [28/Oct/2008:03:27:49 +0200] "GET /test HTTP/1.1" 404 457 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3" ``` ...as supposed to, as it's `03:27:49` now. However, when I click the ...
sudo vim /etc/php5/apache2/php.ini Add time zone ============= date.timezone="Europe/London" restart apache2 /etc/init.d/apache2 restart
241,994
<p>This is something that I have always wondered about, but never bothered to profile.</p> <p>Is it more efficient to assign a value to a temp variable, than to keep using that value. An Example may be clearer:</p> <pre><code>string s = reader.GetItem[0].ToString(); someClass.SomeField = s; someOtherClass.someField ...
[ { "answer_id": 242004, "author": "Brian", "author_id": 19299, "author_profile": "https://Stackoverflow.com/users/19299", "pm_score": 5, "selected": true, "text": "<p>The compiler cannot know if the expression on the right-hand-side has side-effects, so it must re-evaluate it if you code ...
2008/10/28
[ "https://Stackoverflow.com/questions/241994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1075/" ]
This is something that I have always wondered about, but never bothered to profile. Is it more efficient to assign a value to a temp variable, than to keep using that value. An Example may be clearer: ``` string s = reader.GetItem[0].ToString(); someClass.SomeField = s; someOtherClass.someField = s; ``` OR ``` so...
The compiler cannot know if the expression on the right-hand-side has side-effects, so it must re-evaluate it if you code it twice. Hence the first is more efficient in the sense that it will not re-do the GetItem & ToString calls. So if you the programmer know that these calls are pure/idempotent, then you should wri...
241,995
<p>I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?</p>
[ { "answer_id": 242774, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 3, "selected": true, "text": "<p>I don't use <em>pydev</em>, but to drop to python's interactive REPL from code:</p>\n\n<pre><code>import code\ncode.inter...
2008/10/28
[ "https://Stackoverflow.com/questions/241995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2168/" ]
I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?
I don't use *pydev*, but to drop to python's interactive REPL from code: ``` import code code.interact(local=locals()) ``` To drop to python's debugger from code: ``` import pdb pdb.set_trace() ``` Finally, to run a interactive REPL after running some code, you can use python's `-i` switch: ``` python -i script....
242,012
<p>After looking on MSDN, it's still unclear to me how I should form a proper predicate to use the Find() method in List using a member variable of T (where T is a class)</p> <p>For example:</p> <pre><code>public class Car { public string Make; public string Model; public int Year; } { // somewhere in my ...
[ { "answer_id": 242020, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 2, "selected": false, "text": "<p>Hmm. Thinking more about it, you could use currying to return a predicate.</p>\n\n<pre><code>Func&lt;int, Predicate&l...
2008/10/28
[ "https://Stackoverflow.com/questions/242012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21244/" ]
After looking on MSDN, it's still unclear to me how I should form a proper predicate to use the Find() method in List using a member variable of T (where T is a class) For example: ``` public class Car { public string Make; public string Model; public int Year; } { // somewhere in my code List<Car> carL...
Ok, in .NET 2.0 you can use delegates, like so: ``` static Predicate<Car> ByYear(int year) { return delegate(Car car) { return car.Year == year; }; } static void Main(string[] args) { // yeah, this bit is C# 3.0, but ignore it - it's just setting up the list. List<Car> list = new List<Car>...
242,032
<p>Is there a way to get the directory of a project in Eclipse? We are writing a plugin that will allow the user to select files, and then run some processes on those files. I would ideally like to be able to get all the files with a certain extension, but that is not necessary.</p>
[ { "answer_id": 242075, "author": "AdamC", "author_id": 16476, "author_profile": "https://Stackoverflow.com/users/16476", "pm_score": 4, "selected": true, "text": "<p>sure:</p>\n\n<pre><code>ResourcesPlugin.getWorkspace().getRoot().getProjects()\n</code></pre>\n\n<p>will get you a list of...
2008/10/28
[ "https://Stackoverflow.com/questions/242032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17712/" ]
Is there a way to get the directory of a project in Eclipse? We are writing a plugin that will allow the user to select files, and then run some processes on those files. I would ideally like to be able to get all the files with a certain extension, but that is not necessary.
sure: ``` ResourcesPlugin.getWorkspace().getRoot().getProjects() ``` will get you a list of all the projects in the workspace. you can easily iterate to find the one you want. At that point, you can look for certain files by extensions, etc.
242,066
<p>I am currently validating a client's HTML Source and I am getting a lot of validation errors for images and input files which do not have the Omittag. I would do it manually but this client literally has thousands of files, with a lot of instances where the is not .</p> <p>This client has validated some img tags (...
[ { "answer_id": 242374, "author": "Anirvan", "author_id": 31100, "author_profile": "https://Stackoverflow.com/users/31100", "pm_score": 2, "selected": false, "text": "<p>Try this. It'll go through your files, make a <code>.orig</code> backup of each file (perl's <code>-i</code> operator),...
2008/10/28
[ "https://Stackoverflow.com/questions/242066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am currently validating a client's HTML Source and I am getting a lot of validation errors for images and input files which do not have the Omittag. I would do it manually but this client literally has thousands of files, with a lot of instances where the is not . This client has validated some img tags (for whateve...
See questions I asked in comment at top. Assuming you're using GNU sed, and that you're trying to **add** the trailing `/` to your tags to make XML-compliant `<img />` and `<input />`, then replace the sed expression in your command with this one, and it should do the trick: `'1h;1!H;${;g;s/\(img\|input\)\( [^>]*[^/]\...
242,073
<p>This is similar to <a href="https://stackoverflow.com/questions/18932/sql-how-can-i-remove-duplicate-rows">this question</a>, but it seems like some of the answers there aren't quite compatible with MySQL (or I'm not doing it right), and I'm having a heck of a time figuring out the changes I need. Apparently my SQL ...
[ { "answer_id": 242102, "author": "Adam Liss", "author_id": 29157, "author_profile": "https://Stackoverflow.com/users/29157", "pm_score": 0, "selected": false, "text": "<p>How about a two-step approach, assuming you can go offline during a data load:</p>\n\n<ul>\n<li>Mark every item as du...
2008/10/28
[ "https://Stackoverflow.com/questions/242073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is similar to [this question](https://stackoverflow.com/questions/18932/sql-how-can-i-remove-duplicate-rows), but it seems like some of the answers there aren't quite compatible with MySQL (or I'm not doing it right), and I'm having a heck of a time figuring out the changes I need. Apparently my SQL is rustier tha...
MySQL needs to be explicitly told if the data you are grouping by is larger than 1024 bytes (see [this link](http://dev.mysql.com/doc/refman/5.1/en/blob.html) for details). So if your data in the fingerprint column is larger than 1024 bytes you should use set the `max_sort_length` variable (see [this link](http://dev.m...
242,079
<p>In Java, we can always use an array to store object reference. Then we have an ArrayList or HashTable which is automatically expandable to store objects. But does anyone know a native way to have an auto-expandable array of object references?</p> <p>Edit: What I mean is I want to know if the Java API has some class...
[ { "answer_id": 242084, "author": "Jack Leow", "author_id": 31506, "author_profile": "https://Stackoverflow.com/users/31506", "pm_score": 0, "selected": false, "text": "<p>There's no first-class language construct that does that that I'm aware of, if that's what you're looking for.</p>\n"...
2008/10/28
[ "https://Stackoverflow.com/questions/242079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8203/" ]
In Java, we can always use an array to store object reference. Then we have an ArrayList or HashTable which is automatically expandable to store objects. But does anyone know a native way to have an auto-expandable array of object references? Edit: What I mean is I want to know if the Java API has some class with the ...
Java arrays are, by their definition, fixed size. If you need auto-growth, you use XXXList classes. EDIT - question has been clarified a bit When I was first starting to learn Java (coming from a C and C++ background), this was probably one of the first things that tripped me up. Hopefully I can shed some light. Unl...
242,097
<p>What's a more elegant way of having the code below where i want to return a derived class based on the type of another class.</p> <pre><code> if (option_ is Rectangle) { modelInputs = new Foo(); } else if (option_ is Circle) { ...
[ { "answer_id": 242103, "author": "Ty.", "author_id": 16948, "author_profile": "https://Stackoverflow.com/users/16948", "pm_score": 0, "selected": false, "text": "<p>You could associate a type with \"option_\", if it allows, and then just create an instance of it.</p>\n" }, { "ans...
2008/10/28
[ "https://Stackoverflow.com/questions/242097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
What's a more elegant way of having the code below where i want to return a derived class based on the type of another class. ``` if (option_ is Rectangle) { modelInputs = new Foo(); } else if (option_ is Circle) { modelInputs ...
Have Rectangle, Circle and Triangle implement IHasModelInput: ``` interface IHasModelInput { IModelInput GetModelInput(); } ``` then you can do ``` IModelInput modelInputs = option_.GetModelInput(); ```
242,118
<p>Assuming a Perl script that allows users to specify several text filter expressions in a config file, is there a safe way to let them enter regular expressions as well, without the possibility of unintended side effects or code execution? Without actually parsing the regexes and checking them for problematic constru...
[ { "answer_id": 242122, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>You will probably have to do some level of sanitisation. For example, the <a href=\"http://perldoc.perl.org/perlre.htm...
2008/10/28
[ "https://Stackoverflow.com/questions/242118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31682/" ]
Assuming a Perl script that allows users to specify several text filter expressions in a config file, is there a safe way to let them enter regular expressions as well, without the possibility of unintended side effects or code execution? Without actually parsing the regexes and checking them for problematic constructs...
This ``` eval { qr/$re/; }; if ( $@ ) { # do something } ``` compiles an expression, and lets you recover from an error. You can watch for malicious expression, since you're only going to do matching, by looking for these patterns, which would allow arbitrary code to be run: ``` (?: \( \?{1,2} \{ # '(...
242,143
<p>I am using WCF to upload data to a server.</p> <p>If the communication fails, is there any way to resume the upload?</p>
[ { "answer_id": 242122, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>You will probably have to do some level of sanitisation. For example, the <a href=\"http://perldoc.perl.org/perlre.htm...
2008/10/28
[ "https://Stackoverflow.com/questions/242143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1368/" ]
I am using WCF to upload data to a server. If the communication fails, is there any way to resume the upload?
This ``` eval { qr/$re/; }; if ( $@ ) { # do something } ``` compiles an expression, and lets you recover from an error. You can watch for malicious expression, since you're only going to do matching, by looking for these patterns, which would allow arbitrary code to be run: ``` (?: \( \?{1,2} \{ # '(...
242,172
<blockquote> <p><strong>Edit:</strong> The code here still has some bugs in it, and it could do better in the performance department, but instead of trying to fix this, for the record I took the problem over to the Intel discussion groups and got lots of great feedback, and if all goes well a polished version of Atom...
[ { "answer_id": 242178, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>It looks like your implementation assumes that <code>sizeof(size_t) == sizeof(float)</code>. Will that always be true ...
2008/10/28
[ "https://Stackoverflow.com/questions/242172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
> > **Edit:** The code here still has some bugs in it, and it could do better in the performance department, but instead of trying to fix this, for the record I took the problem over to the Intel discussion groups and got lots of great feedback, and if all goes well a polished version of Atomic float will be included ...
I would seriously advise against public inheritance. I don't know what the atomic implementation is like, but im assuming it has overloaded operators that use it as the integral type, which means that those promotions will be used instead of your float in many (maybe most?) cases. I don't see any reason why that would...
242,177
<p>I understand object oriented programming, and have been writing OO programs for a long time. People seem to talk about aspect-oriented programming, but I've never really learned what it is or how to use it. What is the basic paradigm?</p> <p>This question is related, but doesn't quite ask it:</p> <p><a href="htt...
[ { "answer_id": 242194, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 9, "selected": true, "text": "<p>AOP addresses the problem of <em>cross-cutting concerns</em>, which would be any kind of code that is repeated in diff...
2008/10/28
[ "https://Stackoverflow.com/questions/242177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31952/" ]
I understand object oriented programming, and have been writing OO programs for a long time. People seem to talk about aspect-oriented programming, but I've never really learned what it is or how to use it. What is the basic paradigm? This question is related, but doesn't quite ask it: [Aspect-Oriented Programming vs...
AOP addresses the problem of *cross-cutting concerns*, which would be any kind of code that is repeated in different methods and can't normally be completely refactored into its own module, like with logging or verification. So, with AOP you can leave that stuff out of the main code and define it vertically like so: `...
242,181
<p>I have a form with several checkboxes which values are pulled from a database. I managed to display them in the form, assign an appropriate value to each, but cannot insert their values into other database.</p> <p>Here's the code:</p> <pre><code>&lt;form id=&quot;form1&quot; name=&quot;form1&quot; method=&quot;post&...
[ { "answer_id": 242215, "author": "Eli", "author_id": 27580, "author_profile": "https://Stackoverflow.com/users/27580", "pm_score": 2, "selected": false, "text": "<p>You can tell if a checkbox is selected because it will have a value. If it's not selected, it won't appear in the request/...
2008/10/28
[ "https://Stackoverflow.com/questions/242181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a form with several checkboxes which values are pulled from a database. I managed to display them in the form, assign an appropriate value to each, but cannot insert their values into other database. Here's the code: ``` <form id="form1" name="form1" method="post" action=""> <?php $info_id = $_GET['info_id']; ...
You can tell if a checkbox is selected because it will have a value. If it's not selected, it won't appear in the request/get/post in PHP at all. What you may want to do is check for the value of it and work based on that. The value is the string 'on' by default, but can be changed by the value='' attribute in HTML. ...