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
471,013
<p>For a program I am writing, I need to ask a user for an integer between 1 and 8. I've tried multiple (cleaner) ways of doing this but none of them worked, so I'm left with this:</p> <pre><code> int x = 0; while (x &lt; 1 || x &gt; 8) { System.out.print("Please enter integer (1-8): "); ...
[ { "answer_id": 471025, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": true, "text": "<p>Scanner does regular expressions, right? Why not check if it matches \"^[1-8]$\" first?</p>\n" }, { "answer_...
2009/01/22
[ "https://Stackoverflow.com/questions/471013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29595/" ]
For a program I am writing, I need to ask a user for an integer between 1 and 8. I've tried multiple (cleaner) ways of doing this but none of them worked, so I'm left with this: ``` int x = 0; while (x < 1 || x > 8) { System.out.print("Please enter integer (1-8): "); try { ...
Scanner does regular expressions, right? Why not check if it matches "^[1-8]$" first?
471,014
<p>How would I do this in PHP?</p> <pre><code>Server.Transfer("/index.aspx") </code></pre> <p>(add ';' for C#)</p> <p><strong>EDIT:</strong></p> <p>It is important to have the URL remain the same as before; you know, for Google. In my situation, we have a bunch of .html files that we want to transfer and it is imp...
[ { "answer_id": 471019, "author": "TJ L", "author_id": 12605, "author_profile": "https://Stackoverflow.com/users/12605", "pm_score": 2, "selected": false, "text": "<p>The easiest way is to use a <code>header</code> redirect.</p>\n\n<pre><code>header('Location: /index.php');\n</code></pre...
2009/01/22
[ "https://Stackoverflow.com/questions/471014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3819/" ]
How would I do this in PHP? ``` Server.Transfer("/index.aspx") ``` (add ';' for C#) **EDIT:** It is important to have the URL remain the same as before; you know, for Google. In my situation, we have a bunch of .html files that we want to transfer and it is important to the client that the address bar doesn't chan...
As far as I know PHP doesn't have a real transfer ability, but you could get the exact same effect by using include() or require() like so: ``` require_once('/index.aspx"); ```
471,021
<p>I'm storing a varchar in a utf8 MySQL table and using utf8_general_ci collation. I have a unique index on the varchar. I'd like to do a string comparison in PHP that is equivalent to what MySQL will do on the index. </p> <p>A specific example is that I'd like to be able to detect that 'a' is considered equivalent...
[ { "answer_id": 471041, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 1, "selected": false, "text": "<p>Would it be reasonable just to let MySQL do the work, by submitting a query to MySQL like:</p>\n\n<pre><code>SELECT CASE...
2009/01/22
[ "https://Stackoverflow.com/questions/471021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23524/" ]
I'm storing a varchar in a utf8 MySQL table and using utf8\_general\_ci collation. I have a unique index on the varchar. I'd like to do a string comparison in PHP that is equivalent to what MySQL will do on the index. A specific example is that I'd like to be able to detect that 'a' is considered equivalent to 'À' in...
The collation has nothing to do with the storage. You need to set the charset to determine the storage encoding. The collation governs how comparison and sorting should happen. The collation must be charset aware, but otherwise it has nothing to do with the charset. To answer your question, you can use `iconv` to tran...
471,026
<p>I know that I can have something run every five minutes in cron with a line like:</p> <pre><code> */5 * * * * /my/script </code></pre> <p>What if I don't want it running at 12:00, 12:05, 12:10, but rather at 12:01, 12:06, 12:11, etc? I guess I can do this:</p> <pre><code> 1,6,11,16,21,26,31,36,41,46,51,56 * * * *...
[ { "answer_id": 471051, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 4, "selected": false, "text": "<p>Use your first schedule:</p>\n\n<pre><code>*/5 * * * * /my/script\n</code></pre>\n\n<p>And add this to the start of...
2009/01/22
[ "https://Stackoverflow.com/questions/471026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91385/" ]
I know that I can have something run every five minutes in cron with a line like: ``` */5 * * * * /my/script ``` What if I don't want it running at 12:00, 12:05, 12:10, but rather at 12:01, 12:06, 12:11, etc? I guess I can do this: ``` 1,6,11,16,21,26,31,36,41,46,51,56 * * * * /my/script ``` ...but that's ugly....
``` 1-56/5 * * * * /my/script ``` This should work on vixiecron, I'm not sure about other implementations.
471,029
<p>This is actually a machine learning classification problem but I imagine there's a perfectly good quick-and-dirty way to do it. I want to map a string describing an NFL team, like "San Francisco" or "49ers" or "San Francisco 49ers" or "SF forty-niners", to a canonical name for the team. (There are 32 NFL teams so ...
[ { "answer_id": 471071, "author": "willoller", "author_id": 33822, "author_profile": "https://Stackoverflow.com/users/33822", "pm_score": 0, "selected": false, "text": "<p>If you know both the source and destination names, then you just need to map them. \nIn php, you would just use an ar...
2009/01/22
[ "https://Stackoverflow.com/questions/471029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
This is actually a machine learning classification problem but I imagine there's a perfectly good quick-and-dirty way to do it. I want to map a string describing an NFL team, like "San Francisco" or "49ers" or "San Francisco 49ers" or "SF forty-niners", to a canonical name for the team. (There are 32 NFL teams so it re...
Here's something plenty robust even for arbitrary user input, I think. First, map each team (I'm using a 3-letter code as the canonical name for each team) to a fully spelled out version with city and team name as well as any nicknames in parentheses between city and team name. ``` Scan[(fullname[First@#] = #[[2]])&, ...
471,039
<p>I am using C#.</p> <p>I am trying to pull in a text file to an object. I am using an ODBC connection and it looks like this</p> <p>Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=C:\Users\Owner\Desktop\IR\IR_Files\Absolute;Extensions=asc,csv,tab,txt;</p> <p>I am able to make the connection but I can't get my co...
[ { "answer_id": 471057, "author": "Kevin Tighe", "author_id": 39461, "author_profile": "https://Stackoverflow.com/users/39461", "pm_score": 0, "selected": false, "text": "<p>Is there a reason you need to use an ODBC connection for this? I would think it'd be easier to just open the text ...
2009/01/22
[ "https://Stackoverflow.com/questions/471039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45429/" ]
I am using C#. I am trying to pull in a text file to an object. I am using an ODBC connection and it looks like this Driver={Microsoft Text Driver (\*.txt; \*.csv)};Dbq=C:\Users\Owner\Desktop\IR\IR\_Files\Absolute;Extensions=asc,csv,tab,txt; I am able to make the connection but I can't get my columns separated. I'm ...
I use the following connection string ``` string connectionString = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"text;HDR=YES;Format=Delimited(|)\";", Path.GetDirectoryName(path)); ``` and a Schema.ini file that typically begins ``` [myFile.txt] Format=Delimited(|) TextDelim...
471,042
<p>I have a .NET 3.5 class library I built that reads an App.config file for values it needs. It can pull the config values just fine when I test it in Visual Studio. To test it, I just change the project to a console application and execute a method call.</p> <p>I have the need to call this class library from many ...
[ { "answer_id": 471062, "author": "Glennular", "author_id": 14753, "author_profile": "https://Stackoverflow.com/users/14753", "pm_score": 0, "selected": false, "text": "<p>I believe app.config will always be used by the executable. Just drop it in that directory.</p>\n\n<p>They would do ...
2009/01/22
[ "https://Stackoverflow.com/questions/471042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8426/" ]
I have a .NET 3.5 class library I built that reads an App.config file for values it needs. It can pull the config values just fine when I test it in Visual Studio. To test it, I just change the project to a console application and execute a method call. I have the need to call this class library from many other .NET p...
An app domain in C# can have only one assembly level app.config file. [See here on MSDN](http://msdn.microsoft.com/en-us/library/system.appdomainsetup.configurationfile.aspx). An executable will always start up an AppDomain and by default look for a config file with name: EXECUTABLE\_NAME.config. For example, SampleApp...
471,056
<p>Recently, the SourceSafe integration into visual studio has started to perform badly because we have moved, and the SourceSafe "server" is located across a VPN which goes across a slow connection. This has made loading large projects in visual c++ 6 take 5+ minutes because it has to talk to the "server" for each pro...
[ { "answer_id": 471102, "author": "peterchen", "author_id": 31317, "author_profile": "https://Stackoverflow.com/users/31317", "pm_score": 2, "selected": false, "text": "<p>Open the .dsp and .dsw file in a text editor, and remove the respective entries from the .dsp and the .dsw file. Also...
2009/01/22
[ "https://Stackoverflow.com/questions/471056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28776/" ]
Recently, the SourceSafe integration into visual studio has started to perform badly because we have moved, and the SourceSafe "server" is located across a VPN which goes across a slow connection. This has made loading large projects in visual c++ 6 take 5+ minutes because it has to talk to the "server" for each projec...
From <http://support.microsoft.com/kb/236399>: > > Source code control software, such as > Microsoft Visual SourceSafe, that > integrates with the Visual C++ > integrated development environment > (IDE) can be configured to connect to > a source code server during Visual C++ > startup. In such cases, a loss in ...
471,103
<p>I am trying to take several RSS feeds, and put the content of them into a MySQL Database using PHP. After I store this content, I will display on my own page, and also combine the content into one single RSS Feed. (Probably after filtering)</p> <p>I haven't dealt with RSS Feeds before, so I am wondering the best Fr...
[ { "answer_id": 471113, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": true, "text": "<p><a href=\"http://magpierss.sourceforge.net/\" rel=\"noreferrer\">Magpie</a> is a reasonable RSS parser for PHP. Easy to...
2009/01/22
[ "https://Stackoverflow.com/questions/471103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58088/" ]
I am trying to take several RSS feeds, and put the content of them into a MySQL Database using PHP. After I store this content, I will display on my own page, and also combine the content into one single RSS Feed. (Probably after filtering) I haven't dealt with RSS Feeds before, so I am wondering the best Framework/Me...
[Magpie](http://magpierss.sourceforge.net/) is a reasonable RSS parser for PHP. Easy to use: ``` require('rss_fetch.inc'); $rss = fetch_rss($url); ``` An item like this for example: ``` <item rdf:about="http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257"> <title>Weekly Peace Vigil</title> <link>http:/...
471,106
<p>How can I get a list of the indices on a table in my sybase database using Perl? The goal is to "copy" all the indices from a table to a nearly identical table. </p> <p>Is <code>$dbh-&gt;selectarray_ref('sp_helpindex $table')</code> the best I can do?</p>
[ { "answer_id": 471133, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 0, "selected": false, "text": "<pre><code>SELECT i.*\nFROM sysobjects o, sysindexes i\nWHERE o.name = $name\n AND i.id = o.id\n</code></pre>\n" }, ...
2009/01/22
[ "https://Stackoverflow.com/questions/471106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58089/" ]
How can I get a list of the indices on a table in my sybase database using Perl? The goal is to "copy" all the indices from a table to a nearly identical table. Is `$dbh->selectarray_ref('sp_helpindex $table')` the best I can do?
There's a statistics\_info() method in DBI, but unfortunately, the only DBD I've seen it implemented in so far is DBD::ODBC . So if you use ODBC (update: or PostgreSQL!) you're in luck. Otherwise sp\_helpindex (or the sysindexes table) is about as good as it gets for Sybase. Here's what I've used for Sybase (in my own...
471,115
<p>Anyone know how can I post a SOAP Request from PHP?</p>
[ { "answer_id": 471129, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 2, "selected": false, "text": "<p>You might want to look <a href=\"http://developer.apple.com/internet/webservices/soapphp.html\" rel=\"nofollow nor...
2009/01/22
[ "https://Stackoverflow.com/questions/471115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52745/" ]
Anyone know how can I post a SOAP Request from PHP?
In my experience, it's not quite that simple. The built-in [PHP SOAP client](http://www.php.net/manual/en/book.soap.php) didn't work with the .NET-based SOAP server we had to use. It complained about an invalid schema definition. Even though .NET client worked with that server just fine. By the way, let me claim that S...
471,123
<p>Using Delphi, how do I access the equivalent of .NET's System.Environment.SpecialFolder.LocalApplicationData variable (which works on any version of Windows)? I assumed I could just do:</p> <pre><code>dir := GetEnvironmentVariable('LOCALAPPDATA'); </code></pre> <p>This works on Vista but XP doesn't seem to set th...
[ { "answer_id": 471158, "author": "mghie", "author_id": 30568, "author_profile": "https://Stackoverflow.com/users/30568", "pm_score": 1, "selected": false, "text": "<p>See <a href=\"http://delphi.about.com/cs/adptips2003/a/bltip0703_2.htm\" rel=\"nofollow noreferrer\">this article</a>.</p...
2009/01/22
[ "https://Stackoverflow.com/questions/471123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35229/" ]
Using Delphi, how do I access the equivalent of .NET's System.Environment.SpecialFolder.LocalApplicationData variable (which works on any version of Windows)? I assumed I could just do: ``` dir := GetEnvironmentVariable('LOCALAPPDATA'); ``` This works on Vista but XP doesn't seem to set that environment variable by ...
In Delphi, the special system folder path constants are defined in ShlObj.DCU, and are referenced in the form of CSIDL\_ followed by a symbolic name. Example: * CSIDL\_DESKTOPDIRECTORY returns the path to the current desktop * CSIDL\_PERSONAL is the *My Documents* directory * CSIDL\_\_\_LOCAL\_APPDATA is the *(user n...
471,125
<p>I've been trying to integrate the latest version of autofac (1.3.3.54), and I'm running into the following problem.</p> <p>The recommended way of consuming parameters in the Register callback, per the Google code wiki for the project is as follows:</p> <p>builder.Register((c, p) => new Foo(p.Get("arg1")));</p> <p...
[ { "answer_id": 977920, "author": "Mark Lindell", "author_id": 15978, "author_profile": "https://Stackoverflow.com/users/15978", "pm_score": 2, "selected": false, "text": "<p>It appears that the code has changed and the documentation on the Wiki has not been updated. The \"Get\" method i...
2009/01/22
[ "https://Stackoverflow.com/questions/471125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14128/" ]
I've been trying to integrate the latest version of autofac (1.3.3.54), and I'm running into the following problem. The recommended way of consuming parameters in the Register callback, per the Google code wiki for the project is as follows: builder.Register((c, p) => new Foo(p.Get("arg1"))); However this won't comp...
It appears that the code has changed and the documentation on the Wiki has not been updated. The "Get" method is now "Named" and the "Parameter" class is now "NamedParameter". See the following example: ``` var builder = new ContainerBuilder(); builder.Register((c, p) => new Person(p.Named<string>("name"))); using (v...
471,132
<p>How can I get users local decimal separator character from GWT. I have found the NumberFormat utility, which only returns the whole format and provides parsing.</p> <pre><code>NumberFormat.getDecimalFormat()... </code></pre> <p>Is there a (simple) way to get the decimal separator, thousand separator from the decim...
[ { "answer_id": 477315, "author": "Bill", "author_id": 51321, "author_profile": "https://Stackoverflow.com/users/51321", "pm_score": 3, "selected": true, "text": "<p>You can seed it with a known number and then parse it for the characters you want. </p>\n\n<pre><code>import com.google.gwt...
2009/01/22
[ "https://Stackoverflow.com/questions/471132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6482/" ]
How can I get users local decimal separator character from GWT. I have found the NumberFormat utility, which only returns the whole format and provides parsing. ``` NumberFormat.getDecimalFormat()... ``` Is there a (simple) way to get the decimal separator, thousand separator from the decimal format.
You can seed it with a known number and then parse it for the characters you want. ``` import com.google.gwt.i18n.client.NumberFormat; NumberFormat fmt = NumberFormat.getDecimalFormat(); double value = 1234.5; String formatted = fmt.format(value); String thousandSeparator = formatted.substring(1,2); String decimalSe...
471,144
<p>I've written C++ event-driven apps using MFC for GUI buttons, and I use HTML events like onmousedown to trigger some Javascript in a webpage. The idea of event-driven programming is intuitive when you are using the interface and events are hard-coded.</p> <p>I know how to use a function pointer in C, and I see how...
[ { "answer_id": 471177, "author": "Jason Punyon", "author_id": 6212, "author_profile": "https://Stackoverflow.com/users/6212", "pm_score": 0, "selected": false, "text": "<p>I don't know if I totally understand your question but a class with an event is just like an GUI with a button. Jus...
2009/01/22
[ "https://Stackoverflow.com/questions/471144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57625/" ]
I've written C++ event-driven apps using MFC for GUI buttons, and I use HTML events like onmousedown to trigger some Javascript in a webpage. The idea of event-driven programming is intuitive when you are using the interface and events are hard-coded. I know how to use a function pointer in C, and I see how Windows us...
When we talk about event-oriented programming, we're usually talking about one or more implementations of the [observer design pattern](http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=E6G&q=observer+design+pattern&btnG=Search). And one goal of the observer design pattern is to ...
471,154
<p>I have a software project which consists of multiple Project files and multiple Solution files. The Solution files have a one-to-many relationship with the Project files, and a given Project file may appear in multiple different solution files.</p> <p>Is there any good/spiffy way to come up with a map of the relati...
[ { "answer_id": 471195, "author": "shoosh", "author_id": 9611, "author_profile": "https://Stackoverflow.com/users/9611", "pm_score": 0, "selected": false, "text": "<p>A simple python (perl?) script with a couple of well places regular expressions.<br>\nEvery project has it's own GUID. fin...
2009/01/22
[ "https://Stackoverflow.com/questions/471154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
I have a software project which consists of multiple Project files and multiple Solution files. The Solution files have a one-to-many relationship with the Project files, and a given Project file may appear in multiple different solution files. Is there any good/spiffy way to come up with a map of the relationships be...
Both project files and solution files are text files. Project files don't know about their solution, so we'll have to look in the solutions for their projects. A project entry in the solution file looks like this: ``` Project("{9AC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProjectName", "ProjectDirectory\ProjectFileName...
471,174
<p>I want to put pictures at the top of my myspace page above the ad on my band profile. I can put one picture up just fine, but when I try to put pictures on top of one another they just overlap each other.</p> <p>I would like to do something like <a href="http://www.myspace.com/adaytoremember" rel="nofollow noreferr...
[ { "answer_id": 471218, "author": "gkrogers", "author_id": 54501, "author_profile": "https://Stackoverflow.com/users/54501", "pm_score": 1, "selected": false, "text": "<p>It's because you're using <code>position: absolute</code>, presumably for both, so they're trying to sit on top of eac...
2009/01/22
[ "https://Stackoverflow.com/questions/471174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to put pictures at the top of my myspace page above the ad on my band profile. I can put one picture up just fine, but when I try to put pictures on top of one another they just overlap each other. I would like to do something like [this](http://www.myspace.com/adaytoremember). Any tips for how I can fix this?...
The page you want to copy uses a table layout with images in each cell: Just to show the first rows: ``` <table width="1260" height="1414" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5" rowspan="2"> <img src="image01.jpg" width="481" height="107" alt=""> </td> <td colspan="6"> ...
471,183
<p>I'm trying to search and replace a string in all files matched by grep:</p> <p><code>grep -n 'foo' *</code> will give me output in the form:</p> <pre><code>[filename]:[line number]:[text] </code></pre> <p>For each file returned by grep, I'd like to modify the file by replacing <code>foo</code> with <code>bar</code>....
[ { "answer_id": 471192, "author": "armandino", "author_id": 45112, "author_profile": "https://Stackoverflow.com/users/45112", "pm_score": 7, "selected": true, "text": "<p>Do you mean search and replace a string in all files matched by grep?</p>\n\n<pre><code>perl -p -i -e 's/oldstring/new...
2009/01/22
[ "https://Stackoverflow.com/questions/471183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46821/" ]
I'm trying to search and replace a string in all files matched by grep: `grep -n 'foo' *` will give me output in the form: ``` [filename]:[line number]:[text] ``` For each file returned by grep, I'd like to modify the file by replacing `foo` with `bar`.
Do you mean search and replace a string in all files matched by grep? ``` perl -p -i -e 's/oldstring/newstring/g' `grep -ril searchpattern *` ``` **Edit** Since this seems to be a fairly popular question thought I'd update. Nowadays I mostly use `ack-grep` as it's more user-friendly. So the above command would be:...
471,190
<p>I have a Visual Studio 2008 solution with 7 various projects included with it. 3 of these 'projects' are Web Sites (the kind of project without a project file).</p> <p>I have stripped all the various Visual Sourcesafe files from all the directories, removed the Scc references in the SLN file and all the project fi...
[ { "answer_id": 471391, "author": "Glennular", "author_id": 14753, "author_profile": "https://Stackoverflow.com/users/14753", "pm_score": 1, "selected": false, "text": "<p>It probably is only trying to add it on your instance of VS. You have to remove the cache so VS thinks its no longer...
2009/01/22
[ "https://Stackoverflow.com/questions/471190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5862/" ]
I have a Visual Studio 2008 solution with 7 various projects included with it. 3 of these 'projects' are Web Sites (the kind of project without a project file). I have stripped all the various Visual Sourcesafe files from all the directories, removed the Scc references in the SLN file and all the project files that ex...
It probably is only trying to add it on your instance of VS. You have to remove the cache so VS thinks its no longer under SS 1. under file -> SourceControl -> Workspaces 2. Select the SS location 3. Edit 4. Choose the working folder 5. Remove!
471,198
<p>I cannot get my code to work :/</p>
[ { "answer_id": 471389, "author": "Gordon Wilson", "author_id": 23071, "author_profile": "https://Stackoverflow.com/users/23071", "pm_score": 2, "selected": true, "text": "<p>Here's a quick example from Microsoft.</p>\n\n<pre><code> static TCHAR hdrs[] =\n _T(\"Content-Type: applic...
2009/01/22
[ "https://Stackoverflow.com/questions/471198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31207/" ]
I cannot get my code to work :/
Here's a quick example from Microsoft. ``` static TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencoded"); static TCHAR frmdata[] = _T("name=John+Doe&userid=hithere&other=P%26Q"); static LPSTR accept[2]={"*/*", NULL}; // for clarity, error-checking has been removed HINTERNET hSe...
471,200
<p>I need to allow a user to click a link in "page-1.htm" and open a popup window. Then, when the user browses to "page-2.htm" in the main browser window I need to be able to reference the popup window.</p> <p><strong>JavaScript in "page-1.htm"</strong></p> <pre><code>var playerWin = window.open("player.htm", "playe...
[ { "answer_id": 471230, "author": "DavGarcia", "author_id": 40161, "author_profile": "https://Stackoverflow.com/users/40161", "pm_score": 0, "selected": false, "text": "<p>Haven't seen that before... I'm going to assume you are doing this because you have to and don't have the option to o...
2009/01/22
[ "https://Stackoverflow.com/questions/471200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5651/" ]
I need to allow a user to click a link in "page-1.htm" and open a popup window. Then, when the user browses to "page-2.htm" in the main browser window I need to be able to reference the popup window. **JavaScript in "page-1.htm"** ``` var playerWin = window.open("player.htm", "playerWin", "width=300,height=130"); pla...
I just did a quick test even after you leave the opener page, the popup still have 'opener' object and you can access it. So either poll the opener and reset the reference, or add a timer after you leave the page to wait and then relink. 1.htm ``` <script> var w = window.open("p.htm", "playerWin", "width=300,height=1...
471,211
<p>If I have a string such as</p> <p>"17:31:51 up 134 days, 11:26, 1 user, load average: 0.22, 0.15, 0.10"</p> <p>what is the best way to extract just the x3 load average values at the end? I have written a regexp that does this but is this the most efficient / fastest method?</p> <pre><code>&gt;&gt;&gt; s = "17:3...
[ { "answer_id": 471235, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 4, "selected": true, "text": "<p>This should work:</p>\n\n<pre><code># s is the string to parse\nloadavg = [float(x) for x in s.rsplit('load averag...
2009/01/22
[ "https://Stackoverflow.com/questions/471211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2183/" ]
If I have a string such as "17:31:51 up 134 days, 11:26, 1 user, load average: 0.22, 0.15, 0.10" what is the best way to extract just the x3 load average values at the end? I have written a regexp that does this but is this the most efficient / fastest method? ``` >>> s = "17:31:51 up 134 days, 11:26, 1 user, load...
This should work: ``` # s is the string to parse loadavg = [float(x) for x in s.rsplit('load average: ', 1)[1].split(', ')] ```
471,224
<p>I'm working through Ron Jeffries's Extreme Programming Adventures in C#. His main example is a simple XML text editor. Given the age of the book (published in 2004), I suspected that a lot of his initial coding, finding what line the cursor is on and where the insertion point is, can be replaced with new TextBox met...
[ { "answer_id": 471255, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>From reading the tests, it appears that GetLineFromCharIndex should return the number of the line corresponding to t...
2009/01/22
[ "https://Stackoverflow.com/questions/471224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16851/" ]
I'm working through Ron Jeffries's Extreme Programming Adventures in C#. His main example is a simple XML text editor. Given the age of the book (published in 2004), I suspected that a lot of his initial coding, finding what line the cursor is on and where the insertion point is, can be replaced with new TextBox method...
Ok, I haven't tested any of this, but I can make fairly educated guesses as to the reason for each of your results: 1. When executing normally (not stepping through), you would expect SelectionStart to remain 0, since the property value needs to be fetched via the Windows message pump, which hasn't yet had time to run...
471,228
<p>Hello I hope someone can explain this problem. This is the code:</p> <pre><code>class Memory{ public: PacketPtr pkt; MemoryPort* port; MemCtrlQueueEntry(){}; </code></pre> <p>};</p> <p>And after I do:</p> <pre><code>std::list&lt;Memory*&gt;::iterator lastIter = NULL; </code></pre> <p>And I get the fo...
[ { "answer_id": 471243, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 3, "selected": true, "text": "<p>Iterators are not pointers. If you want to initialize them to a non-value, use list::end(). The fact that <code>vector&l...
2009/01/22
[ "https://Stackoverflow.com/questions/471228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39160/" ]
Hello I hope someone can explain this problem. This is the code: ``` class Memory{ public: PacketPtr pkt; MemoryPort* port; MemCtrlQueueEntry(){}; ``` }; And after I do: ``` std::list<Memory*>::iterator lastIter = NULL; ``` And I get the following error: ``` error: conversion from long int to non-sc...
Iterators are not pointers. If you want to initialize them to a non-value, use list::end(). The fact that `vector<T>::iterator` is sometime implemented with a pointer is an implementation detail that you cannot depend on. If you want to assign NULL to the value at the location that the iterator is refering to, you hav...
471,241
<p>When I hover over a variable in visual studio, it brings up a small control which shows the variable name, type, and a + box for viewing members, etc. But for some types the variable type is replaced by more helpful information such as "{X = 0.0 Y = 0.0 Width = 0.0 Height = 0.0}" for a RectangleF.</p> <p>Is there a...
[ { "answer_id": 471249, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 2, "selected": false, "text": "<p>You're looking for <a href=\"http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerdisplayattribute.asp...
2009/01/22
[ "https://Stackoverflow.com/questions/471241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52239/" ]
When I hover over a variable in visual studio, it brings up a small control which shows the variable name, type, and a + box for viewing members, etc. But for some types the variable type is replaced by more helpful information such as "{X = 0.0 Y = 0.0 Width = 0.0 Height = 0.0}" for a RectangleF. Is there a way to sp...
The DebuggerDisplay attribute would be what you are looking for: ``` [DebuggerDisplay("x={xvar} Y={yvar} Width = {widthvar} Height = {heightvar}")] ``` More info can be found [here](http://msdn.microsoft.com/en-us/library/ms228992.aspx)
471,248
<p>I searched my Linux box and saw this typedef:</p> <pre><code>typedef __time_t time_t; </code></pre> <p>But I could not find the <code>__time_t</code> definition.</p>
[ { "answer_id": 471270, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 3, "selected": false, "text": "<p>Under Visual Studio 2008, it defaults to an <code>__int64</code> unless you define <code>_USE_32BIT_TIME_T</code>. You'r...
2009/01/22
[ "https://Stackoverflow.com/questions/471248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43756/" ]
I searched my Linux box and saw this typedef: ``` typedef __time_t time_t; ``` But I could not find the `__time_t` definition.
The [time\_t Wikipedia article](http://en.wikipedia.org/w/index.php?title=Time_t&oldid=450752800) article sheds some light on this. The bottom line is that the type of `time_t` is not guaranteed in the C specification. > > The `time_t` datatype is a data type in > the ISO C library defined for storing > system time...
471,257
<p>I have a mySQL database behind a Joomla install. I changed the database password because I forgot it but now Joomla crashes looking for the database. </p> <p>I guess joomla has the password written somewhere - if anyone knows I might be able to manual edit it and enter the new database password.</p> <p>Otherwise I...
[ { "answer_id": 471278, "author": "Fluff", "author_id": 52450, "author_profile": "https://Stackoverflow.com/users/52450", "pm_score": 3, "selected": false, "text": "<p>You probably want to look at your configuration.php and thease variables which sets your database connection:</p>\n\n<pre...
2009/01/22
[ "https://Stackoverflow.com/questions/471257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a mySQL database behind a Joomla install. I changed the database password because I forgot it but now Joomla crashes looking for the database. I guess joomla has the password written somewhere - if anyone knows I might be able to manual edit it and enter the new database password. Otherwise I'm hoping a manua...
You probably want to look at your configuration.php and thease variables which sets your database connection: ``` var $dbtype = 'mysql'; var $host = 'localhost'; var $user = 'your database username'; var $password = 'your database password'; var $db = 'database name'; var $dbprefix = 'jos_'; ``` The file should be i...
471,276
<p>I'm trying to get cc.net dashboard running on a build machine that also has apache on it.</p> <p>I've tried installing mod_aspdotnet as described <a href="http://weblogs.asp.net/israelio/archive/2005/09/11/424852.aspx" rel="nofollow noreferrer">here</a>. I can run the sample aspx page, but I am unable to get cc.ne...
[ { "answer_id": 538386, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>I thought I was the only one in the world trying to get such a setup working.</p>\n\n<p>I fixed this by adding the line: As...
2009/01/22
[ "https://Stackoverflow.com/questions/471276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
I'm trying to get cc.net dashboard running on a build machine that also has apache on it. I've tried installing mod\_aspdotnet as described [here](http://weblogs.asp.net/israelio/archive/2005/09/11/424852.aspx). I can run the sample aspx page, but I am unable to get cc.net to run. Is there some magic I need to do? Fo...
This is what I've done, inspired by Adam's answer: ``` AliasMatch /ccnet(.*\.aspx.*) "C:/Program Files/CruiseControl.NET/webdashboard/default.aspx" Alias /ccnet/ "C:/Program Files/CruiseControl.NET/webdashboard/ ``` Try match all the .aspx files to the webdashboard application, otherwise just pull stuff off the fil...
471,296
<p>I just got a question that I can't answer.</p> <p>Suppose you have this loop definition in Java:</p> <pre><code>while (i == i) ; </code></pre> <p>What is the type of <code>i</code> and the value of <code>i</code> if the loop is not an infinite loop and <strong>the program is using only one thread</strong>?</p>
[ { "answer_id": 471302, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 5, "selected": false, "text": "<p>The value of <code>i</code> is then Invalid. \"Not a Number\".</p>\n\n<p>After some googling, i found out that you...
2009/01/22
[ "https://Stackoverflow.com/questions/471296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/686/" ]
I just got a question that I can't answer. Suppose you have this loop definition in Java: ``` while (i == i) ; ``` What is the type of `i` and the value of `i` if the loop is not an infinite loop and **the program is using only one thread**?
``` double i = Double.NaN; ``` The API for [Double.equals()](http://java.sun.com/javase/6/docs/api/java/lang/Double.html#equals(java.lang.Object)) spells out the answer: "Double.NaN==Double.NaN has the value false". This is elaborated in the Java Language Specification under "[Floating-Point Types, Formats, and Value...
471,300
<p>I have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything was fine.</p> <p>Now, on a different machine, I try to clone my repository (git clone <em>repository</em>) and then switch to the experimental ...
[ { "answer_id": 471322, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 8, "selected": true, "text": "<pre class=\"lang-bash prettyprint-override\"><code># first time: make origin/branchname locally available as localnam...
2009/01/22
[ "https://Stackoverflow.com/questions/471300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3161/" ]
I have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything was fine. Now, on a different machine, I try to clone my repository (git clone *repository*) and then switch to the experimental branch (git checko...
```bash # first time: make origin/branchname locally available as localname git checkout -b localname origin/branchname # othertimes git checkout localname git push origin ``` For convenience, you may use the same string for localname & branchname When you checked out `origin/branchname` you weren't really ch...
471,341
<p>I run a small webserver, and lately it's been getting creamed by a search engine spider. What's the proper way to cool it down? Should I send it 5xx responses periodically? Is there a robots.txt setting I should be using? Or something else?</p>
[ { "answer_id": 471346, "author": "Simon B. Jensen", "author_id": 46128, "author_profile": "https://Stackoverflow.com/users/46128", "pm_score": 3, "selected": false, "text": "<p>Assuming that the spider is kind enough to respect robots.txt, you could restrict it from accessing your site w...
2009/01/22
[ "https://Stackoverflow.com/questions/471341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91385/" ]
I run a small webserver, and lately it's been getting creamed by a search engine spider. What's the proper way to cool it down? Should I send it 5xx responses periodically? Is there a robots.txt setting I should be using? Or something else?
Assuming that the spider is kind enough to respect robots.txt, you could restrict it from accessing your site with the following: ``` User-agent: * Disallow: / ``` This will affect all spiders. Narrow it down by specifying the correct user-agent for the spider. If the crawler doesn't respect your robots.txt, you mi...
471,342
<p>I am building a simple client/server application using java sockets and experimenting with the ObjectOutputStream etc.</p> <p>I have been following the tutorial at this url <a href="http://java.sun.com/developer/technicalArticles/ALT/sockets/" rel="nofollow noreferrer">http://java.sun.com/developer/technicalArticle...
[ { "answer_id": 471355, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 3, "selected": false, "text": "<p>You are not writing the object anywhere. </p>\n\n<p>See that link again, somewhere you have to write:</p>\n\n<pre><cod...
2009/01/22
[ "https://Stackoverflow.com/questions/471342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50913/" ]
I am building a simple client/server application using java sockets and experimenting with the ObjectOutputStream etc. I have been following the tutorial at this url [http://java.sun.com/developer/technicalArticles/ALT/sockets](http://java.sun.com/developer/technicalArticles/ALT/sockets/) starting half way down when i...
The problem is the order you are creating the streams: In the server from the article (which I assume is what you are using), when a new connection is opened, the server opens first an input stream, and then an output stream: ``` public Connect(Socket clientSocket) { client = clientSocket; try { ois = new ObjectI...
471,352
<p>I'm implementing a project in MVP pattern and I've got some interfaces like this:</p> <pre><code>public interface IWizardStep { event EventHandler NextStep; } public interface ISubmitable { event EventHandler Submit; } public interface IStep : ISubmitable, IWizardStep { string SomeProperty { get; set; } }...
[ { "answer_id": 471381, "author": "Ray Booysen", "author_id": 42124, "author_profile": "https://Stackoverflow.com/users/42124", "pm_score": 2, "selected": true, "text": "<p>This is because NextStep is an eventHandler. You cannot call an event handler which must be raised. I would expect...
2009/01/22
[ "https://Stackoverflow.com/questions/471352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11388/" ]
I'm implementing a project in MVP pattern and I've got some interfaces like this: ``` public interface IWizardStep { event EventHandler NextStep; } public interface ISubmitable { event EventHandler Submit; } public interface IStep : ISubmitable, IWizardStep { string SomeProperty { get; set; } } ``` My pres...
This is because NextStep is an eventHandler. You cannot call an event handler which must be raised. I would expect IStep to have a method call such as MoveToStep() which the concrete implementation would raise the event as expected which you could subscribe to somewhere else. What is your reasoning for the NextStep ev...
471,360
<p>Edit: Based on the answer from LoveMeSomeCode, I believe this issue only appears in VB.Net.</p> <p>I'm trying to revert a class to a previous state by saving the old values of changed properties in a dictionary and setting them via reflection when I need to revert. I'm having a problem where if the old value is Not...
[ { "answer_id": 471454, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 0, "selected": false, "text": "<p>In <code>SetValue</code>, <code>Convert.ChangeType</code> calls <code>IConvertible</code> methods on <code>pair.Value<...
2009/01/23
[ "https://Stackoverflow.com/questions/471360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21186/" ]
Edit: Based on the answer from LoveMeSomeCode, I believe this issue only appears in VB.Net. I'm trying to revert a class to a previous state by saving the old values of changed properties in a dictionary and setting them via reflection when I need to revert. I'm having a problem where if the old value is Nothing (null...
The fact that you are seeing this in the 2nd and 3rd option stack traces > > System.NullReferenceException: Object > reference not set to an instance of an > object. at > myProject.Presenter.CustomerDetailPresenter.set\_City(String > value) > > > makes me think that there is something in your CustomerDetailPr...
471,362
<p>Basically I have a mysql query something like the following:</p> <pre><code>mysql_query("SELECT n.title, v.value FROM posts n INNER JOIN votes v ON n.id = v.id"); </code></pre> <p>And what I need to do is to grab the title from the posts table and the current vote value from the votes table.</p> <p>At the moment,...
[ { "answer_id": 471366, "author": "benlumley", "author_id": 39161, "author_profile": "https://Stackoverflow.com/users/39161", "pm_score": 3, "selected": true, "text": "<p>Use a left join instead of an inner</p>\n\n<p>An inner join requires matching rows from the table on both sides of the...
2009/01/23
[ "https://Stackoverflow.com/questions/471362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52214/" ]
Basically I have a mysql query something like the following: ``` mysql_query("SELECT n.title, v.value FROM posts n INNER JOIN votes v ON n.id = v.id"); ``` And what I need to do is to grab the title from the posts table and the current vote value from the votes table. At the moment, votes aren't stored into the vot...
Use a left join instead of an inner An inner join requires matching rows from the table on both sides of the join. A left join (or left outer join to use its full name) selects all rows from the left table, and then matching rows from the right, returning null values if there are no matching rows in the right table, ...
471,364
<p>I have a collection class that I have decorated with a CollectionDataContract. The collection class also has a property on the class that I would like to be passed to the service client. I have tried adding [DataMember] to that property but it didn't add it to the class in the client when I updated.</p> <p>Any WC...
[ { "answer_id": 471521, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<p>You might want to consider implementing custom serialization for your class. It might be easiest to implement <a hre...
2009/01/23
[ "https://Stackoverflow.com/questions/471364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13100/" ]
I have a collection class that I have decorated with a CollectionDataContract. The collection class also has a property on the class that I would like to be passed to the service client. I have tried adding [DataMember] to that property but it didn't add it to the class in the client when I updated. Any WCF experts ou...
A working solution is posted on my blog: <http://borismod.blogspot.com/2009/04/wcf-collectiondatacontract-and.html> UPD: Thanks, for your comment, Jeff. Here is a summary here of a non generic class. A full generic solution can be found in a new post in my blog: [<http://borismod.blogspot.com/2009/06/v2-wcf-collect...
471,367
<p>I appreciate the semantic meaning of a NULL value in a database table, different from both false and the empty string ''. However, I have often read about performance problems when fields are nullable and been advised to use an empty string in cases where NULL is actually semantically correct. </p> <p>What circum...
[ { "answer_id": 471384, "author": "Jim Anderson", "author_id": 42439, "author_profile": "https://Stackoverflow.com/users/42439", "pm_score": 2, "selected": false, "text": "<p>Generally, if an attribute is required, it is defined as Not NULL and if it may be omitted it is defined as nullab...
2009/01/23
[ "https://Stackoverflow.com/questions/471367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25517/" ]
I appreciate the semantic meaning of a NULL value in a database table, different from both false and the empty string ''. However, I have often read about performance problems when fields are nullable and been advised to use an empty string in cases where NULL is actually semantically correct. What circumstances are ...
> > However, I have often read about > performance problems when fields are > nullable and been advised to use an > empty string in cases where NULL is > actually semantically correct. > > > I'm going to be nit-picky about word choice for a moment: * Even if it were a significant performance factor, that does...
471,396
<p>Ok, in Perl causing an object to reinitialize itself is easy since it is represented by an assignable reference or pointer. C#, however, doesn't appear to like this. </p> <p>I wanted to create a subclass of System.Text.RegularExpressions.Regex whose pattern could be changed without using new objects and consuming...
[ { "answer_id": 471401, "author": "Ray Booysen", "author_id": 42124, "author_profile": "https://Stackoverflow.com/users/42124", "pm_score": 0, "selected": false, "text": "<p>C# does not support such a syntax. In fact if you try compile your code, you'll get a compile error stating that: ...
2009/01/23
[ "https://Stackoverflow.com/questions/471396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56898/" ]
Ok, in Perl causing an object to reinitialize itself is easy since it is represented by an assignable reference or pointer. C#, however, doesn't appear to like this. I wanted to create a subclass of System.Text.RegularExpressions.Regex whose pattern could be changed without using new objects and consuming memory for ...
I'm not sure exactly what problem you're trying to solve. If you're concerned about the amount of memory being used, perhaps due to rapid creation/deletion of Regex objects, then you could have your wrapper implement IDisposable and wrap them in a `using` block so that the resources are freed more rapidly. If the numbe...
471,405
<p>When using the generic bootstrapper with MSBuild how is the order of installation of prerequisite items determined?</p> <p>For example, given:</p> <pre><code>&lt;Project ToolsVersion="3.5" xmlns='http://schemas.microsoft.com/developer/msbuild/2003'&gt; &lt;ItemGroup&gt; &lt;BootstrapperFile Include='A' /&gt;...
[ { "answer_id": 471439, "author": "fryguybob", "author_id": 4592, "author_profile": "https://Stackoverflow.com/users/4592", "pm_score": 4, "selected": true, "text": "<p>It looks like I can specify in the product manifest with the <code>DependsOnProduct</code> tag:</p>\n\n<pre><code>&lt;Pr...
2009/01/23
[ "https://Stackoverflow.com/questions/471405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4592/" ]
When using the generic bootstrapper with MSBuild how is the order of installation of prerequisite items determined? For example, given: ``` <Project ToolsVersion="3.5" xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> <ItemGroup> <BootstrapperFile Include='A' /> <BootstrapperFile Include='B' /> ...
It looks like I can specify in the product manifest with the `DependsOnProduct` tag: ``` <Product ProductCode="A"> <PackageFiles>...</PackageFiles> <RelatedProducts> <DependsOnProduct Code="B" /> </RelatedProducts> ... </Product> ``` This should result in `B` being installed before `A`. <http://msdn.mic...
471,408
<p>Here is the issue .... I have a PHP program reading and displaying the contents (4 text fields) of a MySQL database. These records are displayed sequentially down the page. What I hope to do is read a record and display the text, have a little timer to pause and then display the next record in the same location on t...
[ { "answer_id": 473622, "author": "Xanthir", "author_id": 58347, "author_profile": "https://Stackoverflow.com/users/58347", "pm_score": 0, "selected": false, "text": "<p>You want the display properties; specifically, display:none and display:block. Start with the first row having display...
2009/01/23
[ "https://Stackoverflow.com/questions/471408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Here is the issue .... I have a PHP program reading and displaying the contents (4 text fields) of a MySQL database. These records are displayed sequentially down the page. What I hope to do is read a record and display the text, have a little timer to pause and then display the next record in the same location on the ...
If your using a library like jQuery to do your JavaScript dirty work, then I would suggest something to the extent of. ``` <style type="text/css"> ul { margin:0; padding:0; list-style:none; width:300px; height:300px; overflow:hidden; border:#000 1px solid; ...
471,414
<p>I'm creating a custom column in a feature for Sharepoint. It is essentially this:</p> <pre><code>&lt;Field Type="Integer" ID="&lt;insert guid here&gt;" ReadOnly="true" Name="xxx" DisplayName="XXX" Group="YYY" /&gt; </code></pre> <p>When the field is deployed and attached to a content type, the cont...
[ { "answer_id": 478245, "author": "Nat", "author_id": 13813, "author_profile": "https://Stackoverflow.com/users/13813", "pm_score": 2, "selected": true, "text": "<p>I have tried out the same schema in a dev box using SharePoint designer to create it. I have issues seeing the column until ...
2009/01/23
[ "https://Stackoverflow.com/questions/471414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42124/" ]
I'm creating a custom column in a feature for Sharepoint. It is essentially this: ``` <Field Type="Integer" ID="<insert guid here>" ReadOnly="true" Name="xxx" DisplayName="XXX" Group="YYY" /> ``` When the field is deployed and attached to a content type, the content type shows no instance of this fiel...
I have tried out the same schema in a dev box using SharePoint designer to create it. I have issues seeing the column until I change the type from "Integer" to "Number" Not sure "Integer" is supported.
471,416
<p>I'm terrible at naming and realize that there are a better set of names for my models in my Rails app. <br>Is there any way to use a migration to rename a model and its corresponding table?</p>
[ { "answer_id": 471425, "author": "readonly", "author_id": 4883, "author_profile": "https://Stackoverflow.com/users/4883", "pm_score": 10, "selected": true, "text": "<p>Here's an example:</p>\n\n<pre><code>class RenameOldTableToNewTable &lt; ActiveRecord::Migration\n def self.up\n ren...
2009/01/23
[ "https://Stackoverflow.com/questions/471416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
I'm terrible at naming and realize that there are a better set of names for my models in my Rails app. Is there any way to use a migration to rename a model and its corresponding table?
Here's an example: ``` class RenameOldTableToNewTable < ActiveRecord::Migration def self.up rename_table :old_table_name, :new_table_name end def self.down rename_table :new_table_name, :old_table_name end end ``` I had to go and rename the model declaration file manually. **Edit:** In Rails 3.1 &...
471,422
<p>In C# I want to communicate to the calling method that the parameters passed to an object have caused its instantiation to fail.</p> <pre><code>// okay Banana banana1 = new Banana("green"); // fail Banana banana2 = new Banana("red"); </code></pre> <p>Throw an exception? If so how?</p>
[ { "answer_id": 471428, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 6, "selected": true, "text": "<pre><code>throw new ArgumentException(\"Reason\", \"param name\");\n</code></pre>\n" }, { "answer_id": 471...
2009/01/23
[ "https://Stackoverflow.com/questions/471422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609/" ]
In C# I want to communicate to the calling method that the parameters passed to an object have caused its instantiation to fail. ``` // okay Banana banana1 = new Banana("green"); // fail Banana banana2 = new Banana("red"); ``` Throw an exception? If so how?
``` throw new ArgumentException("Reason", "param name"); ```
471,424
<p>We've been using WiX for a while now, and despite the usual gripes about ease of use, it's going reasonably well. What I'm looking for is useful advice regarding:</p> <ul> <li>Setting up a WiX project (layout, references, file patterns)</li> <li>Integrating WiX into solutions, and build/release processes</li> <li>C...
[ { "answer_id": 473112, "author": "thijs", "author_id": 26796, "author_profile": "https://Stackoverflow.com/users/26796", "pm_score": 3, "selected": false, "text": "<ul>\n<li><p>We display the product version somewhere (tiny) in the first screen of the GUI. Because people tend to make mis...
2009/01/23
[ "https://Stackoverflow.com/questions/471424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44540/" ]
We've been using WiX for a while now, and despite the usual gripes about ease of use, it's going reasonably well. What I'm looking for is useful advice regarding: * Setting up a WiX project (layout, references, file patterns) * Integrating WiX into solutions, and build/release processes * Configuring installers for ne...
1. Keep variables in a separate `wxi` include file. Enables re-use, variables are faster to find and (if needed) allows for easier manipulation by an external tool. 2. Define Platform variables for x86 and x64 builds ``` <!-- Product name as you want it to appear in Add/Remove Programs--> <?if $(var.Platform) = x64 ?>...
471,435
<p>I have have the following data in excel:</p> <pre><code>a, b, c d e f, g h i </code></pre> <p>with each row, representing a row and in one cell.</p> <p>I would like to convert it to:</p> <pre><code>a b c d e f g h i </code></pre> <p>I am using the following macro, but I can't get the autosize to do an insert, i...
[ { "answer_id": 471449, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 1, "selected": false, "text": "<p>This is untested, but it's an algorithmic pattern I've used many times. It's been a while though, so don't trust the syn...
2009/01/23
[ "https://Stackoverflow.com/questions/471435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25020/" ]
I have have the following data in excel: ``` a, b, c d e f, g h i ``` with each row, representing a row and in one cell. I would like to convert it to: ``` a b c d e f g h i ``` I am using the following macro, but I can't get the autosize to do an insert, instead of overriding the cell values. Any help is apprec...
This macro will take your data from column A and "extract" it to column B. The results are shown below, feel free to cower at my graphical presentation skills :-) ``` <- A -> <- B -> 1 a, b, c a 2 d b 3 e c 4 f, g d 5 h e 6 i f 7 g 8 h 9 ...
471,438
<p>I am working on a platform with a gcc compiler however boost cannot compile on it.</p> <p>I am wondering what is the proper way to include the shared_ptr in std:tr1 on gcc? the file i looked in said not to include it directly, from what i can tell no other file includes it either :|</p>
[ { "answer_id": 485281, "author": "Max Lybbert", "author_id": 10593, "author_profile": "https://Stackoverflow.com/users/10593", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://www.boost.org/doc/libs/1_37_0/doc/html/boost_tr1/usage.html#boost_tr1.usage.include_style\" rel=\"...
2009/01/23
[ "https://Stackoverflow.com/questions/471438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am working on a platform with a gcc compiler however boost cannot compile on it. I am wondering what is the proper way to include the shared\_ptr in std:tr1 on gcc? the file i looked in said not to include it directly, from what i can tell no other file includes it either :|
In **G++ 4.3**, ``` #include <tr1/memory> ``` should do the trick. You'll find `shared_ptr` at `std::tr1::shared_ptr`.
471,445
<p>Currently I am loading Ruby classes into each class file using the require command, for example:</p> <pre><code>require File.join(File.dirname(__FILE__), 'observation_worker') require File.join(File.dirname(__FILE__), 'log_worker') </code></pre> <p>For each class I am defining the classes it requires. It would be ...
[ { "answer_id": 471519, "author": "Chris Farmiloe", "author_id": 54806, "author_profile": "https://Stackoverflow.com/users/54806", "pm_score": 2, "selected": false, "text": "<p>Not sure I fully understand, since you will always have to tell your program what files it needs, but you could ...
2009/01/23
[ "https://Stackoverflow.com/questions/471445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6009/" ]
Currently I am loading Ruby classes into each class file using the require command, for example: ``` require File.join(File.dirname(__FILE__), 'observation_worker') require File.join(File.dirname(__FILE__), 'log_worker') ``` For each class I am defining the classes it requires. It would be great if I could do this a...
If you have a somewhat clear directory structure of where your code goes you could add specific directory paths to the load path like ``` $LOAD_PATH.unshift( File.join( File.dirname(__FILE__), 'lib' ) ) ``` then in other parts of your code you could require from a relative path like so: ``` require 'observation_wor...
471,468
<p>I'm very new to OpenGL and I'm using managed OpenGLES wrapper written for Windows Mobile phones (<a href="http://www.koushikdutta.com/2008/08/net-compact-framework-wrapper-for.html" rel="nofollow noreferrer">OpenGLES Windows Mobile</a>). I have a simple task of drawing a square (got that) and texturing it with an im...
[ { "answer_id": 553510, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Try changing texture position coords from myImage.Width and myImage.Height to 1.0. Texture coords are from 0.0 to 1.0.</p>...
2009/01/23
[ "https://Stackoverflow.com/questions/471468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm very new to OpenGL and I'm using managed OpenGLES wrapper written for Windows Mobile phones ([OpenGLES Windows Mobile](http://www.koushikdutta.com/2008/08/net-compact-framework-wrapper-for.html)). I have a simple task of drawing a square (got that) and texturing it with an image from the disk, so I basically just w...
you have not enabled GL\_TEXTURE\_2D - add this line ``` gl.glEnable(gl.GL_TEXTURE_2D) ```
471,485
<p>Within the gridview I have, I'm trying to make it so when the user checks a check box for the row the row is highlighted. Now, this GridView is striped (meaning even rows have one background color and odd rows have another). This code to do it is floating around the net in various forms...</p> <pre><code> var col...
[ { "answer_id": 471490, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>I think you'd have better luck applying and removing a class that sets the background color when the checkbox is che...
2009/01/23
[ "https://Stackoverflow.com/questions/471485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49294/" ]
Within the gridview I have, I'm trying to make it so when the user checks a check box for the row the row is highlighted. Now, this GridView is striped (meaning even rows have one background color and odd rows have another). This code to do it is floating around the net in various forms... ``` var color = ''; functio...
I finally had some time to come back to this issue and I figured it out. For some reason this bit here... ``` $(object).parent('tr') ``` wasn't grabbing the row. I honestly didn't investigate much into why since this led me to the real issue. What was happening was the already set background color styling was not b...
471,489
<p><strong>I've been putting the path to the unit (.pas) file folders of our packages into the Delphi Library path but I'm beginning to wonder if this is a mistake!</strong> Take this problem for an example:</p> <p>I have two home grown packages:</p> <ul> <li>LowLevelPackage</li> <li>HighLevelPackage</li> </ul> <p>H...
[ { "answer_id": 471607, "author": "Cesar Romero", "author_id": 36875, "author_profile": "https://Stackoverflow.com/users/36875", "pm_score": 3, "selected": false, "text": "<pre><code>Library Path: *.dcu, *.inc, *.dfm\nPackage Output: *.bpl\nDcp Output: *.dcp\nBrowsing Path: *.pas\n</code>...
2009/01/23
[ "https://Stackoverflow.com/questions/471489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26335/" ]
**I've been putting the path to the unit (.pas) file folders of our packages into the Delphi Library path but I'm beginning to wonder if this is a mistake!** Take this problem for an example: I have two home grown packages: * LowLevelPackage * HighLevelPackage HighLevelPackage uses units contained in LowLevelPackage...
``` Library Path: *.dcu, *.inc, *.dfm Package Output: *.bpl Dcp Output: *.dcp Browsing Path: *.pas ```
471,502
<p>What is LINQ? I know it's for databases, but what does it do?</p>
[ { "answer_id": 471508, "author": "Jobo", "author_id": 51915, "author_profile": "https://Stackoverflow.com/users/51915", "pm_score": 0, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/netframework/aa904594.aspx\" rel=\"nofollow noreferrer\">http://msdn.microsoft.c...
2009/01/23
[ "https://Stackoverflow.com/questions/471502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56555/" ]
What is LINQ? I know it's for databases, but what does it do?
[LINQ](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/) stands for *Language Integrated Query*. Instead of writing YAQL (Yet Another Query Language), Microsoft language developers provided a way to express queries directly in their languages (such as C# and Visual Basic). The technique...
471,503
<p>I'm getting the folling linker errors when compiling with gcc:</p> <pre><code>undefined reference to `SetStretchBltMode@8' undefined reference to `StretchDIBits@52' undefined reference to `SetDIBitsToDevi </code></pre> <p>Are these functions defined in the windows libs?</p> <p>If so do they come installed with ...
[ { "answer_id": 471539, "author": "chickeninabiscuit", "author_id": 3966, "author_profile": "https://Stackoverflow.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Ok - worked this out:</p>\n\n<p>libgdi32.a comes with mingw.</p>\n\n<p>You need to add -lgdi32 to the g++ comma...
2009/01/23
[ "https://Stackoverflow.com/questions/471503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3966/" ]
I'm getting the folling linker errors when compiling with gcc: ``` undefined reference to `SetStretchBltMode@8' undefined reference to `StretchDIBits@52' undefined reference to `SetDIBitsToDevi ``` Are these functions defined in the windows libs? If so do they come installed with Vista, or do I need to install th...
I know you solved your problem long ago, but for reference, I think you should be able to run g++ with `-mwindows` and that'll link gdi32.dll and comdlg32.dll with your binary automatically. [This page](http://mingw-cross.sourceforge.net/hello_win32api.html) has a tutorial for Win32 on MinGW
471,510
<p>I have a tag in my html like this:</p> <pre><code>&lt;h1&gt;My Website Title Here&lt;/h1&gt; </code></pre> <p>Using css I want to replace the text with my actual logo. I've got the logo there no problem via resizing the tag and putting a background image in via css. However, I can't figure out how to get rid of th...
[ { "answer_id": 471523, "author": "Andrei Krotkov", "author_id": 54648, "author_profile": "https://Stackoverflow.com/users/54648", "pm_score": 3, "selected": false, "text": "<p>The answer is to create a span with the property </p>\n\n<p><code>{display:none;}</code></p>\n\n<p>You can find ...
2009/01/23
[ "https://Stackoverflow.com/questions/471510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17744/" ]
I have a tag in my html like this: ``` <h1>My Website Title Here</h1> ``` Using css I want to replace the text with my actual logo. I've got the logo there no problem via resizing the tag and putting a background image in via css. However, I can't figure out how to get rid of the text. I've seen it done before basic...
This is one way: ```css h1 { text-indent: -9999px; /* sends the text off-screen */ background-image: url(/the_img.png); /* shows image */ height: 100px; /* be sure to set height & width */ width: 600px; white-space: nowrap; /* because only the firs...
471,517
<p>When I try to call a stored procedure from Rails, I get this exception:</p> <pre><code>ActiveRecord::StatementInvalid: Mysql::Error: PROCEDURE pipeline-ws_development.match_save_all can't return a result set in the given context: call match_save_all() from /Users/otto/Projects/Futures/src/pipeline-ws/vendor/rai...
[ { "answer_id": 471913, "author": "kyle", "author_id": 2993381, "author_profile": "https://Stackoverflow.com/users/2993381", "pm_score": 2, "selected": true, "text": "<p>Would it work to wrap the procedure in a function? If Ruby's barfing due to no rows returned (<code>...can't return a r...
2009/01/23
[ "https://Stackoverflow.com/questions/471517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9594/" ]
When I try to call a stored procedure from Rails, I get this exception: ``` ActiveRecord::StatementInvalid: Mysql::Error: PROCEDURE pipeline-ws_development.match_save_all can't return a result set in the given context: call match_save_all() from /Users/otto/Projects/Futures/src/pipeline-ws/vendor/rails/activerecor...
Would it work to wrap the procedure in a function? If Ruby's barfing due to no rows returned (`...can't return a result set in the given context...`), this may fix it: ``` DELIMITER $ CREATE PROCEDURE tProc() BEGIN SET @a = 'test'; END; $ CREATE FUNCTION tFunc() RETURNS INT BEGIN CALL tProc(); RETURN 1;...
471,537
<p>I have written an application in C# and I have setup a separate Setup project to create the MSI installer for the app. I was wondering if it was possible to retrieve the version of the installer and display it in the About dialog in my application.</p>
[ { "answer_id": 471551, "author": "Sam Saffron", "author_id": 17174, "author_profile": "https://Stackoverflow.com/users/17174", "pm_score": 1, "selected": false, "text": "<p>In general you would look at the version of your current assembly for this kind of stuff, finding the MSI requires ...
2009/01/23
[ "https://Stackoverflow.com/questions/471537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44707/" ]
I have written an application in C# and I have setup a separate Setup project to create the MSI installer for the app. I was wondering if it was possible to retrieve the version of the installer and display it in the About dialog in my application.
In general you would look at the version of your current assembly for this kind of stuff, finding the MSI requires a registry search to find the MSI and then some interop to pull out the version using some COM interfaces. To get started along those lines have a look here: <http://www.codeproject.com/KB/cs/msiinterop....
471,548
<p>I have a menu with the following structure (simplified for illustration purposes):</p> <pre><code>Menu Bar |--File | |--Save | |--Exit |--Tools | |--Tool Category 1 | |--Tool Category 2 | |--Tool Category 3 |--Help |--About </code></pre> <p>I want to reconstruct this as follows:</p> <pre><c...
[ { "answer_id": 471563, "author": "Kredns", "author_id": 56555, "author_profile": "https://Stackoverflow.com/users/56555", "pm_score": 1, "selected": false, "text": "<p>Just redo the menu from scratch, sometimes it's best to just start over! :-)</p>\n" }, { "answer_id": 471576, ...
2009/01/23
[ "https://Stackoverflow.com/questions/471548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23249/" ]
I have a menu with the following structure (simplified for illustration purposes): ``` Menu Bar |--File | |--Save | |--Exit |--Tools | |--Tool Category 1 | |--Tool Category 2 | |--Tool Category 3 |--Help |--About ``` I want to reconstruct this as follows: ``` Menu Bar |--File | |--Save |...
I tried this and it worked: 1. Right click on the menu item you want to move 2. Select "Cut" in the context menu 3. Right click on the menu strip where you want to move it 4. Select "Paste" in the context menu Hope it helps.
471,550
<p>I want to modify a few tiny details of Django's built-in <code>django.contrib.auth</code> module. Specifically, I want a different form that makes username an email field (and email an alternate email address. (I'd rather not modify <code>auth</code> any more than necessary -- a simple form change <em>seems</em> ...
[ { "answer_id": 471661, "author": "Carl Meyer", "author_id": 3207, "author_profile": "https://Stackoverflow.com/users/3207", "pm_score": 7, "selected": true, "text": "<p>None of the above. Just use admin.site.unregister(). Here's how I recently added filtering Users on is_active in the ...
2009/01/23
[ "https://Stackoverflow.com/questions/471550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10661/" ]
I want to modify a few tiny details of Django's built-in `django.contrib.auth` module. Specifically, I want a different form that makes username an email field (and email an alternate email address. (I'd rather not modify `auth` any more than necessary -- a simple form change *seems* to be all that's needed.) When I u...
None of the above. Just use admin.site.unregister(). Here's how I recently added filtering Users on is\_active in the admin (**n.b.** is\_active filtering is now on the User model by default in Django core; still works here as an example), all DRY as can be: ``` from django.contrib import admin from django.contrib.aut...
471,569
<p>(this question was originally posted in another forum a few months ago, without getting any answer ... there was no SO at these times!) </p> <p>My first steps in RoR. I baught one of these books talking about Ruby, and Ruby On Rails. Examples are running correctly on MySQL, so I decided to rewrite them for MS-SQL ...
[ { "answer_id": 471661, "author": "Carl Meyer", "author_id": 3207, "author_profile": "https://Stackoverflow.com/users/3207", "pm_score": 7, "selected": true, "text": "<p>None of the above. Just use admin.site.unregister(). Here's how I recently added filtering Users on is_active in the ...
2009/01/23
[ "https://Stackoverflow.com/questions/471569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11436/" ]
(this question was originally posted in another forum a few months ago, without getting any answer ... there was no SO at these times!) My first steps in RoR. I baught one of these books talking about Ruby, and Ruby On Rails. Examples are running correctly on MySQL, so I decided to rewrite them for MS-SQL as a good e...
None of the above. Just use admin.site.unregister(). Here's how I recently added filtering Users on is\_active in the admin (**n.b.** is\_active filtering is now on the User model by default in Django core; still works here as an example), all DRY as can be: ``` from django.contrib import admin from django.contrib.aut...
471,581
<p>I'm trying to register a custom protocol to an application on the Mac, i.e:</p> <ol> <li>User clicks on link with "abcdef://some/url/here"</li> <li>An installed application is launched with the above string passed as the first param</li> </ol> <p>I've done this successfully on Windows using the information from th...
[ { "answer_id": 471626, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": "<p>Digging up the details is difficult, but there is a preference pane called <a href=\"http://www.rubicode.com/Sof...
2009/01/23
[ "https://Stackoverflow.com/questions/471581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41754/" ]
I'm trying to register a custom protocol to an application on the Mac, i.e: 1. User clicks on link with "abcdef://some/url/here" 2. An installed application is launched with the above string passed as the first param I've done this successfully on Windows using the information from this question: [how do I create my...
I've not had occasion to use it, but some time ago I bookmarked [**OS X URL handler to open links to local files**](http://hublog.hubmed.org/archives/001154.html) which is exactly what you're looking for. The important part of the linked procedure is adding an appropriate [`CFBundleURLTypes`](http://developer.apple.co...
471,586
<p>I have a user profile(more than one profile based on user type) which I'm storing in a DB column(xml).</p> <p>I can query on this using XPATH in my stored procedure, however I am unsure how to then perform an ORDER BY. </p> <pre><code>SELECT U.UserId, UP.Profile, UP.UserParentID FROM aspnet_Users U LEFT OUTER JOIN...
[ { "answer_id": 471626, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": "<p>Digging up the details is difficult, but there is a preference pane called <a href=\"http://www.rubicode.com/Sof...
2009/01/23
[ "https://Stackoverflow.com/questions/471586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25361/" ]
I have a user profile(more than one profile based on user type) which I'm storing in a DB column(xml). I can query on this using XPATH in my stored procedure, however I am unsure how to then perform an ORDER BY. ``` SELECT U.UserId, UP.Profile, UP.UserParentID FROM aspnet_Users U LEFT OUTER JOIN UserProperties UP ON...
I've not had occasion to use it, but some time ago I bookmarked [**OS X URL handler to open links to local files**](http://hublog.hubmed.org/archives/001154.html) which is exactly what you're looking for. The important part of the linked procedure is adding an appropriate [`CFBundleURLTypes`](http://developer.apple.co...
471,589
<p>I am using jQuery on my site and i have a update section on my project and I have three dropdowns:</p> <ul> <li>Completed?</li> <li>Hours Worked</li> <li>Who worked on this project?</li> </ul> <p>I am trying to create an ajax call using jQuery to when I select it, call a $.ajax() and send the data to my php page t...
[ { "answer_id": 471664, "author": "FryGuy", "author_id": 28776, "author_profile": "https://Stackoverflow.com/users/28776", "pm_score": 0, "selected": false, "text": "<p>I would use the <a href=\"http://docs.jquery.com/Ajax/jQuery.post\" rel=\"nofollow noreferrer\">jQuery post method</a>.....
2009/01/23
[ "https://Stackoverflow.com/questions/471589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using jQuery on my site and i have a update section on my project and I have three dropdowns: * Completed? * Hours Worked * Who worked on this project? I am trying to create an ajax call using jQuery to when I select it, call a $.ajax() and send the data to my php page to update my mysql database. I am guessing...
As FryGuy said the $.post method is probably your best bet although I'd lay it out like this: ``` $("#project select").change(function(){ // use one selector for all 3 selects $.post("someurl.php",{ // data to send completed: $("select#completed").val(), hours: $("select#hours").val(), ...
471,595
<p>I want to find a better way of populating a generic list from a checkedlistbox in c#. </p> <p>I can do the following easily enough:</p> <pre><code>List&lt;string&gt; selectedFields = new List&lt;string&gt;(); foreach (object a in chkDFMFieldList.CheckedItems) { selectedFields.Add(a.ToString()); ...
[ { "answer_id": 471613, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 7, "selected": true, "text": "<p><strong>Try this (using System.Linq):</strong></p>\n\n<p><code>OfType()</code> is an extension method, so you need to ...
2009/01/23
[ "https://Stackoverflow.com/questions/471595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56564/" ]
I want to find a better way of populating a generic list from a checkedlistbox in c#. I can do the following easily enough: ``` List<string> selectedFields = new List<string>(); foreach (object a in chkDFMFieldList.CheckedItems) { selectedFields.Add(a.ToString()); } ``` There must be a more ela...
**Try this (using System.Linq):** `OfType()` is an extension method, so you need to use `System.Linq` ``` List<string> selectedFields = new List<string>(); selectedFields.AddRange(chkDFMFieldList.CheckedItems.OfType<string>()); ``` Or just do it in one line: ``` List<string> selectedFields = chkDFMFieldList.Checke...
471,606
<p>My code looks like this:</p> <pre><code>&lt;ul id="ulList"&gt; &lt;li class="listClass" id="id1"&gt;&lt;a href="http://link1"&gt;Link 1&lt;/a&gt;&lt;/li&gt; &lt;li class="listClass" id="id2"&gt;&lt;a href="http://link2"&gt;Link 2&lt;/a&gt;&lt;/li&gt; &lt;li class="listClass" id="id3"&gt;&lt;a href="http://lin...
[ { "answer_id": 471645, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": false, "text": "<p>This should work.</p>\n\n<pre><code>var ids = [],\n hrefs = []\n; \n$('#ulList')\n .find('a[href]') // only target...
2009/01/23
[ "https://Stackoverflow.com/questions/471606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My code looks like this: ``` <ul id="ulList"> <li class="listClass" id="id1"><a href="http://link1">Link 1</a></li> <li class="listClass" id="id2"><a href="http://link2">Link 2</a></li> <li class="listClass" id="id3"><a href="http://link3">Link 3</a></li> </ul> ``` Now I like to get the following: All links a...
``` var ids = new Array(); var hrefs = new Array(); $('#ulList li').each(function(){ ids.push($(this).attr('id')); hrefs.push($(this).find('a').attr('href')); }) ```
471,629
<p>I'm creating a Ruby on Rails app that consists of stories. Each story has multiple pages.</p> <p>How can I set up routes.rb so that I can have URLs like this:</p> <pre><code>http://mysite.com/[story id]/[page id] </code></pre> <p>Like:</p> <pre><code>http://mysite.com/29/46 </code></pre> <p>Currently I'm using ...
[ { "answer_id": 471647, "author": "Terry G Lorber", "author_id": 809, "author_profile": "https://Stackoverflow.com/users/809", "pm_score": 4, "selected": true, "text": "<p><a href=\"http://keironwaites.com/2008/10/ruby-on-rails-routing-simple-examples.html\" rel=\"nofollow noreferrer\">He...
2009/01/23
[ "https://Stackoverflow.com/questions/471629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34795/" ]
I'm creating a Ruby on Rails app that consists of stories. Each story has multiple pages. How can I set up routes.rb so that I can have URLs like this: ``` http://mysite.com/[story id]/[page id] ``` Like: ``` http://mysite.com/29/46 ``` Currently I'm using this sort of setup: ``` http://mysite.com/stories/29/pa...
[Here's](http://keironwaites.com/2008/10/ruby-on-rails-routing-simple-examples.html) a good resource. ``` map.connect 'stories/:story_id/:page_num', :controller => "stories", :action => "index", :page_id => nil ``` In your controller: ``` def index story = Story.find(params[:story_id]) @page = story.pages[param...
471,638
<p>I'm trying to take a given URL entered by user and determine if the URL is pointing to a image or a video. </p> <p>Example use case:</p> <p>When a user paste in the URL of a YouTube video, on save the page will auto display the embedded YouTube player.</p> <p>When a user posts URL of a picture in Flickr, on save,...
[ { "answer_id": 471657, "author": "Sam", "author_id": 37575, "author_profile": "https://Stackoverflow.com/users/37575", "pm_score": 2, "selected": false, "text": "<p>Hit the link and inspect the content type header? If the result is a HTML page you could look for the largest image or embe...
2009/01/23
[ "https://Stackoverflow.com/questions/471638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42340/" ]
I'm trying to take a given URL entered by user and determine if the URL is pointing to a image or a video. Example use case: When a user paste in the URL of a YouTube video, on save the page will auto display the embedded YouTube player. When a user posts URL of a picture in Flickr, on save, the page will auto disp...
You can fetch the URL and see Content-type from the response. You can use the [HTTP Client](http://hc.apache.org/httpclient-3.x/) from apache, it helps you to fetch the content of the URL and you can use it to navigate the redirects. For instance try to fetch the following: <http://www.youtube.com/watch?v=d4LkTstvUL4...
471,643
<p>I was wondering if it were possible to write a file FileResult that worked something like this.</p> <pre><code>public ActionResult Generate(int id) { //Fill Model string ViewName = "template1"; return new FileResult(ViewName, @"c:\save"+ id +".txt"); } </code></pre> <p>where it would take the mode...
[ { "answer_id": 471666, "author": "Mike Robinson", "author_id": 43687, "author_profile": "https://Stackoverflow.com/users/43687", "pm_score": 1, "selected": false, "text": "<p>Have you considered exposing the elements you need as web services?</p>\n" }, { "answer_id": 471684, ...
2009/01/23
[ "https://Stackoverflow.com/questions/471643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29376/" ]
I was wondering if it were possible to write a file FileResult that worked something like this. ``` public ActionResult Generate(int id) { //Fill Model string ViewName = "template1"; return new FileResult(ViewName, @"c:\save"+ id +".txt"); } ``` where it would take the model, and combine it with the...
Easiest way to do this, would be, as Mike mentioned, to create a WebService on both of the websites that you currently have. Have it require authentication through WebService header (or use client certs to authenticate) and use SSL, then call both of the WebServices from your launch page with the name of the patient an...
471,662
<p>I'm writing a biorhythm app. To test it i have a form with a Button and a PictureBox. When I click on the button i do</p> <pre><code>myPictureBox.Image = GetBiorhythm2(); </code></pre> <p>Which runs ok for the first time, <strong>but on the second click</strong> it causes the following exception:</p> <pre><code>S...
[ { "answer_id": 471672, "author": "FryGuy", "author_id": 28776, "author_profile": "https://Stackoverflow.com/users/28776", "pm_score": 2, "selected": false, "text": "<p>I don't think you need to call .Dispose on static brushes, only if you create new ones. Although, personally, I would us...
2009/01/23
[ "https://Stackoverflow.com/questions/471662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58142/" ]
I'm writing a biorhythm app. To test it i have a form with a Button and a PictureBox. When I click on the button i do ``` myPictureBox.Image = GetBiorhythm2(); ``` Which runs ok for the first time, **but on the second click** it causes the following exception: ``` System.ArgumentException: Parameter is not valid. ...
It looks like you're trying to dispose of a static, which causes some problems next time it's used: ``` Brush brush = Brushes.Black; g.FillEllipse(brush, 3, 3, 2, 2); //Here the exception is thrown on the second call to the function brush.Dispose(); //If i comment this out, it works ok. ``` When you set...
471,663
<p>This might sound like a noob question, but are:</p> <pre><code>string var; if (var == null) </code></pre> <p>and</p> <pre><code>string var; if (var == string.Empty) </code></pre> <p>The same?</p> <blockquote> <h3><strong>Duplicate</strong></h3> <p><a href="https://stackoverflow.com/questions/151472/what-is-the-diffe...
[ { "answer_id": 471670, "author": "Jay Bazuzi", "author_id": 5314, "author_profile": "https://Stackoverflow.com/users/5314", "pm_score": 4, "selected": false, "text": "<p>No, they are not the same.</p>\n\n<p><code>string.Empty</code> is the same as <code>\"\"</code>, which is an actual ob...
2009/01/23
[ "https://Stackoverflow.com/questions/471663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
This might sound like a noob question, but are: ``` string var; if (var == null) ``` and ``` string var; if (var == string.Empty) ``` The same? > > ### **Duplicate** > > > [What's the Difference between String.Empty and Null?](https://stackoverflow.com/questions/151472/what-is-the-difference-between-string-em...
@Jay is correct, they are not the same. `String.IsNullOrEmpty()` is a convenient method to check for both null and "".
471,668
<p>I've been at this for a couple of days now, so any help would be much appreciated. I've got a link which contains two divs sitting on top of each other. The top div is hidden, but slides in to partially cover the bottom div on <code>mouseenter</code>, and then out again on <code>mouseleave</code>. It is working to a...
[ { "answer_id": 471694, "author": "Birk", "author_id": 56692, "author_profile": "https://Stackoverflow.com/users/56692", "pm_score": 2, "selected": false, "text": "<p>Try something like this.</p>\n\n<pre><code>$(document).ready(function(){\n $(\".toggle\").bind(\"mouseenter\",function(...
2009/01/23
[ "https://Stackoverflow.com/questions/471668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58136/" ]
I've been at this for a couple of days now, so any help would be much appreciated. I've got a link which contains two divs sitting on top of each other. The top div is hidden, but slides in to partially cover the bottom div on `mouseenter`, and then out again on `mouseleave`. It is working to a degree, but is a bit bug...
Try something like this. ``` $(document).ready(function(){ $(".toggle").bind("mouseenter",function(){ $("#slide").slideDown("slow"); $("#post-image").slideUP("slow"); }).bind("mouseleave",function(){ $("#slide").slideUP("slow"); $("#post-image").slideDown("slow");}); }); });...
471,681
<p>I'm having trouble forking a long-running process from some code running under mod_perl2. </p> <p>Everything works for the most part, but it seems that the forked process is holding open handles to Apache's logfiles - this means Apache won't restart while the process is running (I get a 'failed to open logfiles' me...
[ { "answer_id": 471690, "author": "nezroy", "author_id": 49968, "author_profile": "https://Stackoverflow.com/users/49968", "pm_score": 1, "selected": false, "text": "<p>Try closing your STDIN/STDOUT handles before the fork.</p>\n" }, { "answer_id": 471754, "author": "Paul Tomb...
2009/01/23
[ "https://Stackoverflow.com/questions/471681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17121/" ]
I'm having trouble forking a long-running process from some code running under mod\_perl2. Everything works for the most part, but it seems that the forked process is holding open handles to Apache's logfiles - this means Apache won't restart while the process is running (I get a 'failed to open logfiles' message). ...
You probably want to read [this](http://mail-archives.apache.org/mod_mbox/httpd-dev/200410.mbox/%3C4171BACA.3020405@gmx.de%3E) discussion. It seems you shouldn't fork on mod\_perl unless you know how to prepare things. You have to use a module such as [Apache2::SubProcess](http://search.cpan.org/perldoc?Apache2::SubPro...
471,693
<p>I am trying to workout a way to programatically create a key for <a href="http://en.wikipedia.org/wiki/Memcached" rel="nofollow noreferrer">Memcached</a>, based on the method name and parameters. So if I have a method,</p> <pre><code>string GetName(int param1, int param2); </code></pre> <p>it would return:</p> <p...
[ { "answer_id": 471735, "author": "Ash", "author_id": 11194, "author_profile": "https://Stackoverflow.com/users/11194", "pm_score": -1, "selected": false, "text": "<p>This is what I've come up with (however, it may not be particularly efficient):</p>\n\n<pre><code>MethodBase method = Meth...
2009/01/23
[ "https://Stackoverflow.com/questions/471693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
I am trying to workout a way to programatically create a key for [Memcached](http://en.wikipedia.org/wiki/Memcached), based on the method name and parameters. So if I have a method, ``` string GetName(int param1, int param2); ``` it would return: ``` string key = "GetName(1,2)"; ``` I know you can get the MethodB...
What you're looking for is an interceptor. Like the name says, an interceptor intercepts a method invocation and allows you to perform things before and after a method is called. This is quite popular in many caching and logging frameworks.
471,703
<p>I am a little confused by the following C code snippets:</p> <pre><code>printf("Peter string is %d bytes\n", sizeof("Peter")); // Peter string is 6 bytes </code></pre> <p>This tells me that when C compiles a string in double quotes, it will automatically add an extra byte for the null terminator.</p> <pre><code>p...
[ { "answer_id": 471710, "author": "Chris Lutz", "author_id": 58149, "author_profile": "https://Stackoverflow.com/users/58149", "pm_score": 6, "selected": true, "text": "<p>Your string is [2][9]. Those [9] are ['1', '2', etc... '8', '9']. Because you only gave it room for 9 chars in the fi...
2009/01/23
[ "https://Stackoverflow.com/questions/471703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28835/" ]
I am a little confused by the following C code snippets: ``` printf("Peter string is %d bytes\n", sizeof("Peter")); // Peter string is 6 bytes ``` This tells me that when C compiles a string in double quotes, it will automatically add an extra byte for the null terminator. ``` printf("Hello '%s'\n", "Peter"); ``` ...
Your string is [2][9]. Those [9] are ['1', '2', etc... '8', '9']. Because you only gave it room for 9 chars in the first array dimension, and because you used all 9, it has no room to place a '\0' character. redefine your char array: ``` char string[2][10] = {"123456789", "123456789"}; ``` And it should work.
471,727
<p>What is a free alternative to the built-in Eclipse XML editor? </p> <p>The one packaged with the IDE has two major problems with formatting:</p> <ol> <li>The formatter tries to parse escaped char's as though they were unescaped. E.g. '&amp;lt;' is treated like '&lt;' which causes the formatter to "stop".</li> <li>...
[ { "answer_id": 472205, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "<p>I do not see any of those problems when I format (<code>CTRL+SHIFT+F</code>) in an <a href=\"http://help.eclipse.org/ganymed...
2009/01/23
[ "https://Stackoverflow.com/questions/471727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27657/" ]
What is a free alternative to the built-in Eclipse XML editor? The one packaged with the IDE has two major problems with formatting: 1. The formatter tries to parse escaped char's as though they were unescaped. E.g. '&lt;' is treated like '<' which causes the formatter to "stop". 2. White space between elements is n...
This is way less than ideal, and I hope someone has a better solution, but it works: Build a simple App using dom4j: ``` public static void main( final String[] args ) throws Exception { String text = FileUtils.readFileToString( new File( args[ 0 ] ) ); OutputFormat format = OutputFormat.createPrettyPrint(); ...
471,732
<p>I'm writing a little bit of a wiki and going through all of my options for syntax highlighting. Debating between wiki syntax (mediawiki) and markdown + whitelisted tags. I think I would prefer the latter but I think my users will need tables. Why are tables disallowed here on Stackoverflow?</p> <pre><code>&lt;table...
[ { "answer_id": 471766, "author": "geowa4", "author_id": 50214, "author_profile": "https://Stackoverflow.com/users/50214", "pm_score": 3, "selected": true, "text": "<p>They serve no purpose in a Q&amp;A format. At least I cannot think of a reason I would need to use a table to answer som...
2009/01/23
[ "https://Stackoverflow.com/questions/471732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
I'm writing a little bit of a wiki and going through all of my options for syntax highlighting. Debating between wiki syntax (mediawiki) and markdown + whitelisted tags. I think I would prefer the latter but I think my users will need tables. Why are tables disallowed here on Stackoverflow? ``` <table> <tr> <td> </td>...
They serve no purpose in a Q&A format. At least I cannot think of a reason I would need to use a table to answer someone's question, or ask one myself. Plus, you can do this anyway: ``` cell 1-1 cell 1-2 cell 2-1 cell 2-2 ``` EDIT: So after reading comments on my reply, I see that there may be a few cases...
471,733
<p>When using WinDbg, where should the private symbol files (pdb?) be placed?</p> <p>My situation is: I have a DLL which I want to debug. I have the source code and symbol files for this DLL. This DLL is called by another DLL (which I don't have symbols or source for) which, in turn, is called by an EXE (which I also ...
[ { "answer_id": 471864, "author": "jussij", "author_id": 14738, "author_profile": "https://Stackoverflow.com/users/14738", "pm_score": 2, "selected": false, "text": "<p>One option is to leave the symbol files where they are (<em>i.e. in the build output folder</em>) and then use <strong>-...
2009/01/23
[ "https://Stackoverflow.com/questions/471733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29482/" ]
When using WinDbg, where should the private symbol files (pdb?) be placed? My situation is: I have a DLL which I want to debug. I have the source code and symbol files for this DLL. This DLL is called by another DLL (which I don't have symbols or source for) which, in turn, is called by an EXE (which I also don't have...
Sorry for the late reply. In your post you mention that you are seeing the following error message. ``` *** WARNING: Unable to verify checksum for C:\TheProgram\SomeSubfolder\AnotherSubfolder\MyDll.dll ``` You also ask the question, "where do I put my symbols for my DLL in the symbol path?" **Here is a response ...
471,797
<p>I'm using hibernate to store a set of objects from a web service. </p> <p>As the object are received each I am saving them using hibernate.</p> <p>Receiving the objects is wrapped in a transaction and all the objects appear in the database after the final object is received. </p> <p>I am now trying have each obje...
[ { "answer_id": 471924, "author": "Brian Deterling", "author_id": 14619, "author_profile": "https://Stackoverflow.com/users/14619", "pm_score": 0, "selected": false, "text": "<p>If you're still inside a transaction then only the session or connection that opened the transaction will be ab...
2009/01/23
[ "https://Stackoverflow.com/questions/471797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21387/" ]
I'm using hibernate to store a set of objects from a web service. As the object are received each I am saving them using hibernate. Receiving the objects is wrapped in a transaction and all the objects appear in the database after the final object is received. I am now trying have each object appear in the databas...
Thanks for the help Brian. The problems turned out to be a `for` loop in another class wrapping the save call. The solution was to remove the `for` loop and replace it with an `iterator`. Hibernate was keeping the same transaction for the entire `for` loop. Using the `iterator`, Hibernate seems to start a new transac...
471,799
<p>How do I get Spring to load Hibernate's properties from <code>hibernate.cfg.xml</code>?</p> <p>We're using Spring and JPA (with Hibernate as the implementation). Spring's <code>applicationContext.xml</code> specifies the JPA dialect and Hibernate properties:</p> <pre><code>&lt;bean id="entityManagerFactory" class=...
[ { "answer_id": 472018, "author": "bpapa", "author_id": 543, "author_profile": "https://Stackoverflow.com/users/543", "pm_score": 2, "selected": false, "text": "<p>The way I've done this before is by instantiating a <a href=\"http://static.springframework.org/spring/docs/2.0.x/api/org/spr...
2009/01/23
[ "https://Stackoverflow.com/questions/471799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
How do I get Spring to load Hibernate's properties from `hibernate.cfg.xml`? We're using Spring and JPA (with Hibernate as the implementation). Spring's `applicationContext.xml` specifies the JPA dialect and Hibernate properties: ``` <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManage...
Try something like this... ``` <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value> classpath:location_of_config_file/hibernate.cfg.xml </value> </property> <property name="hiberna...
471,800
<p>When typing in HTML forms, browsers like Firefox or Internet Explorer store the values, sometimes quietly. So when typing in another webforms, the browser smartly suggest the same information. Another method to show the dropdown list is double-clicking an empty textbox.</p> <p>On an E-commerce website, the customer ...
[ { "answer_id": 471808, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 4, "selected": false, "text": "<p>Try with the atribute <code>autocomplete=\"off\"</code></p>\n\n<p>It should work for single input elements:<...
2009/01/23
[ "https://Stackoverflow.com/questions/471800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48729/" ]
When typing in HTML forms, browsers like Firefox or Internet Explorer store the values, sometimes quietly. So when typing in another webforms, the browser smartly suggest the same information. Another method to show the dropdown list is double-clicking an empty textbox. On an E-commerce website, the customer types the...
Try with the atribute `autocomplete="off"` It should work for single input elements: ``` <input type="text" autocomplete="off" name="text1" /> ``` or to the entire form: ``` <form name="form1" id="form1" method="post" autocomplete="off" action="http://www.example.com/action"> [...] </form> ``` And specifically...
471,814
<p><strong>First Some Background (incase it helps):</strong></p> <p>My application is a Web-based framework recently upgraded to v3.5 of the .Net Framework but does not use a Master Pages / User Controls system. It's more akin to the MVC pattern (although much older) and outputs pure HTML down the response stream fro...
[ { "answer_id": 473167, "author": "babbageclunk", "author_id": 38851, "author_profile": "https://Stackoverflow.com/users/38851", "pm_score": 4, "selected": true, "text": "<p>Once the assembly's loaded, you can execute the import in the <code>Scope</code> you're using to run the script:</p...
2009/01/23
[ "https://Stackoverflow.com/questions/471814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58157/" ]
**First Some Background (incase it helps):** My application is a Web-based framework recently upgraded to v3.5 of the .Net Framework but does not use a Master Pages / User Controls system. It's more akin to the MVC pattern (although much older) and outputs pure HTML down the response stream from Templates. The Python ...
Once the assembly's loaded, you can execute the import in the `Scope` you're using to run the script: ``` ScriptEngine engine = Python.CreateEngine(); engine.Runtime.LoadAssembly(a); string code = "from MyAssembly import MyClass"; ScriptSource source = engine.CreateScriptSourceFromString(code, "<import>", SourceCodeKi...
471,820
<p>I need to set a single property in a jQuery command using a value that is calculated in the code-behind. My initial thought was to just use <code>&lt;%= %&gt;</code> to access it like this:</p> <p>.aspx</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; $('.sparklines').sparkline('html', { ...
[ { "answer_id": 471822, "author": "BobbyShaftoe", "author_id": 38426, "author_profile": "https://Stackoverflow.com/users/38426", "pm_score": 1, "selected": false, "text": "<p>Personally, I would use the &lt;% %> method. This is what the view is for. I don't like the RegisterClientScriptBl...
2009/01/23
[ "https://Stackoverflow.com/questions/471820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40161/" ]
I need to set a single property in a jQuery command using a value that is calculated in the code-behind. My initial thought was to just use `<%= %>` to access it like this: .aspx ``` <script type="text/javascript" language="javascript"> $('.sparklines').sparkline('html', { fillColor: 'transparent', normalRang...
The <% %> works fine. One thing that I do is set a value in a hidden field on the page (then writing the necessary javascript to extract that value), this is nice because I can change that hidden field via javascript and when/if the page posts back I can get that new value from code behind as well. If you need to call...
471,830
<p>I'd like to save an <code>NSMutableDictionary</code> object in <code>NSUserDefaults</code>. The key type in <code>NSMutableDictionary</code> is <code>NSString</code>, the value type is <code>NSArray</code>, which contains a list of object which implements <code>NSCoding</code>. Per document, <code>NSString</code> an...
[ { "answer_id": 471900, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 4, "selected": false, "text": "<p>Are all of your keys in the dictionary <code>NSString</code>s? I think they have to be in order to save the dicti...
2009/01/23
[ "https://Stackoverflow.com/questions/471830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32096/" ]
I'd like to save an `NSMutableDictionary` object in `NSUserDefaults`. The key type in `NSMutableDictionary` is `NSString`, the value type is `NSArray`, which contains a list of object which implements `NSCoding`. Per document, `NSString` and `NSArray` both are conform to `NSCoding`. I am getting this error: > > [NS...
I found out one alternative, before save, I encode the root object (`NSArray` object) using `NSKeyedArchiver`, which ends with `NSData`. Then use UserDefaults save the `NSData`. When I need the data, I read out the `NSData`, and use `NSKeyedUnarchiver` to convert `NSData` back to the object. It is a little cumberso...
471,832
<p>I have read many articles about how to use an INI file within my VB6 project. I don't have a problem with the methods, my problem is how to make the EXE file find the INI file. I don't want to hard code the path in the program. I simply want the EXE to expect the INI file to be present in the same folder the EXE is ...
[ { "answer_id": 471844, "author": "Hamish Smith", "author_id": 15572, "author_profile": "https://Stackoverflow.com/users/15572", "pm_score": 2, "selected": false, "text": "<p>In VB6 you can use the App.Path to specify the path to files that should be in the directory you are executing fro...
2009/01/23
[ "https://Stackoverflow.com/questions/471832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have read many articles about how to use an INI file within my VB6 project. I don't have a problem with the methods, my problem is how to make the EXE file find the INI file. I don't want to hard code the path in the program. I simply want the EXE to expect the INI file to be present in the same folder the EXE is exe...
In VB6 you can use the App.Path to specify the path to files that should be in the directory you are executing from. e.g. ``` sIniFile = App.Path & "\myIniFile.ini" ``` What is the error that you're getting?
471,840
<p>On my site I have mod_rewrite rules to make the URLs more search engine friendly, and it all works fine on the frontend, but I'm getting errors in the error log like this</p> <pre><code>[Thu Jan 22 22:51:36 2009] [error] [client {IP ADDRESS HERE}] File does not exist: /{some rewritten directory} </code></pre> <p>T...
[ { "answer_id": 471893, "author": "David Z", "author_id": 56541, "author_profile": "https://Stackoverflow.com/users/56541", "pm_score": 0, "selected": false, "text": "<p>I don't think those errors have anything to do with mod_rewrite, they're just saying that a file doesn't exist. Plain ...
2009/01/23
[ "https://Stackoverflow.com/questions/471840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23666/" ]
On my site I have mod\_rewrite rules to make the URLs more search engine friendly, and it all works fine on the frontend, but I'm getting errors in the error log like this ``` [Thu Jan 22 22:51:36 2009] [error] [client {IP ADDRESS HERE}] File does not exist: /{some rewritten directory} ``` The rules I'm using are ra...
[`MultiViews`](http://httpd.apache.org/docs/2.2/mod/core.html#options) could cause this. If it is enabled, Apache tries to find a file similar to the requested URI before passing the request along to mod\_rewrite. So try to disable it: ``` Options -MultiViews ```
471,859
<p>How do you edit items and subitems in a listview? Let's say I have a listview with 3 columns,and subitems,</p> <p><PRE> Car Brand | Car Name | Car Year Ford | Mustang | 2000 Dodge | Charger | 2007 </PRE></p> <p>How would I Add items like that to listview and how would I edit let's say the Car Name on wh...
[ { "answer_id": 1755588, "author": "CraigTP", "author_id": 57477, "author_profile": "https://Stackoverflow.com/users/57477", "pm_score": 5, "selected": false, "text": "<p>If you're looking for \"in-place\" editing of a <code>ListView</code>'s contents (specifically the subitems of a ListV...
2009/01/23
[ "https://Stackoverflow.com/questions/471859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do you edit items and subitems in a listview? Let's say I have a listview with 3 columns,and subitems, ``` Car Brand | Car Name | Car Year Ford | Mustang | 2000 Dodge | Charger | 2007 ``` How would I Add items like that to listview and how would I edit let's say the Car Name on which ever row by inde...
If you're looking for "in-place" editing of a `ListView`'s contents (specifically the subitems of a ListView in details view mode), you'll need to implement this yourself, or use a third-party control. By default, the best you can achieve with a "standard" `ListView` is to set it's `LabelEdit` property to true to allo...
471,882
<p>Can a class overload methods that also exist in the publicly inherited interface? It seems like this is unambiguous and useful, but compilers (VC, Intel, GCC) all complain, at least by my construction. Below is a toy example. The inherited rebound() function has two clear overloads, yet this will not compile. If yo...
[ { "answer_id": 471894, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 5, "selected": false, "text": "<p>You can do three things:</p>\n\n<h3>1. Unhide the base class method</h3>\n\n<p>Add a <code>using</code> in the <code...
2009/01/23
[ "https://Stackoverflow.com/questions/471882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Can a class overload methods that also exist in the publicly inherited interface? It seems like this is unambiguous and useful, but compilers (VC, Intel, GCC) all complain, at least by my construction. Below is a toy example. The inherited rebound() function has two clear overloads, yet this will not compile. If you **...
You can do three things: ### 1. Unhide the base class method Add a `using` in the `Node` declaration: ``` using Bound::rebound; void rebound() { rebound(left, right); } ``` ### 2. Explicitly refer to the base class method Use the Bound namespace: ``` void rebound() { Bound::rebound(left, right); } ``` ### 3. D...
471,896
<p>I have a a remote git repo and a local clone. Let's say I lose my local .git directory and subsequently add and remove some files to the local working directory.</p> <p>At some point, I want to re-init the local repo, connect it to the remote, and ultimately push my local working dir to the remote exactly as it is ...
[ { "answer_id": 471915, "author": "dylanfm", "author_id": 38795, "author_profile": "https://Stackoverflow.com/users/38795", "pm_score": 0, "selected": false, "text": "<p>Sorry if I have misunderstood you, but I think you just want to do the standard pull and push? <a href=\"http://gitread...
2009/01/23
[ "https://Stackoverflow.com/questions/471896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32866/" ]
I have a a remote git repo and a local clone. Let's say I lose my local .git directory and subsequently add and remove some files to the local working directory. At some point, I want to re-init the local repo, connect it to the remote, and ultimately push my local working dir to the remote exactly as it is (which is ...
Something like this (assuming you are starting from the lost .git moment)? ``` # Make the current directory a git repository. # This puts you on a master branch with no commits. git init # Add a reference to the remote repository. git remote add origin urlurlurl # Fetch the remote refs. git fetch # Without touching...
471,898
<p>I'm experiencing the same problem in <a href="https://stackoverflow.com/questions/101742/how-do-you-access-an-authenticated-google-app-engine-service-from-a-non-web-pyt">this previous stackoverflow.com post</a>. </p> <p>Specifically, I seem to be able to get the "Auth" token correctly, but attempts to use it in the...
[ { "answer_id": 474129, "author": "Nick Johnson", "author_id": 12030, "author_profile": "https://Stackoverflow.com/users/12030", "pm_score": 1, "selected": false, "text": "<p>Check out the code that does this in the official SDK. The latest SDK release even has it split into <a href=\"htt...
2009/01/23
[ "https://Stackoverflow.com/questions/471898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49611/" ]
I'm experiencing the same problem in [this previous stackoverflow.com post](https://stackoverflow.com/questions/101742/how-do-you-access-an-authenticated-google-app-engine-service-from-a-non-web-pyt). Specifically, I seem to be able to get the "Auth" token correctly, but attempts to use it in the header when I access...
Adding sample code to this question because someone contacted me directly about my solution. Note that you must set the "service" parameter equal to "ah" on the initial token request. Initial Request of Token [done synchronously] NOTE: the "service" parameter is set to "ah" and the "source" is just set to "myapp", yo...
471,914
<p>I have to create a report on some student completions. The students each belong to one client. Here are the tables (simplified for this question).</p> <pre><code>CREATE TABLE `clients` ( `clientId` int(10) unsigned NOT NULL auto_increment, `clientName` varchar(100) NOT NULL default '', `courseNames` varchar(...
[ { "answer_id": 471925, "author": "Kurt", "author_id": 31056, "author_profile": "https://Stackoverflow.com/users/31056", "pm_score": 2, "selected": false, "text": "<p>There's an easier way, have a link table, i.e.:</p>\n\n<p>Table 1: clients, client info, blah blah blah</p>\n\n<p>Table 2:...
2009/01/23
[ "https://Stackoverflow.com/questions/471914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
I have to create a report on some student completions. The students each belong to one client. Here are the tables (simplified for this question). ``` CREATE TABLE `clients` ( `clientId` int(10) unsigned NOT NULL auto_increment, `clientName` varchar(100) NOT NULL default '', `courseNames` varchar(255) NOT NULL ...
MySQL's only string-splitting function is [`SUBSTRING_INDEX(str, delim, count)`](https://dev.mysql.com/doc/refman/en/string-functions.html#function_substring-index). You can use this, to, for example: * Return the item before the first separator in a string: ``` mysql> SELECT SUBSTRING_INDEX('foo#bar#baz#qux', '#', 1...
471,928
<p>Is it possible to have Python save the <code>.pyc</code> files to a separate folder location that is in <code>sys.path</code>?</p> <pre><code>/code foo.py foo.pyc bar.py bar.pyc </code></pre> <p>To:</p> <pre><code>/code foo.py bar.py /code_compiled foo.pyc bar.pyc </code></pre> <p>I w...
[ { "answer_id": 471985, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 5, "selected": true, "text": "<p><strong>Update:</strong></p>\n\n<p>In Python 3.8 <code>-X pycache_prefix=PATH</code> command-line option enables writing <code...
2009/01/23
[ "https://Stackoverflow.com/questions/471928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49701/" ]
Is it possible to have Python save the `.pyc` files to a separate folder location that is in `sys.path`? ``` /code foo.py foo.pyc bar.py bar.pyc ``` To: ``` /code foo.py bar.py /code_compiled foo.pyc bar.pyc ``` I would like this because I feel it'd be more organized. Thanks for any he...
**Update:** In Python 3.8 `-X pycache_prefix=PATH` command-line option enables writing `.pyc` files to a parallel tree rooted at the given directory instead of to the code tree. See [`$PYTHONPYCACHEPREFIX` envvar](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX)credits: [@RobertT' answer](https...
471,935
<p>In MSVC I have this in a header:</p> <pre><code>#define STR(x) #x #define STR2(x) STR(x) #define NOTE(text) message (__FILE__ "(" STR2(__LINE__) ") : -NOTE- " #text) #define noteMacro(text) message (__FILE__ "(" STR2(__LINE__) ") : " STR2(text)) </code></pre> <p>and I do</p> <pre><code>#prag...
[ { "answer_id": 472089, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 3, "selected": false, "text": "<p>As you have now discovered, <code>#warning</code> is not a standard feature, so you cannot use it with compile...
2009/01/23
[ "https://Stackoverflow.com/questions/471935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In MSVC I have this in a header: ``` #define STR(x) #x #define STR2(x) STR(x) #define NOTE(text) message (__FILE__ "(" STR2(__LINE__) ") : -NOTE- " #text) #define noteMacro(text) message (__FILE__ "(" STR2(__LINE__) ") : " STR2(text)) ``` and I do ``` #pragma NOTE(my warning here) ``` GCC ha...
The best solution I've found for this problem is to have the following in a common header: ``` // compiler_warning.h #define STRINGISE_IMPL(x) #x #define STRINGISE(x) STRINGISE_IMPL(x) // Use: #pragma message WARN("My message") #if _MSC_VER # define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : " # define ...
471,946
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/191536/converting-xml-to-json-using-python">Converting XML to JSON using Python?</a> </p> </blockquote> <p>I'm doing some work on App Engine and I need to convert an XML document being retrieved from a remote s...
[ { "answer_id": 472064, "author": "Jeff Bauer", "author_id": 41759, "author_profile": "https://Stackoverflow.com/users/41759", "pm_score": 3, "selected": false, "text": "<p>Jacob Smullyan wrote a utility called <a href=\"https://bitbucket.org/smulloni/pesterfish\" rel=\"nofollow noreferre...
2009/01/23
[ "https://Stackoverflow.com/questions/471946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68788/" ]
> > **Possible Duplicate:** > > [Converting XML to JSON using Python?](https://stackoverflow.com/questions/191536/converting-xml-to-json-using-python) > > > I'm doing some work on App Engine and I need to convert an XML document being retrieved from a remote server into an equivalent JSON object. I'm using `x...
Soviut's advice for lxml objectify is good. With a specially subclassed simplejson, you can turn an lxml objectify result into json. ``` import simplejson as json import lxml class objectJSONEncoder(json.JSONEncoder): """A specialized JSON encoder that can handle simple lxml objectify types >>> from lxml impo...
471,952
<p>I met this when I read ZenTest source code:</p> <p>Here is the definition of add_mapping method:</p> <pre><code>def add_mapping(regexp, &amp;proc) @test_mappings &lt;&lt; [regexp, proc] end </code></pre> <p>In the <code>Autottest.initailize()</code>, <code>add_method</code> get called to add mapping for impleme...
[ { "answer_id": 471965, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 2, "selected": false, "text": "<p>Perhaps the author is using it as a short variable name so that the second parameter can be ignored.</p>\n" }, ...
2009/01/23
[ "https://Stackoverflow.com/questions/471952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44512/" ]
I met this when I read ZenTest source code: Here is the definition of add\_mapping method: ``` def add_mapping(regexp, &proc) @test_mappings << [regexp, proc] end ``` In the `Autottest.initailize()`, `add_method` get called to add mapping for implementations. ``` self.add_mapping(/^lib\/.*\.rb$/) do |filename, _...
It's an idiom used to indicate the the parameter bound to '\_' is not used, even though it's required to be passed to the block/method. example: ``` def blah yield 1,2 end blah {|a,b| puts a # b is never used } ``` compare to the identical: ``` blah {|a,_| puts a } ``` Note that '\_' is a perfectly le...
471,962
<p>From the man page for <a href="https://tronche.com/gui/x/xlib/graphics/filling-areas/XFillPolygon.html" rel="noreferrer"><code>XFillPolygon</code></a>:</p> <blockquote> <ul> <li><p>If <code>shape</code> is <strong>Complex</strong>, the path may self-intersect. Note that contiguous coincident points in the path...
[ { "answer_id": 472001, "author": "Loren Pechtel", "author_id": 10659, "author_profile": "https://Stackoverflow.com/users/10659", "pm_score": 4, "selected": false, "text": "<p>Here's a test to check if a polygon is <strong>convex</strong>.</p>\n<p>Consider each set of three points along t...
2009/01/23
[ "https://Stackoverflow.com/questions/471962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42303/" ]
From the man page for [`XFillPolygon`](https://tronche.com/gui/x/xlib/graphics/filling-areas/XFillPolygon.html): > > * If `shape` is **Complex**, the path may self-intersect. Note that contiguous coincident points in the path are not treated as self-intersection. > * If `shape` is **Convex**, for every pair of points...
You can make things a lot easier than the Gift-Wrapping Algorithm... that's a good answer when you have a set of points w/o any particular boundary and need to find the convex hull. In contrast, consider the case where the polygon is not self-intersecting, and it consists of a set of points in a list where the consec...
472,000
<p>What is the purpose of <a href="https://docs.python.org/3/reference/datamodel.html#slots" rel="noreferrer"><code>__slots__</code></a> in Python — especially with respect to when I would want to use it, and when not?</p>
[ { "answer_id": 472017, "author": "Ryan", "author_id": 8819, "author_profile": "https://Stackoverflow.com/users/8819", "pm_score": 7, "selected": false, "text": "<p>You would want to use <code>__slots__</code> if you are going to instantiate a lot (hundreds, thousands) of objects of the s...
2009/01/23
[ "https://Stackoverflow.com/questions/472000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31830/" ]
What is the purpose of [`__slots__`](https://docs.python.org/3/reference/datamodel.html#slots) in Python — especially with respect to when I would want to use it, and when not?
> > In Python, what is the purpose of `__slots__` and what are the cases one should avoid this? > =========================================================================================== > > > TLDR: ----- The special attribute [`__slots__`](https://docs.python.org/3/reference/datamodel.html#slots) allows you t...
472,013
<p>How do I generate 30 random numbers between 1-9, that all add up to 200 (or some arbitrary N), in C#?</p> <p>I'm trying to generate a string of digits that can add together to be N.</p>
[ { "answer_id": 472025, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 2, "selected": false, "text": "<p>This program will attempt to give you the answer. But because you are dealing with random numbers, there is the possi...
2009/01/23
[ "https://Stackoverflow.com/questions/472013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58179/" ]
How do I generate 30 random numbers between 1-9, that all add up to 200 (or some arbitrary N), in C#? I'm trying to generate a string of digits that can add together to be N.
I'm not sure what the statistics are on this but, the issue here is that you don't want to randomly select a number that makes it impossible to sum N with M number of entries either by overshooting or undershooting. Here's how I would do it: ``` static void Main() { int count = 30; int[] numbers = getNumbers(c...
472,015
<p>Is there a way to use the <code>new</code> keyword to allocate on the stack (ala <code>alloca</code>) instead of heap (<code>malloc</code>) ?</p> <p>I know I could hack up my own but I'd rather not.</p>
[ { "answer_id": 472028, "author": "Jeffrey Hantin", "author_id": 55637, "author_profile": "https://Stackoverflow.com/users/55637", "pm_score": 6, "selected": true, "text": "<p>To allocate on the stack, either declare your object as a local variable <em>by value</em>, or you can actually u...
2009/01/23
[ "https://Stackoverflow.com/questions/472015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there a way to use the `new` keyword to allocate on the stack (ala `alloca`) instead of heap (`malloc`) ? I know I could hack up my own but I'd rather not.
To allocate on the stack, either declare your object as a local variable *by value*, or you can actually use alloca to obtain a pointer and then use the in-place new operator: ``` void *p = alloca(sizeof(Whatever)); new (p) Whatever(constructorArguments); ``` However, while using alloca and in-place new ensures that...
472,020
<p>How do I change a rails app so that a controller foo appears as the application root? </p> <p>In other words, right now all the urls look like host.com/foo/... and I'd like to get rid of the foo and have simply host.com/... </p>
[ { "answer_id": 472032, "author": "Abie", "author_id": 53166, "author_profile": "https://Stackoverflow.com/users/53166", "pm_score": 4, "selected": true, "text": "<p>In routes.rb, add:</p>\n\n<pre><code>map.root :controller =&gt; 'foo'\n</code></pre>\n\n<p>Full details in the <a href=\"ht...
2009/01/23
[ "https://Stackoverflow.com/questions/472020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58164/" ]
How do I change a rails app so that a controller foo appears as the application root? In other words, right now all the urls look like host.com/foo/... and I'd like to get rid of the foo and have simply host.com/...
In routes.rb, add: ``` map.root :controller => 'foo' ``` Full details in the [API](http://api.rubyonrails.org/).
472,034
<p>How can a fixed character limit be imposed on a text field in Cocos2d?</p>
[ { "answer_id": 472207, "author": "Brad The App Guy", "author_id": 42323, "author_profile": "https://Stackoverflow.com/users/42323", "pm_score": 4, "selected": true, "text": "<p>To fix the maximum number of characters in a UITextField, you could do implement the UITextField Delegate Metho...
2009/01/23
[ "https://Stackoverflow.com/questions/472034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51108/" ]
How can a fixed character limit be imposed on a text field in Cocos2d?
To fix the maximum number of characters in a UITextField, you could do implement the UITextField Delegate Method `textField:shouldChangeCharactersInRange` to return false if the user tries to edit the string past the fixed length. ``` //Assume myTextField is a UITextField myTextField.delegate = self; //implement thi...
472,038
<p>I am considering running MSBuild from a Powershell script by tapping directly to the MSBuild assemblies (as opposed to looking up MSBuild install path and starting msbuild.exe as a child process).</p> <p>Has anyone done this? What would be the simplest, most straightforward way to run the build? Are there any pros/...
[ { "answer_id": 472050, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 2, "selected": false, "text": "<p>A different and potentially more usable approach would be to make an msbuild cmdlet. MsBuild has a nice API and there...
2009/01/23
[ "https://Stackoverflow.com/questions/472038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23843/" ]
I am considering running MSBuild from a Powershell script by tapping directly to the MSBuild assemblies (as opposed to looking up MSBuild install path and starting msbuild.exe as a child process). Has anyone done this? What would be the simplest, most straightforward way to run the build? Are there any pros/cons to ei...
The simplest embedded-build invocation that worked and produced output was: ``` [void][System.Reflection.Assembly]::Load('Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') $engine = New-Object Microsoft.Build.BuildEngine.Engine $engine.RegisterLogger((New-Object Microsoft.Buil...
472,039
<p>I have a very large Ruby on Rails application that I would like to port to PHP 5.2 or maybe PHP 5.3 (if 5.3 ever gets released).</p> <p>I've been looking for a some way of automatically converting the simple stuff like simple classes and the ERB templates. I would expect that I'd have to do the more complicated stu...
[ { "answer_id": 472315, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 3, "selected": false, "text": "<p>It's a non-trivial effort to port applications between any two languages. In this case, it's even worse, because of th...
2009/01/23
[ "https://Stackoverflow.com/questions/472039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31092/" ]
I have a very large Ruby on Rails application that I would like to port to PHP 5.2 or maybe PHP 5.3 (if 5.3 ever gets released). I've been looking for a some way of automatically converting the simple stuff like simple classes and the ERB templates. I would expect that I'd have to do the more complicated stuff myself ...
I completely agree with troelskn, this is a massive undertaking and I think that you'll have very little luck finding any form of automated process for porting the app. Your best bet is finding a framework that is very similar in design and porting all the classes one by one. The most tedious thing here will be whe...