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
293,743
<p>I have been writting a keyword search script based on this tutorial: <a href="http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/" rel="nofollow noreferrer">http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/</a></p> <p>Like some of the commenters mentione...
[ { "answer_id": 293753, "author": "Nahom Tijnam", "author_id": 11172, "author_profile": "https://Stackoverflow.com/users/11172", "pm_score": 3, "selected": true, "text": "<p>If you want to return results that contain <strong>any of the keywords</strong>, then replace all the <strong>AND</...
2008/11/16
[ "https://Stackoverflow.com/questions/293743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38020/" ]
I have been writting a keyword search script based on this tutorial: <http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/> Like some of the commenters mentioned, the script only ends up returning results based on the last word in the search terms. So I have also tried to implement one of ...
If you want to return results that contain **any of the keywords**, then replace all the **AND** with **OR**. If you do this, then your db will check if any of the keywords exist in any of the columns of the table. Hence your final query would be read by the DB server like this: ``` SELECT * FROM blog WHERE blog_tit...
293,750
<p>This is in reference to the <a href="https://stackoverflow.com/questions/282944/jquery-one-slider-controls-another">question</a> previously asked</p> <p>The problem here is, each <code>slider</code> controls the other. It results in feedback. </p> <p>How do I possibly stop it?</p> <pre><code>$(function() { $(...
[ { "answer_id": 293758, "author": "AndreasKnudsen", "author_id": 36465, "author_profile": "https://Stackoverflow.com/users/36465", "pm_score": 1, "selected": false, "text": "<p>You could store a var CurrentSlider = 'slider';</p>\n\n<p>on mousedown on either of the sliders, you set the Cur...
2008/11/16
[ "https://Stackoverflow.com/questions/293750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21480/" ]
This is in reference to the [question](https://stackoverflow.com/questions/282944/jquery-one-slider-controls-another) previously asked The problem here is, each `slider` controls the other. It results in feedback. How do I possibly stop it? ``` $(function() { $("#slider").slider({ slide: moveSlider2 }); $("...
This is sort of a hack, but works: ``` $(function () { var slider = $("#slider"); var slider1 = $("#slider1"); var sliderHandle = $("#slider").find('.ui-slider-handle'); var slider1Handle = $("#slider1").find('.ui-slider-handle'); slider.slider({ slide: moveSlider1 }); slider1.slider({ slide: ...
293,760
<p>Here's what I got so far (that doesn't work). At this point I thought my target was Ansi encoded, but I really don't want to have to know at this point. My browser seems to be able to determine what encoding to use, How can I?</p> <pre><code>static void GetUrl(Uri uri, string localFileName) { HttpWebRequest req...
[ { "answer_id": 293763, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 3, "selected": true, "text": "<p>There are three ways how web-browsers try to detect character encoding.</p>\n\n<p>Look for (if it's HTML):</p>\n\n<pre><...
2008/11/16
[ "https://Stackoverflow.com/questions/293760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16260/" ]
Here's what I got so far (that doesn't work). At this point I thought my target was Ansi encoded, but I really don't want to have to know at this point. My browser seems to be able to determine what encoding to use, How can I? ``` static void GetUrl(Uri uri, string localFileName) { HttpWebRequest request = (HttpWe...
There are three ways how web-browsers try to detect character encoding. Look for (if it's HTML): ``` <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> ``` or (for XHTML) ``` <?xml version="1.0" encoding="ISO-8859-1"?> ``` or sometimes it's even specified in http header ``` Content-Type: tex...
293,768
<p>How do I get a patch from a commit in order to send it to another developer? And how do I best avoid a merge conflict with this patch when merging our trees at a later date?</p> <p>If you know how please explain how to do this in your VCS of choice such as subversion, git, Mercurial, bzr or etc.</p>
[ { "answer_id": 293803, "author": "Xian", "author_id": 4642, "author_profile": "https://Stackoverflow.com/users/4642", "pm_score": 2, "selected": false, "text": "<p>In SVN you can simply make your changes then before commiting, pipe the output of the svn diff to a file as such</p>\n\n<pre...
2008/11/16
[ "https://Stackoverflow.com/questions/293768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]
How do I get a patch from a commit in order to send it to another developer? And how do I best avoid a merge conflict with this patch when merging our trees at a later date? If you know how please explain how to do this in your VCS of choice such as subversion, git, Mercurial, bzr or etc.
In [git](http://git.or.cz/) you can pipe the output of [`git-diff`](http://git-scm.com/docs/git-diff) between two commits like this: ``` git diff fa1afe1 deadbeef > patch.diff ``` Send the `patch.diff` to the developer and let him [`git-apply`](http://www.kernel.org/pub/software/scm/git/docs/git-apply.html) it to hi...
293,774
<p>With wxWidgets I use the following code:</p> <pre><code>HWND main_window = ... ... wxWindow *w = new wxWindow(); wxWindow *window = w->CreateWindowFromHWND(0, (WXHWND) main_window); </code></pre> <p>How do I do the same thing in Qt? The <code>HWND</code> is the handle of the window I want as the parent window for ...
[ { "answer_id": 293778, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 3, "selected": false, "text": "<p>Have you tried the <a href=\"http://doc.qt.digia.com/solutions/qtwinmigrate/qwinwidget.html\" rel=\"nofollow noreferrer\">...
2008/11/16
[ "https://Stackoverflow.com/questions/293774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709/" ]
With wxWidgets I use the following code: ``` HWND main_window = ... ... wxWindow *w = new wxWindow(); wxWindow *window = w->CreateWindowFromHWND(0, (WXHWND) main_window); ``` How do I do the same thing in Qt? The `HWND` is the handle of the window I want as the parent window for the new QtWidget.
Use the create method of QWidget. ``` HWND main_window = ... ... QWidget *w = new QWidget(); w->create((WinId)main_window); ```
293,790
<p>I am trying to wire up dependency injection with Windsor to standard asp.net web forms. I think I have achieved this using a HttpModule and a CustomAttribute (code shown below), although the solution seems a little clunky and was wondering if there is a better supported solution out of the box with Windsor?</p> <p>...
[ { "answer_id": 295047, "author": "Bittercoder", "author_id": 4843, "author_profile": "https://Stackoverflow.com/users/4843", "pm_score": 5, "selected": true, "text": "<p>I think you're basically on the right track - If you have not already I would suggest taking a look at Rhino Igloo, an...
2008/11/16
[ "https://Stackoverflow.com/questions/293790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4642/" ]
I am trying to wire up dependency injection with Windsor to standard asp.net web forms. I think I have achieved this using a HttpModule and a CustomAttribute (code shown below), although the solution seems a little clunky and was wondering if there is a better supported solution out of the box with Windsor? There are ...
I think you're basically on the right track - If you have not already I would suggest taking a look at Rhino Igloo, an WebForms MVC framework, [Here's a good blog post on this](http://ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Forms.aspx) and the source is [here](https://rhino-tools.svn....
293,794
<p>Greetings,</p> <p>I have data stored on mysql with delimiter "," in 1 table. I have rows and column stored on database too. Now i have to output the data using rows and column number stored on database to draw the table.</p> <p>Rows and column number are user input, so it may varies.</p> <p>Let say, there is nu...
[ { "answer_id": 293813, "author": "MoreThanChaos", "author_id": 24824, "author_profile": "https://Stackoverflow.com/users/24824", "pm_score": 0, "selected": false, "text": "<p>assuming that user set table size for 2 rows and 3 columns and makes some input fot 6 cells, data which will go t...
2008/11/16
[ "https://Stackoverflow.com/questions/293794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37922/" ]
Greetings, I have data stored on mysql with delimiter "," in 1 table. I have rows and column stored on database too. Now i have to output the data using rows and column number stored on database to draw the table. Rows and column number are user input, so it may varies. Let say, there is number 3 on column and 3 o...
You can turn the comma separated values from your data column into an array using the explode() function: ``` <?php $result = mysql_query('SELECT rows, columns, data from table_name where id=1'); $record = mysql_fetch_assoc($result); $rows = $record['rows']; $columns = $record['columns']; $data = explode('...
293,799
<p>The <em>VS2008 SP1</em> documentation talks about <strong><code>std::tr1::mem_fun</code></strong>.</p> <p>So why, when I try and use <strong><code>std::tr1::mem_fun</code></strong>, why do I get this compile error?:</p> <pre><code>'mem_fun' : is not a member of 'std::tr1' </code></pre> <p>At the same time, I can ...
[ { "answer_id": 293869, "author": "user10340", "author_id": 10340, "author_profile": "https://Stackoverflow.com/users/10340", "pm_score": 2, "selected": false, "text": "<p>I am no expert on either TR1 or VS2008, but a quick googling suggests that the function you're looking for is std::tr...
2008/11/16
[ "https://Stackoverflow.com/questions/293799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25457/" ]
The *VS2008 SP1* documentation talks about **`std::tr1::mem_fun`**. So why, when I try and use **`std::tr1::mem_fun`**, why do I get this compile error?: ``` 'mem_fun' : is not a member of 'std::tr1' ``` At the same time, I can use **`std::tr1::function`** without problems. Here is the sample code I am trying to c...
Change it to this: ``` std::tr1::function<void (int)> f = std::tr1::bind(std::tr1::mem_fn(&Test::TakesInt), t, std::tr1::placeholders::_1); f(2); ``` The binder requires the int argument. So you have to give it a placeholder which stands for the integer argument that the generated function object needs. Btw: I'...
293,806
<p>What I would like to do is have VS2008, when I open a code file, collapse all members of the classes/interfaces in the file by default (including, crucially, any XML documentation and comments).</p> <p>I do <em>not</em> want to use regions, at all.</p> <p>I would also like to be able to use the ctrl+m, ctrl+l chor...
[ { "answer_id": 296891, "author": "Brody", "author_id": 17131, "author_profile": "https://Stackoverflow.com/users/17131", "pm_score": 4, "selected": true, "text": "<p>Yes to part 1.</p>\n\n<p>Unsure about part 2.</p>\n\n<p>To have VS2008 automatically open files in a Collapsed state you'l...
2008/11/16
[ "https://Stackoverflow.com/questions/293806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20971/" ]
What I would like to do is have VS2008, when I open a code file, collapse all members of the classes/interfaces in the file by default (including, crucially, any XML documentation and comments). I do *not* want to use regions, at all. I would also like to be able to use the ctrl+m, ctrl+l chord to toggle all *member*...
Yes to part 1. Unsure about part 2. To have VS2008 automatically open files in a Collapsed state you'll need to create an addin to run the "Edit.CollapsetoDefinition" when each document opens. This isn't overly tricky - The difficult parts seems to be the that you have to run the code a few milliseconds after the do...
293,814
<p>Helo!</p> <p>Is this possible to use string value of one node which tells what type of field is presented in another node using LINQ to XML?</p> <p>For example:</p> <pre><code>&lt;node&gt; &lt;name&gt;nodeName&lt;/name&gt; &lt;type&gt;string&lt;/type&gt; &lt;/node&gt; &lt;node&gt; &lt;name&gt;0&lt;/name&gt;...
[ { "answer_id": 293891, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>Well, you won't get a nice statically typed API given that the type information is only known at execution time - but ...
2008/11/16
[ "https://Stackoverflow.com/questions/293814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23280/" ]
Helo! Is this possible to use string value of one node which tells what type of field is presented in another node using LINQ to XML? For example: ``` <node> <name>nodeName</name> <type>string</type> </node> <node> <name>0</name> <type>bool</type> </node> <node> <name>42</name> <type>int</type> </node> ...
Well, you won't get a nice statically typed API given that the type information is only known at execution time - but you could easily write an extension method on XElement which looks for the appropriate subelements and returns `System.Object`. For instance (untested): ``` public static object ParseValue(this XElemen...
293,831
<p>For example, I make extensive use of the session in my ASP.NET application but have heard somewhere that objects stored in session can be removed by the system where server memory runs low. Is this true? Is there any session 'callback' functionality to allow you to re-populate scavenged objects? </p> <p>More genera...
[ { "answer_id": 293845, "author": "Corey Trager", "author_id": 9328, "author_profile": "https://Stackoverflow.com/users/9328", "pm_score": 1, "selected": false, "text": "<p>Sorry, I don't know about the removal of items from session state, but in response to your general question, the mos...
2008/11/16
[ "https://Stackoverflow.com/questions/293831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27805/" ]
For example, I make extensive use of the session in my ASP.NET application but have heard somewhere that objects stored in session can be removed by the system where server memory runs low. Is this true? Is there any session 'callback' functionality to allow you to re-populate scavenged objects? More generally, what ...
No matter which precautions you use, always assume your Session may disappear and double check: ``` Dim sessionObj As Object = CType(Session("SessionKey"), Object) If sessionObj Is Nothing sessionObj = ReCreateObj() Session("SessionKey") = sessionObj End If object sessionObj = Session["SessionKey"] as object ...
293,832
<p>I am currently building an application using ASP.NET MVC. The data entry pages are fairly easy to code, I just make the Model for the page of the type of my business object:</p> <pre><code>namespace MyNameSpace.Web.Views.ProjectEdit { public partial class MyView : ViewPage&lt;Project&gt; { } } </code><...
[ { "answer_id": 293902, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": true, "text": "<p>I think that user controls is probably the way to go. I'm not sure what the concern is about testability. You shoul...
2008/11/16
[ "https://Stackoverflow.com/questions/293832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
I am currently building an application using ASP.NET MVC. The data entry pages are fairly easy to code, I just make the Model for the page of the type of my business object: ``` namespace MyNameSpace.Web.Views.ProjectEdit { public partial class MyView : ViewPage<Project> { } } ``` Where I am struggling i...
I think that user controls is probably the way to go. I'm not sure what the concern is about testability. You should be able to test that your controller is providing the right view data -- since you'll have several models each of these will probably be stored in a separate view data item, rather than aggregating them ...
293,840
<p>This is probably a simple question. Suppose I have a object called Users and it contains a lot of protected variables. </p> <p>Inside that Users class I have a method that creates a temporary Users object, does something with it, and if successful, transfers all the variables from the temp Users object into the on...
[ { "answer_id": 293843, "author": "Seiti", "author_id": 27959, "author_profile": "https://Stackoverflow.com/users/27959", "pm_score": 2, "selected": false, "text": "<p>A better approach is to implement the IClonable interface. But you'll find it doesn't save you a lot of work.</p>\n" },...
2008/11/16
[ "https://Stackoverflow.com/questions/293840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10352/" ]
This is probably a simple question. Suppose I have a object called Users and it contains a lot of protected variables. Inside that Users class I have a method that creates a temporary Users object, does something with it, and if successful, transfers all the variables from the temp Users object into the one I have. ...
A better approach is to implement the IClonable interface. But you'll find it doesn't save you a lot of work.
293,853
<p>I would like to add custom tooltips to emacs. More specifically, whenever I hover on a symbol (function/variable) name with my mouse of I would like to see a tooltip with the symbol's definition. I know that I can find this kind of info with a tool like cscope but I have no idea how to attach the output of cscope t...
[ { "answer_id": 293887, "author": "Jouni K. Seppänen", "author_id": 26575, "author_profile": "https://Stackoverflow.com/users/26575", "pm_score": 5, "selected": true, "text": "<p>Your Emacs installation should include the <a href=\"http://www.gnu.org/software/emacs/manual/elisp.html\" rel...
2008/11/16
[ "https://Stackoverflow.com/questions/293853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33707/" ]
I would like to add custom tooltips to emacs. More specifically, whenever I hover on a symbol (function/variable) name with my mouse of I would like to see a tooltip with the symbol's definition. I know that I can find this kind of info with a tool like cscope but I have no idea how to attach the output of cscope to a...
Your Emacs installation should include the [Elisp reference manual](http://www.gnu.org/software/emacs/manual/elisp.html) (if not, download it now - you're going to need it when developing your mode). To access it, go to Info (C-h i) and look for a node labeled "Elisp", sometimes in a separate "Emacs" menu. Type `i` for...
293,857
<pre><code>class String { private: char* rep; public: String (const char*); void toUpper() const; }; String :: String (const char* s) { rep = new char [strlen(s)+1]; strcpy (rep, s); } void String :: toUpper () const { for (int i = 0; rep [i]; i++) rep[i] = toupper(...
[ { "answer_id": 293864, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 1, "selected": false, "text": "<p>toUpper() does not change the pointer (which belongs to the class). It only changes the data which rep poin...
2008/11/16
[ "https://Stackoverflow.com/questions/293857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38038/" ]
``` class String { private: char* rep; public: String (const char*); void toUpper() const; }; String :: String (const char* s) { rep = new char [strlen(s)+1]; strcpy (rep, s); } void String :: toUpper () const { for (int i = 0; rep [i]; i++) rep[i] = toupper(rep[i]); ...
**A const member function, is a member function that does not mutate its member variables.** **const on a member function does not imply const char \*. Which would mean that you can't change the data in the address the pointer holds.** Your example does not mutate the member variables themselves. A const on a memb...
293,905
<p>If I have the following code:</p> <pre><code>MyType&lt;int&gt; anInstance = new MyType&lt;int&gt;(); Type type = anInstance.GetType(); </code></pre> <p>How can I find out which type argument(s) &quot;anInstance&quot; was instantiated with, by looking at the type variable? Is it possible?</p>
[ { "answer_id": 293908, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/system.type.getgenericarguments.aspx\" rel=\"noreferrer\">Type.G...
2008/11/16
[ "https://Stackoverflow.com/questions/293905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13627/" ]
If I have the following code: ``` MyType<int> anInstance = new MyType<int>(); Type type = anInstance.GetType(); ``` How can I find out which type argument(s) "anInstance" was instantiated with, by looking at the type variable? Is it possible?
Use [Type.GetGenericArguments](http://msdn.microsoft.com/en-us/library/system.type.getgenericarguments.aspx). For example: ``` using System; using System.Collections.Generic; public class Test { static void Main() { var dict = new Dictionary<string, int>(); Type type = dict.GetType(); ...
293,916
<p>given the following class ...</p> <pre><code>public class Category { public string Name {get;set;} public Category ParentCategory {get;set;} } </code></pre> <p>What the most efficient way to output the following from a collection (<code>IList&lt;Category&gt;</code>) of Category objects?</p> <pre><code>+ Paren...
[ { "answer_id": 293919, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>You may wish to consider reversing your relationship. If a node can get to its parent but not vice versa, you have to ...
2008/11/16
[ "https://Stackoverflow.com/questions/293916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34133/" ]
given the following class ... ``` public class Category { public string Name {get;set;} public Category ParentCategory {get;set;} } ``` What the most efficient way to output the following from a collection (`IList<Category>`) of Category objects? ``` + Parent Category ++ Sub Category ++ Sub Category 2 + Parent ...
You may wish to consider reversing your relationship. If a node can get to its parent but not vice versa, you have to have *all* the leaf nodes in order to print out the full tree. Compare this to the situation where you have each node know about its children - then you only need the root node.
293,929
<p>I'd like to play sound file which loaded from internet, so I tried to start from iPhone SDK SpeakHere sample. I recorded the sound, then saved and uploaded to the internet, I could download that file and play without problem from sound tools. But when I tried to play that URL from SpeakHere, I am getting error <code...
[ { "answer_id": 294722, "author": "BlueDolphin", "author_id": 32096, "author_profile": "https://Stackoverflow.com/users/32096", "pm_score": 1, "selected": false, "text": "<p>I figured out a workaround. That is copy the content from internet to a local file, then play sound from that local...
2008/11/16
[ "https://Stackoverflow.com/questions/293929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32096/" ]
I'd like to play sound file which loaded from internet, so I tried to start from iPhone SDK SpeakHere sample. I recorded the sound, then saved and uploaded to the internet, I could download that file and play without problem from sound tools. But when I tried to play that URL from SpeakHere, I am getting error `Program...
Yes, you need to use [Audio File Stream Services](http://developer.apple.com/iphone/library/documentation/MusicAudio/Reference/AudioStreamReference/Reference/reference.html) to play directly from the internet. I found the "AudioFileStreamExample" example useful, which should be installed in ``` /Developer/Examples/Co...
293,946
<p>In this query:</p> <pre><code>SELECT COUNT(*) AS UserCount, Company.* FROM Company LEFT JOIN User ON User.CompanyId = Company.Id WHERE Company.CanAccessSystem= true AND(User.CanAccessSystem IS null OR User.CanAccessSystem = true) GROUP BY Company.Id </code></pre> <p>I want to query a list of companies that can acc...
[ { "answer_id": 293993, "author": "bart", "author_id": 19966, "author_profile": "https://Stackoverflow.com/users/19966", "pm_score": 0, "selected": false, "text": "<p>You should be counting the number of users for whom User.CanAccessSystem is true. Think of something like</p>\n\n<pre><cod...
2008/11/16
[ "https://Stackoverflow.com/questions/293946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10352/" ]
In this query: ``` SELECT COUNT(*) AS UserCount, Company.* FROM Company LEFT JOIN User ON User.CompanyId = Company.Id WHERE Company.CanAccessSystem= true AND(User.CanAccessSystem IS null OR User.CanAccessSystem = true) GROUP BY Company.Id ``` I want to query a list of companies that can access a particular system as...
The reason that your result doesn't work is because you don't have any join clause. ``` SELECT IFNULL(COUNT(User.Id), 0) AS UserCount, Company.* FROM Company LEFT JOIN User ON User.CompanyId = Company.Id AND User.CanAccessSystem = true WHERE Company.CanAccessSystem = true GROUP BY Company.Id ``` That should work....
293,948
<p>I have a question to the submit- button behavior of internet explorer. If I load the page everything is fine - the submit button looks as it should. </p> <p><a href="http://img58.imageshack.us/img58/7214/inactiveci9.jpg" rel="nofollow noreferrer">Inactive state http://img58.imageshack.us/img58/7214/inactiveci9.jpg<...
[ { "answer_id": 293979, "author": "BrynJ", "author_id": 29538, "author_profile": "https://Stackoverflow.com/users/29538", "pm_score": 2, "selected": false, "text": "<p>I have encountered the same behaviour in IE. As far as I know, the only way to prevent that behaviour is to set the butto...
2008/11/16
[ "https://Stackoverflow.com/questions/293948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2078/" ]
I have a question to the submit- button behavior of internet explorer. If I load the page everything is fine - the submit button looks as it should. [Inactive state http://img58.imageshack.us/img58/7214/inactiveci9.jpg](http://img58.imageshack.us/img58/7214/inactiveci9.jpg) But if I click inside the FORM, the submit...
CSS: ``` input:focus, input:active, input:hover { outline: none; border: 1px solid; } ``` No guarantees, but that is **supposed** to stop IE being stupid. You should extend the above style a little, for instance, change background color or border color to give an alternative change indicating focus. ...
293,956
<p>I've been working with jQuery for a pair of weeks and I've noticed it works fine with objects that are in the original HTML document, but when I generate a new element using jQuery the library doesn't get any of its events.</p> <p>Let's say I try to run something like this:</p> <pre><code>$('.whatever').click(func...
[ { "answer_id": 293973, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>You need to rebind it.</p>\n\n<pre><code>function bindme(){\n $('.whatever').click(function(){\n alert('binded');...
2008/11/16
[ "https://Stackoverflow.com/questions/293956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/440/" ]
I've been working with jQuery for a pair of weeks and I've noticed it works fine with objects that are in the original HTML document, but when I generate a new element using jQuery the library doesn't get any of its events. Let's say I try to run something like this: ``` $('.whatever').click(function() { alert("ALE...
Thats because the : (corrected) ``` $('.whatever').click(function() { alert("ALERT!"); }); ``` Means, in literal terms: ``` Find all elements currently on the page that have the class ".whatever" Foreach element in that result set, bind this function to its click event ``` so naturally, adding a new DOM el...
293,959
<p>with jquery, or with simple just javascript, I want to populate a 2nd dropdown from the choice of the first dropdown. The value of the first dropdown is the condition to get rows for the second dropdown.</p> <p>How does the onChange event look like?</p>
[ { "answer_id": 293968, "author": "Kyle West", "author_id": 34133, "author_profile": "https://Stackoverflow.com/users/34133", "pm_score": 3, "selected": false, "text": "<p>there is actually a plugin that does just that ...</p>\n\n<p><a href=\"http://code.google.com/p/jqueryselectcombo/\" ...
2008/11/16
[ "https://Stackoverflow.com/questions/293959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30759/" ]
with jquery, or with simple just javascript, I want to populate a 2nd dropdown from the choice of the first dropdown. The value of the first dropdown is the condition to get rows for the second dropdown. How does the onChange event look like?
A functional but less elegant solution follows. This is a way to populate a states/province select list based on whether the United States (US) or Canada (CA) is chosen first. US and US States are visible by default. This method relies on a simple class naming convention to group the state options based on their parent...
293,967
<p>Should operations that could take some time be performed in a constructor or should the object be constructed and then initialised later.</p> <p>For example when constructing an object that represents a directory structure should the population of the object and its children be done in the constructor. Clearly, a d...
[ { "answer_id": 293974, "author": "SoapBox", "author_id": 36384, "author_profile": "https://Stackoverflow.com/users/36384", "pm_score": 5, "selected": false, "text": "<p>You usually do not want the constructor to do any computation. Someone else using the code will not expect that it doe...
2008/11/16
[ "https://Stackoverflow.com/questions/293967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32153/" ]
Should operations that could take some time be performed in a constructor or should the object be constructed and then initialised later. For example when constructing an object that represents a directory structure should the population of the object and its children be done in the constructor. Clearly, a directory c...
Historically, I have coded my constructors so that the object is ready to use once the constructor method is complete. How much or how little code is involved depends on the requirements for the object. For example, let's say I need to display the following Company class in a details view: ``` public class Company { ...
293,972
<p>There's a HTML:</p> <pre><code>&lt;div class="test"&gt; &lt;ul&gt; &lt;li&gt;Item 1&lt;/li&gt; &lt;li&gt;Item 2&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>And a bit of JS:</p> <pre><code>$(document).ready(function() { // do stuff when DOM is ready $(".test ul").append('&lt;li&gt;Foo&lt;/...
[ { "answer_id": 293983, "author": "Frans-Willem", "author_id": 34014, "author_profile": "https://Stackoverflow.com/users/34014", "pm_score": 1, "selected": false, "text": "<p>adding actual HTML from JavaScript is rather ugly, have you tried something like this:</p>\n\n<pre><code>var li=do...
2008/11/16
[ "https://Stackoverflow.com/questions/293972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16917/" ]
There's a HTML: ``` <div class="test"> <ul> <li>Item 1</li> <li>Item 2</li> </ul> </div> ``` And a bit of JS: ``` $(document).ready(function() { // do stuff when DOM is ready $(".test ul").append('<li>Foo</li>'); }); ``` Why does it add nothing, but if I remove html from append's argument string, ...
I checked your code and it works perfectly on my machine... So I think it's not jQuery bug.
293,981
<p>I'd like to mark a method as deprecated, so the people using it can easily check their code and catch up. In Java you set @Deprecated and everybody knows what this means.</p> <p>So is there a preferred way (or even tools) to mark and check for deprecations in Ruby?</p>
[ { "answer_id": 293994, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": false, "text": "<p>You do have <a href=\"https://packages.debian.org/search?keywords=libdeprecated-ruby\" rel=\"nofollow noreferrer\"><code>lib...
2008/11/16
[ "https://Stackoverflow.com/questions/293981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38045/" ]
I'd like to mark a method as deprecated, so the people using it can easily check their code and catch up. In Java you set @Deprecated and everybody knows what this means. So is there a preferred way (or even tools) to mark and check for deprecations in Ruby?
For almost all cases, depending on a library or metaprogramming for a deprecation is overkill. Just add a comment to the rdoc and call the `Kernel#warn` method. For example: ``` class Foo # <b>DEPRECATED:</b> Please use <tt>useful</tt> instead. def useless warn "[DEPRECATION] `useless` is deprecated. Please u...
293,988
<p>Is there a good way in C++ to implement (or fake) a type for a generic vector of vectors?</p> <p>Ignore the issue of when a vector of vectors is a good idea (unless there's something equivalent which is always better). Assume that it does accurately model the problem, and that a matrix does not accurately model the...
[ { "answer_id": 293996, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 7, "selected": true, "text": "<p>You want to have template-typedefs. That is <em>not</em> yet supported in the current C++. A workaround i...
2008/11/16
[ "https://Stackoverflow.com/questions/293988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13005/" ]
Is there a good way in C++ to implement (or fake) a type for a generic vector of vectors? Ignore the issue of when a vector of vectors is a good idea (unless there's something equivalent which is always better). Assume that it does accurately model the problem, and that a matrix does not accurately model the problem. ...
You want to have template-typedefs. That is *not* yet supported in the current C++. A workaround is to do ``` template<typename T> struct vecvec { typedef std::vector< std::vector<T> > type; }; int main() { vecvec<int>::type intSequences; vecvec<std::string>::type stringSequences; } ``` In the next C++...
293,997
<p>I know postgres has a datatype for storing geographical coordinates. But I'm looking for a RDBMS agnostic solution. Currently I'm using Decimal(25,20) in MySQL. I may be using this data to lookup these locations based on a given distance from a given location later. Which would be the best approach to store this kin...
[ { "answer_id": 294011, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 1, "selected": false, "text": "<p>The standard is <a href=\"http://portal.opengeospatial.org/files/?artifact_id=18241\" rel=\"nofollow noreferrer\"...
2008/11/16
[ "https://Stackoverflow.com/questions/293997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7883/" ]
I know postgres has a datatype for storing geographical coordinates. But I'm looking for a RDBMS agnostic solution. Currently I'm using Decimal(25,20) in MySQL. I may be using this data to lookup these locations based on a given distance from a given location later. Which would be the best approach to store this kind o...
Another good technique is to multiply the values by a constant and store them as integer values. Using integers only can also help speed up calculations. Unless you are in serious need of precision you should really only need to store 5+ values after the decimal point. This [Latitude Longitude Data Storage Specifica...
294,009
<p>When comparing two objects (of the same type), it makes sense to have a compare function which takes another instance of the same class. If I implement this as a virtual function in the base class, then the signature of the function has to reference the base class in derived classes also. What is the elegant way to ...
[ { "answer_id": 294026, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 0, "selected": false, "text": "<p>If you mean that the Compare() in class B or C should always be passed an object of class B or C, no matter...
2008/11/16
[ "https://Stackoverflow.com/questions/294009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32153/" ]
When comparing two objects (of the same type), it makes sense to have a compare function which takes another instance of the same class. If I implement this as a virtual function in the base class, then the signature of the function has to reference the base class in derived classes also. What is the elegant way to tac...
It depends on the intended semantics of A, B, and C and the semantics of compare(). Comparison is an abstract concept that doesn't necessarily have a single correct meaning (or any meaning at all, for that matter). There is no single right answer to this question. Here's two scenarios where compare means two completel...
294,018
<p>What are some C++ related idioms, misconceptions, and gotchas that you've learnt from experience?</p> <p>An example:</p> <pre><code>class A { public: char s[1024]; char *p; A::A() { p = s; } void changeS() const { p[0] = 'a'; } }; </code></pre> <p>Even know changeS is a const member ...
[ { "answer_id": 294023, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "<p>I've liked this since the time i've discovered it in some code:</p>\n\n<pre><code>assert(condition || !\"...
2008/11/16
[ "https://Stackoverflow.com/questions/294018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
What are some C++ related idioms, misconceptions, and gotchas that you've learnt from experience? An example: ``` class A { public: char s[1024]; char *p; A::A() { p = s; } void changeS() const { p[0] = 'a'; } }; ``` Even know changeS is a const member function, it is changing the valu...
I've liked this since the time i've discovered it in some code: ``` assert(condition || !"Something has gone wrong!"); ``` or if you don't have a condition at hand, you can just do ``` assert(!"Something has gone wrong!"); ``` The following is attributed to [@Josh](https://stackoverflow.com/users/8701/josh) (see ...
294,040
<p>Maybe this is an easy question, maybe not. I have a select box where I hardcode with width. Say 120px.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select sty...
[ { "answer_id": 294051, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "<p>If you have the option pre-existing in a fixed-with <code>&lt;select&gt;</code>, and you don't want to change the width ...
2008/11/16
[ "https://Stackoverflow.com/questions/294040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10522/" ]
Maybe this is an easy question, maybe not. I have a select box where I hardcode with width. Say 120px. ```html <select style="width: 120px"> <option>REALLY LONG TEXT, REALLY LONG TEXT, REALLY LONG TEXT</option> <option>ABC</option> </select> ``` I want to be able to show the second option so that the user can ...
If you have the option pre-existing in a fixed-with `<select>`, and you don't want to change the width programmatically, you could be out of luck unless you get a little creative. * You could try and set the `title` attribute to each option. This is non-standard HTML (if you care for this minor infraction here), but I...
294,092
<p>I've just written a small XBox 360 Wireless Controller managed interface that basically wraps around the low-lever <a href="http://slimdx.mdxinfo.com/wiki/index.php?title=Main_Page" rel="nofollow noreferrer">SlimDX</a> wrapper library and provides a easy, managed API for the XBOX 360 controller.</p> <p>Internally, ...
[ { "answer_id": 294104, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 1, "selected": false, "text": "<p>Is a polling architecture the only option?</p>\n\n<p>In any case, personally I would restructure the system so tha...
2008/11/16
[ "https://Stackoverflow.com/questions/294092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9172/" ]
I've just written a small XBox 360 Wireless Controller managed interface that basically wraps around the low-lever [SlimDX](http://slimdx.mdxinfo.com/wiki/index.php?title=Main_Page) wrapper library and provides a easy, managed API for the XBOX 360 controller. Internally, the class polls the gamepad every N ms, and sho...
So... It appears the information / code @ [http://geekswithblogs.net/robp/archive/2008/03/28/why-doesnt-dispatcher-implement-isynchronizeinvoke.aspx](https://web.archive.org/web/20210125200028/http://geekswithblogs.net/robp/archive/2008/03/28/why-doesnt-dispatcher-implement-isynchronizeinvoke.aspx) does indeed provide ...
294,138
<p>What's the best way to merge 2 or more dictionaries (<code>Dictionary&lt;T1,T2&gt;</code>) in C#? (3.0 features like LINQ are fine).</p> <p>I'm thinking of a method signature along the lines of:</p> <pre><code>public static Dictionary&lt;TKey,TValue&gt; Merge&lt;TKey,TValue&gt;(Dictionary&lt;TKey,...
[ { "answer_id": 294139, "author": "orip", "author_id": 37020, "author_profile": "https://Stackoverflow.com/users/37020", "pm_score": 6, "selected": false, "text": "<p>The trivial solution would be:</p>\n\n<pre><code>using System.Collections.Generic;\n...\npublic static Dictionary&lt;TKey,...
2008/11/16
[ "https://Stackoverflow.com/questions/294138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37020/" ]
What's the best way to merge 2 or more dictionaries (`Dictionary<T1,T2>`) in C#? (3.0 features like LINQ are fine). I'm thinking of a method signature along the lines of: ``` public static Dictionary<TKey,TValue> Merge<TKey,TValue>(Dictionary<TKey,TValue>[] dictionaries); ``` or ``` public static ...
This partly depends on what you want to happen if you run into duplicates. For instance, you could do: ``` var result = dictionaries.SelectMany(dict => dict) .ToDictionary(pair => pair.Key, pair => pair.Value); ``` That will throw an exception if you get any duplicate keys. EDIT: If you use...
294,171
<p>I have a delegate, say:</p> <pre><code>public delegate void MyDelegate(); </code></pre> <p>I have an event, say:</p> <pre><code>public MyDelegate MyEvent; </code></pre> <p>While invoking the event I am receiving an error message:</p> <blockquote> <p>"MyEvent += expected ....."</p> </blockquote> <p>How do I r...
[ { "answer_id": 294175, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>You can only invoke the event from within the class where you declared it. In any other place, you can only add or...
2008/11/16
[ "https://Stackoverflow.com/questions/294171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a delegate, say: ``` public delegate void MyDelegate(); ``` I have an event, say: ``` public MyDelegate MyEvent; ``` While invoking the event I am receiving an error message: > > "MyEvent += expected ....." > > > How do I resolve this?
You can only invoke the event from within the class where you declared it. In any other place, you can only add or remove handlers from the event delegate via the operators `+=` and `-=`, hence the error message.
294,172
<p>I have this piece of code:</p> <pre><code>$("#faq").click(function () { var url = $.get("faq", { pagina: "page" }); alert(url); }); </code></pre> <p>On "faq" responds to a Servlet that sets an attribute on the request </p> <pre><code>.... request.setAttribute("pageFAQ", pageFAQ); .... </cod...
[ { "answer_id": 294385, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": true, "text": "<p>I'm not sure that a servlet request attribute is shared with the client.</p>\n\n<p>You can get hold of the response text...
2008/11/16
[ "https://Stackoverflow.com/questions/294172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38058/" ]
I have this piece of code: ``` $("#faq").click(function () { var url = $.get("faq", { pagina: "page" }); alert(url); }); ``` On "faq" responds to a Servlet that sets an attribute on the request ``` .... request.setAttribute("pageFAQ", pageFAQ); .... ``` After the get jQuery prints [object ...
I'm not sure that a servlet request attribute is shared with the client. You can get hold of the response text in jQuery like so: ``` $("#faq").click(function () { $.get( "faq", { pagina: "page" }, function(data) { // callback function, executed on GET success alert(data); ...
294,193
<p>I normally use scp to copy stuff, but now I'm trying to get used to the more powerful rsync command. It helps me use less bandwidth by copying up only files that have changed. However, rsync has a lot of complex parameters, so I thought, hey, I'll just make a little Bash script that makes it easy for me, and call th...
[ { "answer_id": 294240, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 4, "selected": true, "text": "<p>/var/www/mysite/* is expanded by the shell, so you have many more arguments being passed in than you're handling in...
2008/11/16
[ "https://Stackoverflow.com/questions/294193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I normally use scp to copy stuff, but now I'm trying to get used to the more powerful rsync command. It helps me use less bandwidth by copying up only files that have changed. However, rsync has a lot of complex parameters, so I thought, hey, I'll just make a little Bash script that makes it easy for me, and call the c...
/var/www/mysite/\* is expanded by the shell, so you have many more arguments being passed in than you're handling in the script. Also variables aren't substituted in single quotes, so you need to use double quotes. (See bash [man page](http://www.gnu.org/software/bash/manual/bashref.html#Double-Quotes)) Try this: ``...
294,201
<p>Given 2 file revisions I want to know how many lines were added/modified/deleted. I want to have this information for the entire repository of thousand of files. Please point me to a script or tool as I am a total svn newbie</p> <p>I am working on windows</p> <p>Sample output</p> <p>File~NewRevision~OldRevision~A...
[ { "answer_id": 294229, "author": "Peter Bratton", "author_id": 37856, "author_profile": "https://Stackoverflow.com/users/37856", "pm_score": 4, "selected": true, "text": "<p>Subversion has a very nice diff tool integrated within it. I would use a command such as:</p>\n\n<pre><code>svn d...
2008/11/16
[ "https://Stackoverflow.com/questions/294201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30546/" ]
Given 2 file revisions I want to know how many lines were added/modified/deleted. I want to have this information for the entire repository of thousand of files. Please point me to a script or tool as I am a total svn newbie I am working on windows Sample output File~NewRevision~OldRevision~Added~Modified~Deleted f...
Subversion has a very nice diff tool integrated within it. I would use a command such as: ``` svn diff -rOldRevision:NewRevision URL ``` where URL is the URL of your repository (for instance, <http://www.mycode.org/svn/trunk>). This won't format the diff output in the form you are looking for, but it will show how e...
294,216
<p>This causes a compile-time exception:</p> <pre><code>public sealed class ValidatesAttribute&lt;T&gt; : Attribute { } [Validates&lt;string&gt;] public static class StringValidation { } </code></pre> <p>I realize C# does not support generic attributes. However, after much Googling, I can't seem to find the reason...
[ { "answer_id": 294242, "author": "GalacticCowboy", "author_id": 29638, "author_profile": "https://Stackoverflow.com/users/29638", "pm_score": 7, "selected": false, "text": "<p>An attribute decorates a class at compile-time, but a generic class does not receive its final type information ...
2008/11/16
[ "https://Stackoverflow.com/questions/294216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37815/" ]
This causes a compile-time exception: ``` public sealed class ValidatesAttribute<T> : Attribute { } [Validates<string>] public static class StringValidation { } ``` I realize C# does not support generic attributes. However, after much Googling, I can't seem to find the reason. Does anyone know why generic types ...
Well, I can't answer why it's not available, but I *can* confirm that it's not a CLI issue. The CLI spec doesn't mention it (as far as I can see) and if you use IL directly you can create a generic attribute. The part of the C# 3 spec that bans it - section 10.1.4 "Class base specification" doesn't give any justificati...
294,217
<p>In ARM assembly immediates are encoded by an 8-bit rotated value which means we can only encode </p> <pre><code>(0-256)^2n. </code></pre> <p>Now my problem is that I want to clear the upper 16-bits of r0 and replace it with the half-word stored r1. But because of the limited range of the immediates I have to do: -...
[ { "answer_id": 294227, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 0, "selected": false, "text": "<p>If you can clear the whole thing, you could <code>xor</code> it with itself. </p>\n\n<p>If you need to retain the bottom h...
2008/11/16
[ "https://Stackoverflow.com/questions/294217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27653/" ]
In ARM assembly immediates are encoded by an 8-bit rotated value which means we can only encode ``` (0-256)^2n. ``` Now my problem is that I want to clear the upper 16-bits of r0 and replace it with the half-word stored r1. But because of the limited range of the immediates I have to do: - ``` bic r0, r0, #0xff000...
How about: ``` orr r0,r1,r0,lsl #16 mov r0,r0,ror #16 ``` (This assumes that the top halfword of r1 is empty, like your reference code did.) Depending on the circumstances, you might be able to omit the final mov here by merging it with some later code.
294,220
<p>I'm trying to create a WPF application where I can drag an image around.</p> <p>Currently I have an image placed in the center of the window, and I'm thinking of using the three mouseevents MouseDown, MouseMove and MouseUp to calculate the new position when dragging the image.</p> <p>Are there any other good ideas...
[ { "answer_id": 294412, "author": "deepcode.co.uk", "author_id": 20524, "author_profile": "https://Stackoverflow.com/users/20524", "pm_score": 6, "selected": true, "text": "<p>ok, here's an attached property \"behaviour\" that you can use to make any element draggable provided it's on a c...
2008/11/16
[ "https://Stackoverflow.com/questions/294220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33431/" ]
I'm trying to create a WPF application where I can drag an image around. Currently I have an image placed in the center of the window, and I'm thinking of using the three mouseevents MouseDown, MouseMove and MouseUp to calculate the new position when dragging the image. Are there any other good ideas on how to do thi...
ok, here's an attached property "behaviour" that you can use to make any element draggable provided it's on a canvas: ``` public class DraggableExtender : DependencyObject { // This is the dependency property we're exposing - we'll // access this as DraggableExtender.CanDrag="true"/"false" public static r...
294,234
<p>I'm working on an assignment that is telling me to assume that I have a singly linked list with a header and tail nodes. It wants me to insert an item y before position p. Can anybody please look over my code and tell me if I'm on the right track? If not, can you provide me with any tips or pointers (no pun inten...
[ { "answer_id": 294243, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 4, "selected": true, "text": "<p>Just write it down if you get stuck with an algorithm:</p>\n\n<pre><code>// First we have a pointer to a node conta...
2008/11/16
[ "https://Stackoverflow.com/questions/294234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14013/" ]
I'm working on an assignment that is telling me to assume that I have a singly linked list with a header and tail nodes. It wants me to insert an item y before position p. Can anybody please look over my code and tell me if I'm on the right track? If not, can you provide me with any tips or pointers (no pun intended)? ...
Just write it down if you get stuck with an algorithm: ``` // First we have a pointer to a node containing element (elm) // with possible a next element. // Graphically drawn as: // p -> [elm] -> ??? tmp = new Node(); // A new node is created. Variable tmp points to the new node which // currently has no value. // ...
294,250
<p>Suppose that I have a <code>&lt;div&gt;</code> that I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the <code>&lt;div&gt;</code> element. </p> <p>What should I use? Please include information on browser compatibility.</p>
[ { "answer_id": 294268, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 6, "selected": false, "text": "<p><strong>NOTE</strong>: <em>this answer was written in 2008. At the time the best cross-browser solution for most peo...
2008/11/16
[ "https://Stackoverflow.com/questions/294250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184350/" ]
Suppose that I have a `<div>` that I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the `<div>` element. What should I use? Please include information on browser compatibility.
You should use the [`.offsetWidth`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth) and [`.offsetHeight`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight) properties. Note they belong to the element, not `.style`. ```js var width = document.getElementById('foo').offs...
294,261
<p>I have class with a member function that takes a default argument.</p> <pre><code>struct Class { void member(int n = 0) {} }; </code></pre> <p>By means of std::tr1::mem_fn I can invoke it:</p> <pre><code>Class object; std::tr1::mem_fn(&amp;Class::member)(object,10); </code></pre> <p>That said, if I want...
[ { "answer_id": 294274, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 2, "selected": false, "text": "<p>The reason is that any default arguments do not change the function type of a function. </p>\n\n<p><code...
2008/11/16
[ "https://Stackoverflow.com/questions/294261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19630/" ]
I have class with a member function that takes a default argument. ``` struct Class { void member(int n = 0) {} }; ``` By means of std::tr1::mem\_fn I can invoke it: ``` Class object; std::tr1::mem_fn(&Class::member)(object,10); ``` That said, if I want to invoke the *callable* member on the object with ...
Default functions are bound at call time, but can't be bound into any sort of wrapper implicitly, because of the way they are implemented. When you pass `&Class::member`, `mem_fn` only sees a `void (Class::*)(int)`, and can't see the default argument. Using `tr1::bind`, you can bind the default argument explictly: `std...
294,270
<p>How would you call the constructor of the following class in these three situations: Global objects, arrays of objects, and objects contained in another class/struct?</p> <p>The class with the constructor (used in all three examples):</p> <pre><code>class Foo { public: Foo(int a) { b = a; } privat...
[ { "answer_id": 294278, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": true, "text": "<h3>Global objects</h3>\n\n<p>Yours is the only way. On the other hand, try to avoid this. It’s better to use function...
2008/11/16
[ "https://Stackoverflow.com/questions/294270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813/" ]
How would you call the constructor of the following class in these three situations: Global objects, arrays of objects, and objects contained in another class/struct? The class with the constructor (used in all three examples): ``` class Foo { public: Foo(int a) { b = a; } private: int b; }; ...
### Global objects Yours is the only way. On the other hand, try to avoid this. It’s better to use functions (or even other objects) as factories instead. That way, you can control the time of creation. ### Arrays of objects There’s no way to do this directly. Non-POD objects will always be default-constructed. `std...
294,285
<p>I want to automate several tasks (eg. simulate eclipse style <kbd>ctrl</kbd>-<kbd>shift</kbd>-<kbd>R</kbd> open dialog for other editors). The general pattern is: the user will press some key combination, my program will detect it and potentially pop up a dialog to get user input, and then run a corresponding comman...
[ { "answer_id": 294461, "author": "Dustin Wyatt", "author_id": 23972, "author_profile": "https://Stackoverflow.com/users/23972", "pm_score": 3, "selected": false, "text": "<p>You may want to look at <a href=\"http://www.autoitscript.com/autoit3/\" rel=\"nofollow noreferrer\">AutoIt</a>. ...
2008/11/16
[ "https://Stackoverflow.com/questions/294285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
I want to automate several tasks (eg. simulate eclipse style `ctrl`-`shift`-`R` open dialog for other editors). The general pattern is: the user will press some key combination, my program will detect it and potentially pop up a dialog to get user input, and then run a corresponding command, typically by running an exe...
Found the answer using pyHook and the win32 extensions: ``` import pyHook import pythoncom def OnKeyboardEvent(event): print event.Ascii hm = pyHook.HookManager() hm.KeyDown = OnKeyboardEvent hm.HookKeyboard() while True: pythoncom.PumpMessages() ```
294,286
<p>I want to use svn command line with beyond compare and get the following output</p> <pre><code>Text Compare Produced: 11/16/2008 11:45:34 AM SourceFile,CompareFile,IOriginal,IAdded,IDeleted,IChanged,UOriginal,UAdded,UDeleted,UChanged "E:\Downloads\eeli\eel\1.c","E:\Downloads\eeli\eel\2.c",967,192,501,270,368,113,2...
[ { "answer_id": 294344, "author": "Ned Batchelder", "author_id": 14343, "author_profile": "https://Stackoverflow.com/users/14343", "pm_score": 4, "selected": true, "text": "<p>Put this in (for example) c:\\bin\\bcsvn.bat</p>\n\n<pre><code>@REM To configure this as the Subversion diff comm...
2008/11/16
[ "https://Stackoverflow.com/questions/294286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30546/" ]
I want to use svn command line with beyond compare and get the following output ``` Text Compare Produced: 11/16/2008 11:45:34 AM SourceFile,CompareFile,IOriginal,IAdded,IDeleted,IChanged,UOriginal,UAdded,UDeleted,UChanged "E:\Downloads\eeli\eel\1.c","E:\Downloads\eeli\eel\2.c",967,192,501,270,368,113,205,89 ``` Wh...
Put this in (for example) c:\bin\bcsvn.bat ``` @REM To configure this as the Subversion diff command, add these lines to @REM c:\Documents and Settings\username\Application Data\Subversion\config: @REM @REM [helpers] @REM diff-cmd = c:\bin\bcsvn.bat @REM @"C:\Progra~1\Beyond~1\bcomp.exe" "%6" /title1=%3 "%7" /title...
294,292
<p>How can I change the master volume level? Using this code</p> <pre><code>[DllImport ("winmm.dll")] public static extern int waveOutSetVolume (IntPtr hwo, uint dwVolume); waveOutSetVolume (IntPtr.Zero, (((uint)uint.MaxValue &amp; 0x0000ffff) | ((uint)uint.MaxValue &lt;&lt; 16))); </code></pre> <p>I can set the wav...
[ { "answer_id": 294330, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": false, "text": "<p>For the master volume (for Vista and above), that would be:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/ms67...
2008/11/16
[ "https://Stackoverflow.com/questions/294292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/894/" ]
How can I change the master volume level? Using this code ``` [DllImport ("winmm.dll")] public static extern int waveOutSetVolume (IntPtr hwo, uint dwVolume); waveOutSetVolume (IntPtr.Zero, (((uint)uint.MaxValue & 0x0000ffff) | ((uint)uint.MaxValue << 16))); ``` I can set the wave volume but if the master volume is...
Okay, here goes: ``` const int MAXPNAMELEN = 32; const int MIXER_SHORT_NAME_CHARS = 16; const int MIXER_LONG_NAME_CHARS = 64; [Flags] enum MIXERLINE_LINEF : uint{ ACTIVE = 0x00000001, DISCONNECTED = 0x00008000, SOURCE = 0x80000000 } [Flags] enum MIXER : uint{ GETLINEI...
294,297
<p>I'm writing a Web application that needs to store JSON data in a small, fixed-size server-side cache via AJAX (think: <a href="http://code.google.com/apis/opensocial/articles/persistence-0.8.html#restrictions-quotas" rel="noreferrer">Opensocial quotas</a>). I do not have control over the server.</p> <p>I need to re...
[ { "answer_id": 294309, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "<p>Most browsers can decompress gzip on the fly. That might be a better option than a javascript implementation.</p>\n" }, ...
2008/11/16
[ "https://Stackoverflow.com/questions/294297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5309/" ]
I'm writing a Web application that needs to store JSON data in a small, fixed-size server-side cache via AJAX (think: [Opensocial quotas](http://code.google.com/apis/opensocial/articles/persistence-0.8.html#restrictions-quotas)). I do not have control over the server. I need to reduce the size of the stored data to st...
**Edit** There appears to be a better LZW solution that handles Unicode strings correctly at <http://pieroxy.net/blog/pages/lz-string/index.html> (Thanks to pieroxy in the comments). --- I don't know of any gzip implementations, but the [jsolait library](http://jsolait.net/) (the site seems to have gone away) has fun...
294,299
<p>I created an Ajax website in Visual Studio, added a simple page with a textbox and button, when I click the button once everything works, when I click it twice I get the error</p> <p>Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The statu...
[ { "answer_id": 294309, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "<p>Most browsers can decompress gzip on the fly. That might be a better option than a javascript implementation.</p>\n" }, ...
2008/11/16
[ "https://Stackoverflow.com/questions/294299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
I created an Ajax website in Visual Studio, added a simple page with a textbox and button, when I click the button once everything works, when I click it twice I get the error Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code retu...
**Edit** There appears to be a better LZW solution that handles Unicode strings correctly at <http://pieroxy.net/blog/pages/lz-string/index.html> (Thanks to pieroxy in the comments). --- I don't know of any gzip implementations, but the [jsolait library](http://jsolait.net/) (the site seems to have gone away) has fun...
294,313
<p>Python provides the "*" operator for unpacking a list of tuples and giving them to a function as arguments, like so:</p> <pre><code>args = [3, 6] range(*args) # call with arguments unpacked from a list </code></pre> <p>This is equivalent to:</p> <pre><code>range(3, 6) </code></pre> <p>Does anyone know...
[ { "answer_id": 294325, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 5, "selected": true, "text": "<p>You can use <a href=\"http://www.php.net/call_user_func_array\" rel=\"noreferrer\"><code>call_user_func_array()</code></a> ...
2008/11/16
[ "https://Stackoverflow.com/questions/294313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2327/" ]
Python provides the "\*" operator for unpacking a list of tuples and giving them to a function as arguments, like so: ``` args = [3, 6] range(*args) # call with arguments unpacked from a list ``` This is equivalent to: ``` range(3, 6) ``` Does anyone know if there is a way to achieve this in PHP? Some ...
You can use [`call_user_func_array()`](http://www.php.net/call_user_func_array) to achieve that: `call_user_func_array("range", $args);` to use your example.
294,342
<p>I have a TDbGrid, and I can easily tell how many columns are in it at runtime with the FieldCount property, but there doesn't seem to be a corresponding RowCount property to display how many records are being displayed. How can I find this out?</p>
[ { "answer_id": 294345, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 4, "selected": true, "text": "<p>You could try:</p>\n\n<pre><code>DBGrid1.DataSource.DataSet.RecordCount\n</code></pre>\n\n<p>Maybe there are better...
2008/11/16
[ "https://Stackoverflow.com/questions/294342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32914/" ]
I have a TDbGrid, and I can easily tell how many columns are in it at runtime with the FieldCount property, but there doesn't seem to be a corresponding RowCount property to display how many records are being displayed. How can I find this out?
You could try: ``` DBGrid1.DataSource.DataSet.RecordCount ``` Maybe there are better solutions. But this worked for me.
294,349
<p>I am trying to create a sidebar for a site that will allow a user to select an item from a drop down menu and show an RSS Feed. The feed will change depending on which item is selected from the list. I am not sure how to acomplish this, but my first thought was to use z-index and show/hide layers. I have one layer a...
[ { "answer_id": 294427, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": "<p>This uses jQuery and jFeed plugin to replace the contents of a DIV based on a dropdown selection.</p>\n\n<pre><code>...
2008/11/16
[ "https://Stackoverflow.com/questions/294349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5509/" ]
I am trying to create a sidebar for a site that will allow a user to select an item from a drop down menu and show an RSS Feed. The feed will change depending on which item is selected from the list. I am not sure how to acomplish this, but my first thought was to use z-index and show/hide layers. I have one layer and ...
you have two options: 1. pre-load all the rss feeds (i'm assuming your `<ul>`'s in your example page are the HTML output of your RSS feeds?), hide them all when your document loads, and then reveal them as selected 2. use AJAX to dynamically grab the selected feed information as your select box changes. here's a quic...
294,355
<p>Does anyone know of a good YAML Parser for PHP? If so, what are the pros and cons of this library?</p>
[ { "answer_id": 294428, "author": "Dan Powley", "author_id": 2761, "author_profile": "https://Stackoverflow.com/users/2761", "pm_score": 4, "selected": false, "text": "<p>The <a href=\"http://www.symfony-project.org\" rel=\"noreferrer\">symfony framework</a> makes very heavy use of YAML, ...
2008/11/16
[ "https://Stackoverflow.com/questions/294355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2327/" ]
Does anyone know of a good YAML Parser for PHP? If so, what are the pros and cons of this library?
> > **Last updated**: July 26th, 2017 > > > Here's a summary of the state of YAML in PHP: * Wrappers to C libraries: You'll probably want these if you need sheer speed: + [php-yaml](https://pecl.php.net/package/yaml): Wrapper for [LibYAML](http://pyyaml.org/wiki/LibYAML). Available as a PECL extension; it is als...
294,367
<p>These days, more languages are using unicode, which is a good thing. But it also presents a danger. In the past there where troubles distinguising between 1 and l and 0 and O. But now we have a complete new range of similar characters.</p> <p>For example:</p> <pre><code>ì, î, ï, ı, ι, ί, ׀ ,أ ,آ, ỉ, ﺃ </code></pre...
[ { "answer_id": 294386, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": true, "text": "<p>Besides the similar character bugs you mention and the technical issues that might arise when using different edit...
2008/11/16
[ "https://Stackoverflow.com/questions/294367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18061/" ]
These days, more languages are using unicode, which is a good thing. But it also presents a danger. In the past there where troubles distinguising between 1 and l and 0 and O. But now we have a complete new range of similar characters. For example: ``` ì, î, ï, ı, ι, ί, ׀ ,أ ,آ, ỉ, ﺃ ``` With these, it is not that ...
Besides the similar character bugs you mention and the technical issues that might arise when using different editors (w/BOM, wo/BOM, different encodings in the same file by copy pasting which is only a problem when there are actually characters that cannot be encoded in ASCII and so on), I find that it's not worth usi...
294,382
<p>Is there any reason to prefer a <code>CharBuffer</code> to a <code>char[]</code> in the following:</p> <pre><code>CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE); while( in.read(buf) &gt;= 0 ) { out.append( buf.flip() ); buf.clear(); } </code></pre> <p>vs.</p> <pre><code>char[] buf = new char[DEFAUL...
[ { "answer_id": 294407, "author": "Bill Michell", "author_id": 7938, "author_profile": "https://Stackoverflow.com/users/7938", "pm_score": 2, "selected": false, "text": "<p>If this is the only thing you're doing with the buffer, then the array is probably the better choice in this instanc...
2008/11/16
[ "https://Stackoverflow.com/questions/294382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
Is there any reason to prefer a `CharBuffer` to a `char[]` in the following: ``` CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE); while( in.read(buf) >= 0 ) { out.append( buf.flip() ); buf.clear(); } ``` vs. ``` char[] buf = new char[DEFAULT_BUFFER_SIZE]; int n; while( (n = in.read(buf)) >= 0 ) { ou...
No, there's really no reason to prefer a `CharBuffer` in this case. In general, though, `CharBuffer` (and `ByteBuffer`) can really simplify APIs and encourage correct processing. If you were designing a public API, it's definitely worth considering a buffer-oriented API.
294,383
<p>I'm facing a real problem in understanding how to draw a variable diagram to a linked list</p> <p>In the book I'm reading its not giving enough info</p> <p>I will post an example:</p> <hr> <p>the insert:</p> <pre><code>public void Insert(Object newItem, Object after) { Node current = new Node(); Node n...
[ { "answer_id": 294397, "author": "luiscubal", "author_id": 32775, "author_profile": "https://Stackoverflow.com/users/32775", "pm_score": 0, "selected": false, "text": "<p>First of all, you will need to know the basics of drawing.<br>\nA good idea would be to provide a separated \"DrawNod...
2008/11/16
[ "https://Stackoverflow.com/questions/294383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm facing a real problem in understanding how to draw a variable diagram to a linked list In the book I'm reading its not giving enough info I will post an example: --- the insert: ``` public void Insert(Object newItem, Object after) { Node current = new Node(); Node newNode = new Node(newItem); curr...
Are you trying to draw it out on paper for homework? If so, the Link property of each node has a reference to the next node in the linked list. To draw it, you would probably have a series of boxes in a row that represent the node classes. In each node, you would have two properties, the Item and the Link. Link would p...
294,443
<p>I'm looking for a consistent way to structure my use of formatting strings throughout a large web application, and I'm looking for recommendations or best practices on which way to go.</p> <p>Up until now I've had a static class that does some common formatting e.g.</p> <p>Formatting.FormatCurrency</p> <p>Formatt...
[ { "answer_id": 294448, "author": "GeekyMonkey", "author_id": 29900, "author_profile": "https://Stackoverflow.com/users/29900", "pm_score": 5, "selected": true, "text": "<p>One option is to use a helper class with extension methods like</p>\n\n<pre><code>public static class MyWebAppExtens...
2008/11/16
[ "https://Stackoverflow.com/questions/294443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5777/" ]
I'm looking for a consistent way to structure my use of formatting strings throughout a large web application, and I'm looking for recommendations or best practices on which way to go. Up until now I've had a static class that does some common formatting e.g. Formatting.FormatCurrency Formatting.FormatBookingReferen...
One option is to use a helper class with extension methods like ``` public static class MyWebAppExtensions { public static string FormatCurrency(this decimal d) { return d.ToString("c"); } } ``` Then anywhere you have a decimal value you do ``` Decimal d = 100.25; string s = d.FormatCurrency(); ...
294,444
<p>I have long tables generated by datagrid control that go beyond the page width. I would like to convert that into separate table for each row or definition list where each field name is followed by field value.</p> <p>How would I do that. </p>
[ { "answer_id": 294454, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 0, "selected": false, "text": "<p>Here's a reference:</p>\n\n<p><a href=\"http://www.mail-archive.com/flexcoders@yahoogroups.com/msg15534.html\" rel=\"nof...
2008/11/16
[ "https://Stackoverflow.com/questions/294444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35513/" ]
I have long tables generated by datagrid control that go beyond the page width. I would like to convert that into separate table for each row or definition list where each field name is followed by field value. How would I do that.
Uses jquery. If you have more than one table you'll need to change it to accommodate that. Also, just appends to the end of the document. If you want it elsewhere, find the element you want to place it after and insert it into the DOM at that point. ``` $(document).ready( function() { var headers = $('tr:...
294,463
<p>I am developing an application using the ASP.NET MVC platform, which will be exposed as a service over the web (the <a href="http://en.wikipedia.org/wiki/Software_as_a_Service" rel="nofollow noreferrer">SaaS</a> model). I am trying to determine the best way to partition the URL namespace for each user account. The...
[ { "answer_id": 294515, "author": "Will Hartung", "author_id": 13663, "author_profile": "https://Stackoverflow.com/users/13663", "pm_score": 1, "selected": false, "text": "<p>Sound like option B to me. It's the only one that seems to a) work with your architecture and b) work with your po...
2008/11/16
[ "https://Stackoverflow.com/questions/294463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38087/" ]
I am developing an application using the ASP.NET MVC platform, which will be exposed as a service over the web (the [SaaS](http://en.wikipedia.org/wiki/Software_as_a_Service) model). I am trying to determine the best way to partition the URL namespace for each user account. The application will need to be accessed secu...
I would go with A. This solution is not very expensive, it scales well and it does not limit you to go with custom domains, if you decide this later on. Wildcard certificates used to be quite expensive, but today you could get them around 200 USD annually at [GoDaddy](http://www.godaddy.com/gdshop/ssl/ssl.asp?ci=9039 ...
294,468
<p>I am developing a system as an aid to musicians performing transcription. The aim is to perform automatic music transcription (it does not have to be perfect, as the user will correct glitches / mistakes later) on a single instrument monophonic recording. Does anyone here have experience in automatic music transcrip...
[ { "answer_id": 294536, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 2, "selected": false, "text": "<p>What you want to do is often called <strong>WAV-to-MIDI</strong> (google \"wav-to-midi\"). There have been many at...
2008/11/16
[ "https://Stackoverflow.com/questions/294468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11650/" ]
I am developing a system as an aid to musicians performing transcription. The aim is to perform automatic music transcription (it does not have to be perfect, as the user will correct glitches / mistakes later) on a single instrument monophonic recording. Does anyone here have experience in automatic music transcriptio...
Here is a graphic that illustrates the threshold approach to note onset detection: ![alt text](https://i.imgur.com/MBWzwT8.gif) This image shows a typical WAV file with three discrete notes played in succession. The red line represents a chosen signal threshold, and the blue lines represent note start positions retur...
294,470
<p>I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find <code>uid</code> if I have <code>login</code>?</p> <p>I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?</p>
[ { "answer_id": 294480, "author": "TFKyle", "author_id": 19208, "author_profile": "https://Stackoverflow.com/users/19208", "pm_score": 5, "selected": true, "text": "<p>You might want to have a look at the <a href=\"http://docs.python.org/library/pwd.html\" rel=\"noreferrer\">pwd</a> modul...
2008/11/16
[ "https://Stackoverflow.com/questions/294470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37141/" ]
I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find `uid` if I have `login`? I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?
You might want to have a look at the [pwd](http://docs.python.org/library/pwd.html) module in the python stdlib, for example: ``` import pwd pw = pwd.getpwnam("nobody") uid = pw.pw_uid ``` it uses /etc/passwd (well, technically it uses the posix C API, so I suppose it might work on an OS if it didn't use /etc/passwd...
294,495
<p>I'm trying to make semantic urls for search pages, but if someone use a search finished in dot, the .net engine return a 404. </p> <p>The request don't even get to the routing engine, so i think its something related to security or something like that. </p> <p>For example, the stackoverflow routes also don't work...
[ { "answer_id": 294511, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 0, "selected": false, "text": "<p>Looks like IIS might not know how to handle a request with an empty extension. </p>\n\n<p>Right click on the webs...
2008/11/16
[ "https://Stackoverflow.com/questions/294495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27369/" ]
I'm trying to make semantic urls for search pages, but if someone use a search finished in dot, the .net engine return a 404. The request don't even get to the routing engine, so i think its something related to security or something like that. For example, the stackoverflow routes also don't work in these case: [<...
If you are using .NET 4.0 and IIS 7+, you can set this flag in the system.web section of your web.config and it will be allowed: ``` <httpRuntime relaxedUrlToFileSystemMapping="true" /> ``` I've tested it and it works. [Haack](http://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx) has an exp...
294,502
<p>I'm trying to convert Matt Berseth's '<a href="http://mattberseth.com/blog/2007/10/yui_style_yesno_confirm_dialog.html" rel="nofollow noreferrer">YUI Style Yes/No Confirm Dialog</a>' so I can use it with the jQuery blockUI plugin.</p> <p>I have to admit I'm no CSS guru but I thought this would pretty easy even for ...
[ { "answer_id": 294534, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 4, "selected": true, "text": "<p>hmm i'm not that familiar with blockUI, but the basics of centering a div are pretty universal. i'm assuming you want your <c...
2008/11/16
[ "https://Stackoverflow.com/questions/294502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/419/" ]
I'm trying to convert Matt Berseth's '[YUI Style Yes/No Confirm Dialog](http://mattberseth.com/blog/2007/10/yui_style_yesno_confirm_dialog.html)' so I can use it with the jQuery blockUI plugin. I have to admit I'm no CSS guru but I thought this would pretty easy even for me....except 10hrs later I'm at a loss as to wh...
hmm i'm not that familiar with blockUI, but the basics of centering a div are pretty universal. i'm assuming you want your `#confirmDialogue` div centered within the whole screen? if so, you want to do a few things: ``` #confirmDialogue { position: fixed; // absolutely position this element on the page hei...
294,517
<p>I'm writing a script that pulls XML data from wowarmory.com, using PHP 5 and cURL:</p> <pre><code>$url = "http://www.wowarmory.com"; $userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12'; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_...
[ { "answer_id": 294555, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 2, "selected": false, "text": "<p>Can you access it from your local host via a web browser or even via the <code>curl</code> or <code>wget</code> command ...
2008/11/16
[ "https://Stackoverflow.com/questions/294517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm writing a script that pulls XML data from wowarmory.com, using PHP 5 and cURL: ``` $url = "http://www.wowarmory.com"; $userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12'; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CU...
Can you access it from your local host via a web browser or even via the `curl` or `wget` command line utilities? What does `tcptraceroute` tell you? If neither a web browser nor the command line utility work, but `tcptraceroute` works (and does not show a transparent proxy somewhere in the way), and you are behind a...
294,543
<p>I have a main table that I must get data from. I have a left outer join where the fields will match 40% of the time. And then I have another join where I need to match the data from table A with.</p> <p>This is the SQL in pseudo code. This query won't work.</p> <p>-- This is the part I want to do but doesn't wor...
[ { "answer_id": 294572, "author": "Murat Ayfer", "author_id": 25910, "author_profile": "https://Stackoverflow.com/users/25910", "pm_score": 0, "selected": false, "text": "<p>What happens if you put the \"AND H.COL3 = A.STATE\" in your WHERE clause?</p>\n" }, { "answer_id": 294588,...
2008/11/16
[ "https://Stackoverflow.com/questions/294543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10522/" ]
I have a main table that I must get data from. I have a left outer join where the fields will match 40% of the time. And then I have another join where I need to match the data from table A with. This is the SQL in pseudo code. This query won't work. -- This is the part I want to do but doesn't work. AND H.COL3 = A....
I think you could re-write it like this (but I could be reading your statement wrong) ``` FROM TABLE_A A LEFT OUTER JOIN TABLE_B HIST ON HIST.COL1 = A.COL1 LEFT OUTER JOIN TABLE_D H ON H.COL3 = A.STATE LEFT OUTER JOIN TABLE_C B ON H.COL2 = B.COL2 WHERE A.BRANCH = 'Data' ``` Also, the IBM doco o...
294,553
<p>I was just wondering if there is any difference between the two different new object initializers or is it just syntactic sugar. </p> <p>So is:</p> <pre><code>Dim _StreamReader as New Streamreader(mystream) </code></pre> <p>and different to:</p> <pre><code>Dim _StreamReader as Streamreader = new streamreader(m...
[ { "answer_id": 294564, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>I'm not a VB guy, but as far as I can tell they're equivalent. According to <a href=\"http://msdn.microsoft.com/en-us...
2008/11/16
[ "https://Stackoverflow.com/questions/294553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
I was just wondering if there is any difference between the two different new object initializers or is it just syntactic sugar. So is: ``` Dim _StreamReader as New Streamreader(mystream) ``` and different to: ``` Dim _StreamReader as Streamreader = new streamreader(mystream) ``` Is there any difference under t...
In VB.NET, they're identical. The `As New` variant is canonical. In VB6, their semantics actually differed (apart form the obvious fact that VB6 didn't allow assignments in declarations): the `As New` variant would create an object that could never be `Nothing`. Rather, the runtime would ensure that the object was alw...
294,585
<p>Sorry for the newb question. I'm still learning programming. So I'm using C++, and I need to do something like this:</p> <pre><code>int n; do { n = get_data(); if(n != -1) send(n); } while(n != -1); </code></pre> <p>This is just a sketch. Anyway it doesn't feel real elegant. I have to have my t...
[ { "answer_id": 294589, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 4, "selected": false, "text": "<p>Howabout using <a href=\"http://msdn.microsoft.com/en-us/library/37zc9d2w(VS.80).aspx\" rel=\"noreferrer\">break</a>:</...
2008/11/16
[ "https://Stackoverflow.com/questions/294585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Sorry for the newb question. I'm still learning programming. So I'm using C++, and I need to do something like this: ``` int n; do { n = get_data(); if(n != -1) send(n); } while(n != -1); ``` This is just a sketch. Anyway it doesn't feel real elegant. I have to have my test twice. I could just test o...
Howabout using [break](http://msdn.microsoft.com/en-us/library/37zc9d2w(VS.80).aspx): ``` int n; while(1) { n = get_data(); if(n == -1) break; send(n); } ``` This way you only test once, and quit immediately if get\_data doesn't return what you want.
294,607
<p>I'm using django and when users go to www.website.com/ I want to point them to the index view.</p> <p>Right now I'm doing this:</p> <pre><code>(r'^$', 'ideas.idea.views.index'), </code></pre> <p>However, it's not working. I'm assuming my regular expression is wrong. Can anyone help me out? I've looked at python r...
[ { "answer_id": 294612, "author": "Harley Holcombe", "author_id": 1057, "author_profile": "https://Stackoverflow.com/users/1057", "pm_score": 3, "selected": true, "text": "<p>What you have should work (it does for me). Make sure it's in the top <code>urls.py</code>, and it should also be...
2008/11/17
[ "https://Stackoverflow.com/questions/294607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
I'm using django and when users go to www.website.com/ I want to point them to the index view. Right now I'm doing this: ``` (r'^$', 'ideas.idea.views.index'), ``` However, it's not working. I'm assuming my regular expression is wrong. Can anyone help me out? I've looked at python regular expressions but they didn'...
What you have should work (it does for me). Make sure it's in the top `urls.py`, and it should also be at the top of the list.
294,616
<p>I am trying to resolve Euler Problem 18 -> <a href="http://projecteuler.net/index.php?section=problems&amp;id=18" rel="nofollow noreferrer">http://projecteuler.net/index.php?section=problems&amp;id=18</a></p> <p>I am trying to do this with c++ (I am relearning it and euler problems make for good learning/searching ...
[ { "answer_id": 294641, "author": "Alastair", "author_id": 31038, "author_profile": "https://Stackoverflow.com/users/31038", "pm_score": 3, "selected": true, "text": "<p>Ok so first off, I'm a little unclear as to what you think the problem is. I can't parse that second-last sentence at a...
2008/11/17
[ "https://Stackoverflow.com/questions/294616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8715/" ]
I am trying to resolve Euler Problem 18 -> <http://projecteuler.net/index.php?section=problems&id=18> I am trying to do this with c++ (I am relearning it and euler problems make for good learning/searching material) ``` #include <iostream> using namespace std; long long unsigned countNums(short,short,short array[][...
Ok so first off, I'm a little unclear as to what you think the problem is. I can't parse that second-last sentence at all... Secondly you might want to re-think your design here. Think about functions that perform a single discrete task and are not intertwined with the rest of the application (ie read up on "tightly c...
294,622
<p>I'm getting an exception which says "Access Denied" when the users permissions are sufficient, how do I catch an exception and check for "Access Denied" so that I can show the user a friendlier "Sorry Access Denied" message?</p> <p>Thanks Beginner :-)</p>
[ { "answer_id": 294630, "author": "Ed S.", "author_id": 1053, "author_profile": "https://Stackoverflow.com/users/1053", "pm_score": 3, "selected": false, "text": "<p>If you are using a try catch block...</p>\n\n<pre><code>try\n{\n //error occurs\n}\ncatch (Exception ex)\n{\n Message...
2008/11/17
[ "https://Stackoverflow.com/questions/294622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm getting an exception which says "Access Denied" when the users permissions are sufficient, how do I catch an exception and check for "Access Denied" so that I can show the user a friendlier "Sorry Access Denied" message? Thanks Beginner :-)
You don't really want to check the string of the message, you want to check the type of the message, which can be easily done by catching only the type(s) of exception you are checking for. The following example will catch two different types of exceptions and do different actions based on what if any error occurs. (No...
294,659
<p>I made a couple of changes to my working application and started getting the following error at this line of code.</p> <pre><code>Dim Deserializer As New Serialization.XmlSerializer(GetType(Groups)) </code></pre> <p>And here is the error.</p> <pre><code> BindingFailure was detected Message: The assembly wi...
[ { "answer_id": 294833, "author": "Brody", "author_id": 17131, "author_profile": "https://Stackoverflow.com/users/17131", "pm_score": 1, "selected": false, "text": "<p>It appears that you cannot locate the assembly FUSE.XmlSerializers. Check the results of the <a href=\"http://msdn.micros...
2008/11/17
[ "https://Stackoverflow.com/questions/294659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6514/" ]
I made a couple of changes to my working application and started getting the following error at this line of code. ``` Dim Deserializer As New Serialization.XmlSerializer(GetType(Groups)) ``` And here is the error. ``` BindingFailure was detected Message: The assembly with display name 'FUSE.XmlSerializers'...
The main reason this was happening was because I had a mismatch in the types I was trying to Serialize and Deserialize. I was Serializing ObservableCollection (of Group) and deserializing a business object - Groups which inherited ObservableCollection (of Group). And this was also part of the problem... From - <http:/...
294,661
<p>I have a MySQL table that will only have one row. What should my statement be for the first time I insert to this row, and for subsequent updates? I tried an insert where the primary key equals 1, but this doesn't account for the first time around when no row exists yet.</p>
[ { "answer_id": 294671, "author": "SoapBox", "author_id": 36384, "author_profile": "https://Stackoverflow.com/users/36384", "pm_score": 4, "selected": true, "text": "<pre><code>INSERT INTO table(col1,col2,col3) VALUES(val1,val2,val3) ON DUPLICATE KEY UPDATE col1 = val1, col2 = val2, col3 ...
2008/11/17
[ "https://Stackoverflow.com/questions/294661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a MySQL table that will only have one row. What should my statement be for the first time I insert to this row, and for subsequent updates? I tried an insert where the primary key equals 1, but this doesn't account for the first time around when no row exists yet.
``` INSERT INTO table(col1,col2,col3) VALUES(val1,val2,val3) ON DUPLICATE KEY UPDATE col1 = val1, col2 = val2, col3 = val3; ```
294,664
<p>I also want to save the font size in my <code>.emacs</code> file.</p>
[ { "answer_id": 294668, "author": "George Stocker", "author_id": 16587, "author_profile": "https://Stackoverflow.com/users/16587", "pm_score": 6, "selected": false, "text": "<p>Press Shift and the first mouse button. You can change the font size in the following way: <a href=\"https://w...
2008/11/17
[ "https://Stackoverflow.com/questions/294664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8661/" ]
I also want to save the font size in my `.emacs` file.
```lisp (set-face-attribute 'default nil :height 100) ``` The value is in 1/10pt, so 100 will give you 10pt, etc.
294,699
<p>I am using the following servlet-mapping in my <code>web.xml</code> file:</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;PostController&lt;/servlet-name&gt; &lt;servlet-class&gt;com.webcodei.controller.PostController&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;...
[ { "answer_id": 294708, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 2, "selected": false, "text": "<p>Two options come to mind:</p>\n\n<p>1) Typically, in web app like this, the \"action\" URLs that are handled by a servlet...
2008/11/17
[ "https://Stackoverflow.com/questions/294699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37190/" ]
I am using the following servlet-mapping in my `web.xml` file: ``` <servlet> <servlet-name>PostController</servlet-name> <servlet-class>com.webcodei.controller.PostController</servlet-class> </servlet> <servlet-mapping> <servlet-name>PostController</servlet-name> <url-pattern>/*</url-pattern> </servlet...
Two options come to mind: 1) Typically, in web app like this, the "action" URLs that are handled by a servlet, are given either a sub-directory like "`/actions/*`" or are given an extension like "`*.action`" or "`*.do`" (this is what Struts does). This way it's clear which URLs are intended for the servlet. This is mo...
294,705
<p>I have two tables: articles and articletags</p> <pre><code>articles: id, author, date_time, article_text articletags: id, tag (article.id == articletags.id in a many-to-many relationship) </code></pre> <p>I am after the last time that something was published under each tag. To put it another way, for every tag, l...
[ { "answer_id": 294713, "author": "SoapBox", "author_id": 36384, "author_profile": "https://Stackoverflow.com/users/36384", "pm_score": 0, "selected": false, "text": "<pre><code>SELECT date_time, tag \nFROM articles, articletags\nWHERE articles.id = articletags.id\nORDER BY date_time DESC...
2008/11/17
[ "https://Stackoverflow.com/questions/294705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3431280/" ]
I have two tables: articles and articletags ``` articles: id, author, date_time, article_text articletags: id, tag (article.id == articletags.id in a many-to-many relationship) ``` I am after the last time that something was published under each tag. To put it another way, for every tag, look through all the articl...
``` select t.tag, max(a.date_time) as latest from articles a inner join articletags t on t.id = a.id group by t.tag ```
294,712
<p>I have a few model classes with basic one-to-many relationships. For example, a book has many recipes, and each recipe has many ingredients:</p> <pre><code>class Book(models.Model): name = models.CharField(max_length=64) class Recipe(models.Model): book = models.ForeignKey(Book) name = models.CharFiel...
[ { "answer_id": 294717, "author": "Harley Holcombe", "author_id": 1057, "author_profile": "https://Stackoverflow.com/users/1057", "pm_score": 1, "selected": false, "text": "<p>To print each recipe and its ingredients:</p>\n\n<pre><code>mybook = Book.objects.get(name=\"Jason's Cookbook\")\...
2008/11/17
[ "https://Stackoverflow.com/questions/294712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5142/" ]
I have a few model classes with basic one-to-many relationships. For example, a book has many recipes, and each recipe has many ingredients: ``` class Book(models.Model): name = models.CharField(max_length=64) class Recipe(models.Model): book = models.ForeignKey(Book) name = models.CharField(max_length=64...
Actually, it looks like there's a better approach using filter: ``` my_book = Book.objects.get(pk=1) all_ingredients = Ingredient.objects.filter(recipe__book=my_book) ```
294,738
<p>When I debug my ASP.NET web site code using the Microsoft debug symbol's for .NET .. I keep getting this silly 'result' for most of the variables when I'm debugging .NET framework code (which of course is provided by the Microsoft Symbol Server, which I told VS2008 to grab the info, from)</p> <pre><code>Cannot obta...
[ { "answer_id": 294743, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 1, "selected": false, "text": "<p>The .NET framework code is optimized, so you will not be able to view all the variables as they probably don't ex...
2008/11/17
[ "https://Stackoverflow.com/questions/294738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30674/" ]
When I debug my ASP.NET web site code using the Microsoft debug symbol's for .NET .. I keep getting this silly 'result' for most of the variables when I'm debugging .NET framework code (which of course is provided by the Microsoft Symbol Server, which I told VS2008 to grab the info, from) ``` Cannot obtain value of lo...
Shawn Burke described a method of disabling this on his [blog](http://blogs.msdn.com/sburke/archive/2008/01/29/how-to-disable-optimizations-when-debugging-reference-source.aspx). First, create a CMD that'll load Visual Studio without JIT optimization. ``` set COMPLUS_ZapDisable=1 cd /d "%ProgramFiles%\Microsoft Visu...
294,771
<p>Please excuse my lack of knowledge... I know there is a lot of documentation on the internet related to this but I still don't understand.</p> <p>My situation is this:</p> <p>I have an XML file that I need import and eventually replace daily with.</p> <pre><code> &lt;item&gt; &lt;model&gt;AA311-Pink&lt...
[ { "answer_id": 295522, "author": "gx.", "author_id": 21580, "author_profile": "https://Stackoverflow.com/users/21580", "pm_score": 0, "selected": false, "text": "<p>No paying required, <a href=\"http://web.archive.org/web/20100105150533/http://dev.mysql.com/tech-resources/articles/xml-in...
2008/11/17
[ "https://Stackoverflow.com/questions/294771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Please excuse my lack of knowledge... I know there is a lot of documentation on the internet related to this but I still don't understand. My situation is this: I have an XML file that I need import and eventually replace daily with. ``` <item> <model>AA311-Pink</model> <title>1122</title> ...
You should a read on this - load a XML into MySQL <http://dev.mysql.com/doc/refman/5.5/en/load-xml.html> This allow you to do something like this: ``` mysql> LOAD XML LOCAL INFILE 'items.xml' -> INTO TABLE item -> ROWS IDENTIFIED BY '<item>'; ```
294,773
<p>First of all, I'm kinda new to the barcode formats and what I do know, I've learned from Wikipedia.</p> <p>We have some barcodes generated by an existing app that uses the Barcode.4NET library. The barcode is in Code 128A format. The code to generate them is pretty simple, looking something like this:</p> <pre><co...
[ { "answer_id": 294790, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 2, "selected": false, "text": "<p>the number should be:</p>\n<pre><code>*045746201627080857*\n</code></pre>\n<p>you need to add the asterisk to the st...
2008/11/17
[ "https://Stackoverflow.com/questions/294773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14894/" ]
First of all, I'm kinda new to the barcode formats and what I do know, I've learned from Wikipedia. We have some barcodes generated by an existing app that uses the Barcode.4NET library. The barcode is in Code 128A format. The code to generate them is pretty simple, looking something like this: ``` // Create the barc...
Is it really necessary for them to look exactly the same? The different versions of Code 128 are all capable of encoding numbers, even if the barcodes themselves look completely different; the reader should sort it all out in the end. I prefer the B variant, because it has the lower case letters in addition to the upp...
294,779
<p>I have a big list of global variables that each have their own setup function. My goal is to go through this list, call each item's setup function, and generate some stats on the data loaded in the matching variable. However, what I'm trying now isn't working and I need help to make my program call the setup functio...
[ { "answer_id": 294789, "author": "Nowhere man", "author_id": 400277, "author_profile": "https://Stackoverflow.com/users/400277", "pm_score": 5, "selected": true, "text": "<p>It's because MAKE-SYMBOL returns an uninterned symbol. You should use INTERN instead.</p>\n" }, { "answer_...
2008/11/17
[ "https://Stackoverflow.com/questions/294779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38132/" ]
I have a big list of global variables that each have their own setup function. My goal is to go through this list, call each item's setup function, and generate some stats on the data loaded in the matching variable. However, what I'm trying now isn't working and I need help to make my program call the setup functions....
It's because MAKE-SYMBOL returns an uninterned symbol. You should use INTERN instead.
294,795
<p>Wwhen I click the button on the popup to insert data to database, it does nothing, WHYYYYY?</p> <pre><code>&lt;cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="popup" TargetControlID="cmdTrigger" PopupControlID="pnlPopup" BackgroundCssClass="modalBackground" OkCont...
[ { "answer_id": 294799, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 3, "selected": true, "text": "<p>Remove the OkControlId property as I think it prevents a postback from occuring.</p>\n" }, { "answer_id": ...
2008/11/17
[ "https://Stackoverflow.com/questions/294795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
Wwhen I click the button on the popup to insert data to database, it does nothing, WHYYYYY? ``` <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="popup" TargetControlID="cmdTrigger" PopupControlID="pnlPopup" BackgroundCssClass="modalBackground" OkControlID="btnOk" > ...
Remove the OkControlId property as I think it prevents a postback from occuring.
294,805
<p>I have a Silverlight 2 app that sends a byte array to a Silverlight-enabled WCF service. However, (unless I try to upload a .txt file) the service's <code>SaveFile()</code> method is never reached and I get an error: "The remote server returned an error: NotFound"</p> <p>Am I missing something really obvious? Why...
[ { "answer_id": 295077, "author": "Jon Galloway", "author_id": 5, "author_profile": "https://Stackoverflow.com/users/5", "pm_score": 1, "selected": false, "text": "<p>I'm not sure what the specific issue is, but I can tell you that the uploads are definitely not limited to .txt files - I'...
2008/11/17
[ "https://Stackoverflow.com/questions/294805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22303/" ]
I have a Silverlight 2 app that sends a byte array to a Silverlight-enabled WCF service. However, (unless I try to upload a .txt file) the service's `SaveFile()` method is never reached and I get an error: "The remote server returned an error: NotFound" Am I missing something really obvious? Why can't I upload .doc fi...
FYI, I figured out my problem and [this article](http://michaelsync.net/2008/03/27/uploading-with-silveright-2-beta-1-and-wcf) solved it. "By default the largest message that can be sent to a service from the client is 8124 bytes." So I had to increase the limit via the bindings config settings. But now my main issue ...
294,822
<p>I have a ComboBox bound to an ObservableCollection of decimals. What is the correct way to apply our currency converter to the items?</p> <p>Edit:</p> <p>a) I have an existing currency converter that I must use b) .NET 3.0</p> <p>Do I need to template the items?</p>
[ { "answer_id": 294830, "author": "Jobi Joy", "author_id": 8091, "author_profile": "https://Stackoverflow.com/users/8091", "pm_score": 0, "selected": false, "text": "<p>Use <strong>StringFormat</strong> in the Binding expression like </p>\n\n<pre><code>&lt;TextBox Text=\"{Binding Path=Val...
2008/11/17
[ "https://Stackoverflow.com/questions/294822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28074/" ]
I have a ComboBox bound to an ObservableCollection of decimals. What is the correct way to apply our currency converter to the items? Edit: a) I have an existing currency converter that I must use b) .NET 3.0 Do I need to template the items?
Your best bet if you have some code to do the conversion is indeed to run each item through an IValueConverter via a template. ``` <Window.Resources> <my:CurrencyConverter x:Key="currencyConverter" /> <DataTemplate x:Key="thingTemplate" DataType="{x:Type my:Thing}"> <TextBlock Text="{Bind...
294,865
<p>How do you convert a number to a string showing dollars and cents?</p> <pre><code>eg: 123.45 =&gt; '$123.45' 123.456 =&gt; '$123.46' 123 =&gt; '$123.00' .13 =&gt; '$0.13' .1 =&gt; '$0.10' 0 =&gt; '$0.00' </code></pre>
[ { "answer_id": 294868, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 3, "selected": false, "text": "<p>In PHP and C++ you can use the printf() function</p>\n\n<pre><code>printf(\"$%01.2f\", $money);\n</code></pre>\n" }, { ...
2008/11/17
[ "https://Stackoverflow.com/questions/294865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
How do you convert a number to a string showing dollars and cents? ``` eg: 123.45 => '$123.45' 123.456 => '$123.46' 123 => '$123.00' .13 => '$0.13' .1 => '$0.10' 0 => '$0.00' ```
PHP also has [money\_format()](http://php.net/money_format). Here's an example: ``` echo money_format('$%i', 3.4); // echos '$3.40' ``` This function actually has tons of options, go to the documentation I linked to to see them. Note: money\_format is undefined in Windows. --- UPDATE: Via the PHP manual: <https:...
294,875
<p>What are some of the ways you have implemented models in the Zend Framework?</p> <p>I have seen the basic <code>class User extends Zend_Db_Table_Abstract</code> and then putting calls to that in your controllers: </p> <p><code>$foo = new User;</code></p> <p><code>$foo-&gt;fetchAll()</code></p> <p>but what about ...
[ { "answer_id": 294896, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 1, "selected": false, "text": "<p>You can do more complicated queries, check the <a href=\"http://framework.zend.com/manual/en/zend.db.table.h...
2008/11/17
[ "https://Stackoverflow.com/questions/294875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11252/" ]
What are some of the ways you have implemented models in the Zend Framework? I have seen the basic `class User extends Zend_Db_Table_Abstract` and then putting calls to that in your controllers: `$foo = new User;` `$foo->fetchAll()` but what about more sophisticated uses? The Quickstart section of the documentatio...
I personally subclass both `Zend_Db_Table_Abstract` and `Zend_Db_Table_Row_Abstract`. The main difference between my code and yours is that explicitly treat the subclass of `Zend_Db_Table_Abstract` as a "table" and `Zend_Db_Table_Row_Abstract` as "row". Very rarely do I see direct calls to select objects, SQL, or the b...
294,885
<p>I have a table like this:</p> <pre><code>&lt;table&gt; &lt;tfoot&gt; &lt;tr&gt;&lt;td&gt;footer&lt;/td&gt;&lt;/tr&gt; &lt;/tfoot&gt; &lt;tbody&gt; &lt;tr&gt;&lt;td&gt;Body 1&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Body 1&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Body 1&...
[ { "answer_id": 294886, "author": "Dave Jensen", "author_id": 35341, "author_profile": "https://Stackoverflow.com/users/35341", "pm_score": 7, "selected": true, "text": "<p>Try this, if you don't mind not having borders.</p>\n\n<pre><code>&lt;style&gt;\ntable {\n border-collapse: collaps...
2008/11/17
[ "https://Stackoverflow.com/questions/294885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
I have a table like this: ``` <table> <tfoot> <tr><td>footer</td></tr> </tfoot> <tbody> <tr><td>Body 1</td></tr> <tr><td>Body 1</td></tr> <tr><td>Body 1</td></tr> </tbody> <tbody> <tr><td>Body 2</td></tr> <tr><td>Body 2</td></tr> <tr><td>Body ...
Try this, if you don't mind not having borders. ``` <style> table { border-collapse: collapse; } table tbody { border-top: 15px solid white; } </style> <table> <tfoot> <tr><td>footer</td></tr> </tfoot> <tbody> <tr><td>Body 1</td></tr> <tr><td>Body 1</td></tr> <tr><td>B...
294,917
<p>I'm trying to create a newsletter standard for our org and having problems with Outlook rendering the text too large.</p> <p>Here is the css section of the page</p> <pre><code>body { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 75%; background: url(http://www.bla...
[ { "answer_id": 294930, "author": "Jeff Sheldon", "author_id": 33910, "author_profile": "https://Stackoverflow.com/users/33910", "pm_score": 0, "selected": false, "text": "<p>If you want to set a specific size for you fonts, then you should probably use a fixed size type like pt. Rather t...
2008/11/17
[ "https://Stackoverflow.com/questions/294917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38149/" ]
I'm trying to create a newsletter standard for our org and having problems with Outlook rendering the text too large. Here is the css section of the page ``` body { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 75%; background: url(http://www.blah.com/stuff.gif); ...
Have you tryed using `main *{font-size: 12pt;}` ? Outlook by default uses Trident, IE's engine for incoming mail, and Word HTML rendering engine for outgoing mail... [Until Office 2007, and people hate it.](http://blogs.zdnet.com/microsoft/?p=229) Now, [it uses Word 2007's rendering](http://www.campaignmonitor.com/bl...
294,927
<p>Do you have to pass delete the same pointer that was returned by new, or can you pass it a pointer to one of the classes base types? For example:</p> <pre><code>class Base { public: virtual ~Base(); ... }; class IFoo { public: virtual ~IFoo() {} virtual void DoSomething() = 0; }; class Bar : publ...
[ { "answer_id": 294932, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 7, "selected": true, "text": "<p>Yes, it will work, <strong>if and only if</strong> the base class destructor is virtual, which you have done for t...
2008/11/17
[ "https://Stackoverflow.com/questions/294927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5987/" ]
Do you have to pass delete the same pointer that was returned by new, or can you pass it a pointer to one of the classes base types? For example: ``` class Base { public: virtual ~Base(); ... }; class IFoo { public: virtual ~IFoo() {} virtual void DoSomething() = 0; }; class Bar : public Base, public...
Yes, it will work, **if and only if** the base class destructor is virtual, which you have done for the `Base` base class but not for the `IFoo` base class. If the base class destructor is virtual, then when you call `operator delete` on the base class pointer, it uses dynamic dispatch to figure out how to delete the o...
294,949
<p>I need to create an empty .mdb file, so that I can then run ADO commands on it (<em>not</em> ADO.NET). Is there a way to create an empty mdb using ADO?</p>
[ { "answer_id": 294959, "author": "Corey Trager", "author_id": 9328, "author_profile": "https://Stackoverflow.com/users/9328", "pm_score": 3, "selected": true, "text": "<p>Here are some code snippets that work: </p>\n\n<pre><code> string sADOProvider = \"Provider=Microso...
2008/11/17
[ "https://Stackoverflow.com/questions/294949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14902/" ]
I need to create an empty .mdb file, so that I can then run ADO commands on it (*not* ADO.NET). Is there a way to create an empty mdb using ADO?
Here are some code snippets that work: ``` string sADOProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; ADOX.CatalogClass cat = new ADOX.CatalogClass(); string sCreate = MainForm.sADOProvider + sFullPath; cat.Create(sCreate); // The point of this code is to unlock...
294,989
<p>Can somebody tell me how to use the <em><code>printWhenExpression</code></em> of JasperReports?</p>
[ { "answer_id": 294999, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 4, "selected": false, "text": "<p>Do you have an error relative to boolean ?</p>\n\n<p>Because you need to use Boolean instead of the primitive type.</p>\n\n<...
2008/11/17
[ "https://Stackoverflow.com/questions/294989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Can somebody tell me how to use the *`printWhenExpression`* of JasperReports?
Do you have an error relative to boolean ? Because you need to use Boolean instead of the primitive type. So: ``` $F{mesure} != "PH" ($F{userfd4}).equals("1") ? true : false ``` would give `cannot cast from boolean to Boolean`. ``` ( $F{mesure}.startsWith("PH") ? Boolean.TRUE:Boolean.FALSE ) ($F{userfd4}).equa...
295,009
<p>I'm dealing with an Oracle DBA at the moment, who has sent me some profiling he's done. One of the terms in his report is 'Buffer Gets', any idea what this actually means? My guess is bytes retrieved from a buffer, but I have no idea really. Here is some sample output:</p> <pre><code> Buffer Gets Executions Ge...
[ { "answer_id": 295092, "author": "WW.", "author_id": 14663, "author_profile": "https://Stackoverflow.com/users/14663", "pm_score": 7, "selected": true, "text": "<p>Oracle storage is arranged into blocks of a given size (e.g. 8k). Tables and indexes are made up of a series of blocks on t...
2008/11/17
[ "https://Stackoverflow.com/questions/295009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6044/" ]
I'm dealing with an Oracle DBA at the moment, who has sent me some profiling he's done. One of the terms in his report is 'Buffer Gets', any idea what this actually means? My guess is bytes retrieved from a buffer, but I have no idea really. Here is some sample output: ``` Buffer Gets Executions Gets per Exec %...
Oracle storage is arranged into blocks of a given size (e.g. 8k). Tables and indexes are made up of a series of blocks on the disk. When these blocks are in memory they occupy a buffer. When Oracle requires a block it does a **buffer get**. First it checks to see if it already has the block it needs in memory. If so, ...
295,013
<p>In the application that I am working on, the logging facility makes use of <code>sprintf</code> to format the text that gets written to file. So, something like:</p> <pre><code>char buffer[512]; sprintf(buffer, ... ); </code></pre> <p>This sometimes causes problems when the message that gets sent in becomes too bi...
[ { "answer_id": 295018, "author": "Artelius", "author_id": 31945, "author_profile": "https://Stackoverflow.com/users/31945", "pm_score": 2, "selected": false, "text": "<p>\"the logging facility makes use of sprintf to format the text that gets written to file\"</p>\n\n<p><code>fprintf()</...
2008/11/17
[ "https://Stackoverflow.com/questions/295013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4368/" ]
In the application that I am working on, the logging facility makes use of `sprintf` to format the text that gets written to file. So, something like: ``` char buffer[512]; sprintf(buffer, ... ); ``` This sometimes causes problems when the message that gets sent in becomes too big for the manually allocated buffer. ...
No you can't use `sprintf()` to allocate enough memory. Alternatives include: * use `snprintf()` to truncate the message - does not fully resolve your problem, but prevent the buffer overflow issue * double (or triple or ...) the buffer - unless you're in a constrained environment * use C++ `std::string` and `ostrings...
295,016
<p>When using <code>call_user_func_array()</code> I want to pass a parameter by reference. How would I do this. For example</p> <pre><code>function toBeCalled( &amp;$parameter ) { //...Do Something... } $changingVar = 'passThis'; $parameters = array( $changingVar ); call_user_func_array( 'toBeCalled', $paramete...
[ { "answer_id": 295020, "author": "Steven Oxley", "author_id": 3831, "author_profile": "https://Stackoverflow.com/users/3831", "pm_score": 7, "selected": true, "text": "<p>To pass by reference using <code>call_user_func_array()</code>, the parameter in the array must be a reference - it d...
2008/11/17
[ "https://Stackoverflow.com/questions/295016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831/" ]
When using `call_user_func_array()` I want to pass a parameter by reference. How would I do this. For example ``` function toBeCalled( &$parameter ) { //...Do Something... } $changingVar = 'passThis'; $parameters = array( $changingVar ); call_user_func_array( 'toBeCalled', $parameters ); ```
To pass by reference using `call_user_func_array()`, the parameter in the array must be a reference - it does not depend on the function definition whether or not it is passed by reference. For example, this would work: ``` function toBeCalled( &$parameter ) { //...Do Something... } $changingVar = 'passThis'; $pa...
295,027
<p>I am working on refactoring some old code and have found few structs containing zero length arrays (below). Warnings depressed by pragma, of course, but I've failed to create by "new" structures containing such structures (error 2233). Array 'byData' used as pointer, but why not to use pointer instead? or array of l...
[ { "answer_id": 295030, "author": "arul", "author_id": 15409, "author_profile": "https://Stackoverflow.com/users/15409", "pm_score": 5, "selected": false, "text": "<p>This is an old C hack to allow a flexible sized arrays.</p>\n\n<p>In C99 standard this is not neccessary as it supports th...
2008/11/17
[ "https://Stackoverflow.com/questions/295027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7003/" ]
I am working on refactoring some old code and have found few structs containing zero length arrays (below). Warnings depressed by pragma, of course, but I've failed to create by "new" structures containing such structures (error 2233). Array 'byData' used as pointer, but why not to use pointer instead? or array of leng...
Yes this is a C-Hack. To create an array of any length: ``` struct someData* mallocSomeData(int size) { struct someData* result = (struct someData*)malloc(sizeof(struct someData) + size * sizeof(BYTE)); if (result) { result->nData = size; } return result; } ``` Now you have an object of so...
295,028
<p>I have a very tricky situation (for my standards) in hand. I have a script that needs to read a script variable name from <a href="https://docs.python.org/2/library/configparser.html" rel="nofollow noreferrer">ConfigParser</a>. For example, I need to read</p> <pre><code>self.post.id </code></pre> <p>from a .cfg fi...
[ { "answer_id": 295038, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 4, "selected": true, "text": "<p>test.ini:</p>\n\n<pre><code>[head]\nvar: self.post.id\n</code></pre>\n\n<p>python:</p>\n\n<pre><code>import ConfigParser\n\nc...
2008/11/17
[ "https://Stackoverflow.com/questions/295028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2220518/" ]
I have a very tricky situation (for my standards) in hand. I have a script that needs to read a script variable name from [ConfigParser](https://docs.python.org/2/library/configparser.html). For example, I need to read ``` self.post.id ``` from a .cfg file and use it as a variable in the script. How do I achieve thi...
test.ini: ``` [head] var: self.post.id ``` python: ``` import ConfigParser class Test: def __init__(self): self.post = TestPost(5) def getPost(self): config = ConfigParser.ConfigParser() config.read('/path/to/test.ini') newvar = config.get('head', 'var') print eval(newvar) class...
295,035
<p>I have a sharepoint event handler which I want to activate for a single list, not all the lists in the site. How do I go about this?</p>
[ { "answer_id": 295045, "author": "Kasper", "author_id": 23499, "author_profile": "https://Stackoverflow.com/users/23499", "pm_score": 2, "selected": false, "text": "<p>Just that list or that list in each site ?\nI have been testing the code that run when the event happens and I have used...
2008/11/17
[ "https://Stackoverflow.com/questions/295035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1909/" ]
I have a sharepoint event handler which I want to activate for a single list, not all the lists in the site. How do I go about this?
Got the answer. We need to run this code, maybe in a console app. I still didn't get how to remove the event handler once it has been added though... ``` string siteUrl = Console.ReadLine(); SPSite site = new SPSite(siteUrl); SPWeb web = site.OpenWeb(); string listName = Console.ReadLine(); SPList list = web.Lists[li...
295,042
<p>Is there an issue with databinding in WPF when you bind to the current source (Path=".") and using a converter? The two way binding doesn't seem to work in this situation.</p> <p>I know I could change the path, but I want to be able to pass the "Name" value to the converter.</p> <p>I can't get the following exampl...
[ { "answer_id": 295045, "author": "Kasper", "author_id": 23499, "author_profile": "https://Stackoverflow.com/users/23499", "pm_score": 2, "selected": false, "text": "<p>Just that list or that list in each site ?\nI have been testing the code that run when the event happens and I have used...
2008/11/17
[ "https://Stackoverflow.com/questions/295042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3820/" ]
Is there an issue with databinding in WPF when you bind to the current source (Path=".") and using a converter? The two way binding doesn't seem to work in this situation. I know I could change the path, but I want to be able to pass the "Name" value to the converter. I can't get the following example to work: ``` <...
Got the answer. We need to run this code, maybe in a console app. I still didn't get how to remove the event handler once it has been added though... ``` string siteUrl = Console.ReadLine(); SPSite site = new SPSite(siteUrl); SPWeb web = site.OpenWeb(); string listName = Console.ReadLine(); SPList list = web.Lists[li...
295,052
<p>Ok I need to determine the system's OS from a Lua script, but Lua as such has no API for this, so I use os.getenv() and query enviromental variables. On Windows checking the enviromental variable "OS" gives me the name of the system's OS, but is there some variable that exists on both Windows and most flavors of Uni...
[ { "answer_id": 295056, "author": "friol", "author_id": 23034, "author_profile": "https://Stackoverflow.com/users/23034", "pm_score": 1, "selected": false, "text": "<p>Unixes should have the $HOME variable (while Windows doesn't have that), so you can check it (after checking the OS varia...
2008/11/17
[ "https://Stackoverflow.com/questions/295052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
Ok I need to determine the system's OS from a Lua script, but Lua as such has no API for this, so I use os.getenv() and query enviromental variables. On Windows checking the enviromental variable "OS" gives me the name of the system's OS, but is there some variable that exists on both Windows and most flavors of Unix t...
On a Unix system, try os.capture 'uname' where os.capture is defined below: ``` function os.capture(cmd, raw) local f = assert(io.popen(cmd, 'r')) local s = assert(f:read('*a')) f:close() if raw then return s end s = string.gsub(s, '^%s+', '') s = string.gsub(s, '%s+$', '') s = string.gsub(s, '[\n\r]+',...
295,055
<p>I'm learning xForms, but apparently not well enough because I can't figure out why <a href="http://www.logomachist.info/temp/fix_me.xhtml.xml" rel="nofollow noreferrer">this code</a> doesn't work. </p> <p>It parses in FF2 w/ the xForms extension but does not render the form controls. IE7 and X-Smiles give me differ...
[ { "answer_id": 295205, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 0, "selected": false, "text": "<p>You shouldn't place your models in the body section. Instead all model definitions should be in the head section. ...
2008/11/17
[ "https://Stackoverflow.com/questions/295055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22885/" ]
I'm learning xForms, but apparently not well enough because I can't figure out why [this code](http://www.logomachist.info/temp/fix_me.xhtml.xml) doesn't work. It parses in FF2 w/ the xForms extension but does not render the form controls. IE7 and X-Smiles give me different problems, but I'm not sure if those problem...
This document contains a ton of problems unfortunately, I'll go through each of them in turn. 1) The biggest problem occurs a few times and seems to stem from some confusion between the `model` and the UI. The two are entirely separate beasts in XForms, which adheres to the model-view-controller design pattern. So you...
295,058
<p>How do I convert a string to the variable name in <a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29" rel="noreferrer">Python</a>?</p> <p>For example, if the program contains a object named <code>self.post</code> that contains a variable named, I want to do something like:</p> <pre><code>somef...
[ { "answer_id": 295064, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 6, "selected": true, "text": "<p>As referenced in Stack&nbsp;Overflow question <em><a href=\"https://stackoverflow.com/questions/295028/\">Inplace substitutio...
2008/11/17
[ "https://Stackoverflow.com/questions/295058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2220518/" ]
How do I convert a string to the variable name in [Python](http://en.wikipedia.org/wiki/Python_%28programming_language%29)? For example, if the program contains a object named `self.post` that contains a variable named, I want to do something like: ``` somefunction("self.post.id") = |Value of self.post.id| ```
As referenced in Stack Overflow question *[Inplace substitution from ConfigParser](https://stackoverflow.com/questions/295028/)*, you're looking for `eval()`: ``` print eval('self.post.id') # Prints the value of self.post.id ```
295,059
<p>Is it possible to get the value from the first page to the second page, BUT without <code>FORM</code>?</p> <p>Shall we use</p> <pre><code>window.parent.document.getElementById(&quot;&quot;).value.. </code></pre> <p>But this is working in <code>popup</code> window, but I need this for between two pages which redirect...
[ { "answer_id": 295075, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 2, "selected": true, "text": "<p>If you are redirecting from one page to another, you MUST use form elements to pass from page to page or use a q...
2008/11/17
[ "https://Stackoverflow.com/questions/295059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38172/" ]
Is it possible to get the value from the first page to the second page, BUT without `FORM`? Shall we use ``` window.parent.document.getElementById("").value.. ``` But this is working in `popup` window, but I need this for between two pages which redirecting from the first page to the second page.
If you are redirecting from one page to another, you MUST use form elements to pass from page to page or use a querystring value. That is it, Javascript does NOT have any knowledge of the structure of the previous page..