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 |
|---|---|---|---|---|---|---|
492,139 | <p>I have a user control that has multiple update panels</p>
<p>
<br>
</p>
<p>On Page Load, I load a child user control dynamically onto the PlaceHolder (I do this everytime and don't check for postback)</p>
<p>I want to be able to maintain the state of the changes that ... | [
{
"answer_id": 492166,
"author": "Josema",
"author_id": 60215,
"author_profile": "https://Stackoverflow.com/users/60215",
"pm_score": 0,
"selected": false,
"text": "<p>You could use a ScriptManager with a form runat server in your control, instead update panels. </p>\n\n<p>This way you d... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58348/"
] | I have a user control that has multiple update panels
On Page Load, I load a child user control dynamically onto the PlaceHolder (I do this everytime and don't check for postback)
I want to be able to maintain the state of the changes that a user makes in the Child user control. (The child user control has html contr... | When dynamically adding controls you need to re-add them everytime your page loads. I've had to tackle similar difficulties and I do this in two ways. Where dynamic fields are added o the fly I will actually add a hidden control to the page before the user clicks to fill it in or add it themselves. By creating this sor... |
492,147 | <p>After following <a href="https://stackoverflow.com/questions/20856/how-do-you-recommend-implementing-tags-or-tagging/20871#20871">this</a> recommendation regarding tags tables structure, I've implemented the following design:</p>
<pre><code>Table: Item
Columns: ItemID, Title, Content
Table: Tag
Columns: TagID, Tit... | [
{
"answer_id": 492174,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 3,
"selected": true,
"text": "<blockquote>\n<pre><code>select count(*)\nfrom ItemTag\nwhere TagId = X\n</code></pre>\n</blockquote>\n\n<p>is mySQL that ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59361/"
] | After following [this](https://stackoverflow.com/questions/20856/how-do-you-recommend-implementing-tags-or-tagging/20871#20871) recommendation regarding tags tables structure, I've implemented the following design:
```
Table: Item
Columns: ItemID, Title, Content
Table: Tag
Columns: TagID, Title
Table: ItemTag
Column... | >
>
> ```
> select count(*)
> from ItemTag
> where TagId = X
>
> ```
>
>
is mySQL that will get it dynamically.
If you're worried about the performance hit, you should store a count in the tag table, and increment/decrement it when you tag or untag an item. |
492,158 | <p>I have an asp page containing a form with two fields where the client is supposed to write his/her information. </p>
<pre><code><td><%=Html.TextBox("Date")%></td>
<td><%=Html.TextBox("City")%></td>
</code></pre>
<p>My action's signature looks (at the moment) like this:</p>
<pre... | [
{
"answer_id": 492196,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 1,
"selected": false,
"text": "<p>Yes, a hidden input will work for that. It has to be on the same form, obviously.</p>\n\n<p>Use Html.Hidden.</p>\n"
... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an asp page containing a form with two fields where the client is supposed to write his/her information.
```
<td><%=Html.TextBox("Date")%></td>
<td><%=Html.TextBox("City")%></td>
```
My action's signature looks (at the moment) like this:
```
public ActionResult XXX(string Date, string City) {...}
```
The ... | There are two ways to do this. Either use the hidden field method (I wouldn't recommend this) or add it to the url (route value). The latter fits better with the REST-like urls that MVC prefers. So, if you are using an new form, then your url would look like:
```
http://example.com/course/newcoursedate/1
```
This wo... |
492,160 | <p>I have an .aspx page that generates thumbnails. It takes an ID and returns an image with response Content-Type: image/jpeg.</p>
<p>How do I display this image in Flex? </p>
| [
{
"answer_id": 492234,
"author": "ForYourOwnGood",
"author_id": 48728,
"author_profile": "https://Stackoverflow.com/users/48728",
"pm_score": 0,
"selected": false,
"text": "<p>Take a look a <a href=\"http://livedocs.adobe.com/flex/3/langref/\" rel=\"nofollow noreferrer\">Loader</a></p>\n... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an .aspx page that generates thumbnails. It takes an ID and returns an image with response Content-Type: image/jpeg.
How do I display this image in Flex? | I believe this should work:
```
<mx:Image source="http://localhost/webform.aspx?ID=1"/>
```
You can obviously set the source in ActionScript or make the URL a bindable string so that you can pass in the ID. |
492,177 | <p>So, I've got an ASP drop down list (this is .net 2.0). I'm binding it with data. Basically, when the page loads and it's not a post back we'll fetch record data, bind all the drop downs, and set them to their appropriate values (strictly speaking we: initialize page with basic set of data from DB, bind drop downs ... | [
{
"answer_id": 492388,
"author": "Sol",
"author_id": 27029,
"author_profile": "https://Stackoverflow.com/users/27029",
"pm_score": 0,
"selected": false,
"text": "<p>I've not used it personally, but it looks like <a href=\"http://search.cpan.org/~dongxu/Audio-TagLib-1.43/lib/Audio/TagLib.... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1734/"
] | So, I've got an ASP drop down list (this is .net 2.0). I'm binding it with data. Basically, when the page loads and it's not a post back we'll fetch record data, bind all the drop downs, and set them to their appropriate values (strictly speaking we: initialize page with basic set of data from DB, bind drop downs from ... | Do you mean id3 tags? The Jedi project has components to do that:
<http://sourceforge.net/project/showfiles.php?group_id=45786>
Look for JvID3v1 and JvID3v2. |
492,188 | <p>I am trying to get an FTP application up and running on Windows Server 2003, before this application was on windows XP professional running with no problem. I have tried googling around for answers, but the only "workaround" I can seem to find on Microsoft’s website didn’t correct the problem (being edit the regist... | [
{
"answer_id": 501097,
"author": "Jim Counts",
"author_id": 36737,
"author_profile": "https://Stackoverflow.com/users/36737",
"pm_score": 0,
"selected": false,
"text": "<p>Everything in Windows has an Access Control List (ACL). It sounds to me like the user running your application does... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55104/"
] | I am trying to get an FTP application up and running on Windows Server 2003, before this application was on windows XP professional running with no problem. I have tried googling around for answers, but the only "workaround" I can seem to find on Microsoft’s website didn’t correct the problem (being edit the registry a... | You might be having a problem because the call to BeginAccept is in an infinite loop. You should only be calling that once until the AsyncCallback is hit, then call EndAccept and BeginAccept again. So essentially you call BeginAccept once to start, and then again after every connection is established. |
492,198 | <p>I know that you cannot fully describe the XML that the TClientDataSet with an XSD schema, as the ROW elements have attributes that have names that vary with the contents.</p>
<p>However, the METADATA section of such an XML should be.</p>
<p>So: is there anyone having a (partial) XSD that describes the METADATA por... | [
{
"answer_id": 492367,
"author": "J__",
"author_id": 20315,
"author_profile": "https://Stackoverflow.com/users/20315",
"pm_score": 3,
"selected": false,
"text": "<p>Well I couldn't find one either, so I used <a href=\"http://www.hitsw.com/xml_utilites/\" rel=\"noreferrer\">this website</... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29290/"
] | I know that you cannot fully describe the XML that the TClientDataSet with an XSD schema, as the ROW elements have attributes that have names that vary with the contents.
However, the METADATA section of such an XML should be.
So: is there anyone having a (partial) XSD that describes the METADATA portion of the XML t... | **Edit:**
Split the XSD in two parts, and made it more complete by using these files in `Delphi XE`: `dsconst.h`, `dspickle.h`, `dsxml.h`.
Please PM or comment if you have additions.
The XSD files below seems to work reasonably so far; if you have TClientDataSet XML that does not validate with this, please email... |
492,204 | <p>Imagine the following table:</p>
<pre><code>-------------------------------------------------------------
ID | XML
-------------------------------------------------------------
1 | <Form><object ID="1" /></Form>
2 | <Form><object ID="2" /></Form>
3 | <... | [
{
"answer_id": 492257,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": 0,
"selected": false,
"text": "<p>You can try Contains in your select statement, but you'll need to ensure your table is full-text indexed.</p>\n\n<p>Nice f... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11356/"
] | Imagine the following table:
```
-------------------------------------------------------------
ID | XML
-------------------------------------------------------------
1 | <Form><object ID="1" /></Form>
2 | <Form><object ID="2" /></Form>
3 | <Form><object ID="2" /></Form>
----------------------... | I don't think there is a nice way to do this in SQL2000.
With SQL2005 you can use the xml data type to pull out the value.
My suggestion would be along the lines of
```
SELECT *
FROM TABLE t
WHERE CHARINDEX('ID="' + CAST(t.ID AS VARCHAR) + '"',t.XML) = 0
```
But it's nasty and slow. |
492,220 | <p>I'm trying to backup a database in SQL Server 2008 and have the database compressed using the new compression feature. However, when I run the following code, I get a weird error message:</p>
<pre><code>Backup Database <Database> To Disk 'C:\Backup' With Compression
</code></pre>
<p>I get this error message:... | [
{
"answer_id": 492268,
"author": "Scott Ivey",
"author_id": 36297,
"author_profile": "https://Stackoverflow.com/users/36297",
"pm_score": 5,
"selected": true,
"text": "<p>Backup Compression is not supported on SQL 2008 Express, Workgroup, or Standard editions, only on Enterprise. There ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] | I'm trying to backup a database in SQL Server 2008 and have the database compressed using the new compression feature. However, when I run the following code, I get a weird error message:
```
Backup Database <Database> To Disk 'C:\Backup' With Compression
```
I get this error message:
>
> Backup Database With Comp... | Backup Compression is not supported on SQL 2008 Express, Workgroup, or Standard editions, only on Enterprise. There is no way to turn this on without upgrading your version to Enterprise.
Although you can't backup with compression on those versions, you can RESTORE from compressed backups.
See <http://technet.microso... |
492,232 | <p>My dataset consists of three vectors (x,y and z). I plot these values as dots in a 3d-plot with plot3(x,y,z), which is fine. I also want to show a plane in the same plot. To get the data of this plot I use linear regression on x and y to get a new z. </p>
<p>This is how it looks:</p>
<p><a href="https://i.stack.im... | [
{
"answer_id": 492417,
"author": "gnovice",
"author_id": 52738,
"author_profile": "https://Stackoverflow.com/users/52738",
"pm_score": 6,
"selected": true,
"text": "<p>The easiest way to create a surface that has just 1 color and a given transparency value is to set the 'FaceColor' and '... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37257/"
] | My dataset consists of three vectors (x,y and z). I plot these values as dots in a 3d-plot with plot3(x,y,z), which is fine. I also want to show a plane in the same plot. To get the data of this plot I use linear regression on x and y to get a new z.
This is how it looks:
[;
set(hSurface,'FaceColor',[1 0 0],'FaceAlpha',0.5);
```
This example sets the sur... |
492,241 | <p>This question is complicated so examples would work best...I have the following table on ODBC, not SQL server Management</p>
<pre><code>NAME SEQNUM
JOHN 2
JOHN 4
JOHN 7
MARY 12
MIKE 4
MIKE 9
PETER 7
PETER 12
</code></pre>
<p>So, i want to pull back one name with th... | [
{
"answer_id": 492254,
"author": "Richard L",
"author_id": 51017,
"author_profile": "https://Stackoverflow.com/users/51017",
"pm_score": 2,
"selected": false,
"text": "<pre><code>SELECT TOP 1 Name, SeqNum FROM yourtable ORDER BY SeqNum DESC\n</code></pre>\n\n<p>Will display the one with ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54197/"
] | This question is complicated so examples would work best...I have the following table on ODBC, not SQL server Management
```
NAME SEQNUM
JOHN 2
JOHN 4
JOHN 7
MARY 12
MIKE 4
MIKE 9
PETER 7
PETER 12
```
So, i want to pull back one name with the lowest seqNum...
```
NA... | ```
SELECT t1.*
FROM yourtable t1
LEFT OUTER JOIN yourtable t2
ON (t1.name = t2.name AND t1.seqnum > t2.seqnum)
WHERE t2.seqnum IS NULL;
```
---
Re. Dems' comment:
If you simply use `GROUP BY name` then your select-list can only include `name` and the aggregate function `MIN()`. It's often the case that you real... |
492,262 | <p>The .NET Framework gives us the <a href="http://msdn.microsoft.com/en-us/library/b1csw23d.aspx" rel="noreferrer">Format</a> method:</p>
<pre><code>string s = string.Format("This {0} very {1}.", "is", "funny");
// s is now: "This is very funny."
</code></pre>
<p>I would like an "Unformat" function, something like:<... | [
{
"answer_id": 492275,
"author": "endian",
"author_id": 25462,
"author_profile": "https://Stackoverflow.com/users/25462",
"pm_score": 2,
"selected": false,
"text": "<p>You could do string[] parts = string.Split(' '), and then extract by the index position parts[1] and parts [3] in your e... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56/"
] | The .NET Framework gives us the [Format](http://msdn.microsoft.com/en-us/library/b1csw23d.aspx) method:
```
string s = string.Format("This {0} very {1}.", "is", "funny");
// s is now: "This is very funny."
```
I would like an "Unformat" function, something like:
```
object[] params = string.Unformat("This {0} very ... | There's no such method, probably because of problems resolving ambiguities:
```
string.Unformat("This {0} very {1}.", "This is very very funny.")
// are the parameters equal to "is" and "very funny", or "is very" and "funny"?
```
Regular expression [capturing](http://www.regular-expressions.info/brackets.html) [grou... |
492,280 | <p>I have a COM+ component developed with VB6.</p>
<p>After registering it with the component services manager COM+ application, I can use it from ASP like this</p>
<pre><code>Set Comando = Server.CreateObject("JuiciosComando.clsComando")
ComandoExecute = Comando.execute(Xml)
Set Comando = Nothing
</code></pre>
<p>T... | [
{
"answer_id": 492530,
"author": "Eddie",
"author_id": 57752,
"author_profile": "https://Stackoverflow.com/users/57752",
"pm_score": 2,
"selected": false,
"text": "<p>I've worked with an application that originally tried JNI to interact with native code to access COM, and it ended up bei... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47633/"
] | I have a COM+ component developed with VB6.
After registering it with the component services manager COM+ application, I can use it from ASP like this
```
Set Comando = Server.CreateObject("JuiciosComando.clsComando")
ComandoExecute = Comando.execute(Xml)
Set Comando = Nothing
```
That's all I need, the component j... | As Eddie mentioned, you have two main methods of using COM via java: using C++ and writing a JNI wrapper or using a third party JAR to wrap the COM object.
I've attempted to use C++ to wrap a COM object in the past - it's not for the faint hearted - it is not easy to do and its very easy to leak resources.
I've also ... |
492,339 | <p>There is a hard limit of the number of parameters any single SQL statement can have, and that is 2100 (for SQL Server 2005), or 1024 (for SQL Server 2000).</p>
<p>Does anyone know of a way to increase that number?</p>
<p>If you'd like to know "why" (as I would be dying of curiosity myself), the ansewr is in this:<... | [
{
"answer_id": 492347,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 3,
"selected": true,
"text": "<p>It's a hard limit - and I would seriously think about rethinking a real need to extend that, especially in light of th... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11917/"
] | There is a hard limit of the number of parameters any single SQL statement can have, and that is 2100 (for SQL Server 2005), or 1024 (for SQL Server 2000).
Does anyone know of a way to increase that number?
If you'd like to know "why" (as I would be dying of curiosity myself), the ansewr is in this:
```
MyL2SDataCon... | It's a hard limit - and I would seriously think about rethinking a real need to extend that, especially in light of the example code you give. |
492,346 | <p>I would like to increase the <code>httpRuntime</code> <code>executionTimeout</code> for a subsection of an ASP.NET MVC application.</p>
<p>In a regular Web App, you could use: </p>
<pre><code><configuration>
<location path="UploadPage.aspx">
<httpRuntime executionTimeout="600"/>
</loca... | [
{
"answer_id": 636609,
"author": "Chris Hynes",
"author_id": 8037,
"author_profile": "https://Stackoverflow.com/users/8037",
"pm_score": 7,
"selected": true,
"text": "<p>You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something lik... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46449/"
] | I would like to increase the `httpRuntime` `executionTimeout` for a subsection of an ASP.NET MVC application.
In a regular Web App, you could use:
```
<configuration>
<location path="UploadPage.aspx">
<httpRuntime executionTimeout="600"/>
</location>
</configuration>
```
However there really is not the ide... | You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something like this should work:
```
<location path="Images/Upload">
<system.web>
<httpRuntime executionTimeout="600" />
</system.web>
</location>
``` |
492,365 | <p>I have a frame with a textctrl. When the mouse enters the textctrl (EVT_ENTER_WINDOW) I show a PopupWindow on top of the textctrl, and when the mouse leaves the popup (EVT_LEAVE_WINDOW) I hide it again.</p>
<p>Everything works fine, except when inside the PopupWindow there's a ScrolledWindow <em>with shown scrollba... | [
{
"answer_id": 636609,
"author": "Chris Hynes",
"author_id": 8037,
"author_profile": "https://Stackoverflow.com/users/8037",
"pm_score": 7,
"selected": true,
"text": "<p>You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something lik... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3497/"
] | I have a frame with a textctrl. When the mouse enters the textctrl (EVT\_ENTER\_WINDOW) I show a PopupWindow on top of the textctrl, and when the mouse leaves the popup (EVT\_LEAVE\_WINDOW) I hide it again.
Everything works fine, except when inside the PopupWindow there's a ScrolledWindow *with shown scrollbars*. The ... | You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something like this should work:
```
<location path="Images/Upload">
<system.web>
<httpRuntime executionTimeout="600" />
</system.web>
</location>
``` |
492,366 | <p>is there a way to use mouse as an event handler in c/c++ im making a game on snakes and ladder (the famous board game) and trying to make it with basic borland c++ compiler working with a header file called graphics.h, which is very basic and gives output of 640 X 480 res, so I was wondering if there is a possiblity... | [
{
"answer_id": 636609,
"author": "Chris Hynes",
"author_id": 8037,
"author_profile": "https://Stackoverflow.com/users/8037",
"pm_score": 7,
"selected": true,
"text": "<p>You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something lik... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60269/"
] | is there a way to use mouse as an event handler in c/c++ im making a game on snakes and ladder (the famous board game) and trying to make it with basic borland c++ compiler working with a header file called graphics.h, which is very basic and gives output of 640 X 480 res, so I was wondering if there is a possiblity of... | You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something like this should work:
```
<location path="Images/Upload">
<system.web>
<httpRuntime executionTimeout="600" />
</system.web>
</location>
``` |
492,373 | <p>I'm really struggling to wrap my head around some of this stuff. Let me give an example of where I'm struggling.</p>
<p>I'm using Linq-2-Sql as the DAL for my app and the IRepository pattern used in the MVC Storefront sample app from Rob Conery.</p>
<p>In my domain I have a Customer Model which has a collection of... | [
{
"answer_id": 492615,
"author": "codybartfast",
"author_id": 53252,
"author_profile": "https://Stackoverflow.com/users/53252",
"pm_score": 3,
"selected": true,
"text": "<p>DDD is an area where I have a lot of interest but but very little experience so please treat my suggestions cautiou... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] | I'm really struggling to wrap my head around some of this stuff. Let me give an example of where I'm struggling.
I'm using Linq-2-Sql as the DAL for my app and the IRepository pattern used in the MVC Storefront sample app from Rob Conery.
In my domain I have a Customer Model which has a collection of Address Models. ... | DDD is an area where I have a lot of interest but but very little experience so please treat my suggestions cautiously. I only offer them because of the absence of other, more authoritative, answers.
In '[the book](http://domaindrivendesign.org/books/)' by Eric Evans address is given as an example of something that sh... |
492,374 | <p>Let's say we got a main executable called "my_app" and it uses several other libraries: 3 libraries are linked statically, and other 3 are linked dynamically.
In which order should they be linked against "my_app"?</p>
<p>But in which order should these be linked?</p>
<p>Let's say we got libSA (as in Static A) whic... | [
{
"answer_id": 492426,
"author": "Kosi2801",
"author_id": 57601,
"author_profile": "https://Stackoverflow.com/users/57601",
"pm_score": 0,
"selected": false,
"text": "<p>The dependencies for linking a library or executable have to be present at link-time, so you cannot link libXC before ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59320/"
] | Let's say we got a main executable called "my\_app" and it uses several other libraries: 3 libraries are linked statically, and other 3 are linked dynamically.
In which order should they be linked against "my\_app"?
But in which order should these be linked?
Let's say we got libSA (as in Static A) which depends on li... | In the static case, it doesn't really matter, because you don't actually link static libraries - all you do is pack some object files together in one archive. All you have to is compile your object files, and you can create static libraries right away.
The situation with dynamic libraries is more convoluted, there are... |
492,375 | <p>I have a table in SqlServer 9 with data of the form</p>
<pre><code>Code Number
J 0
J 5
J 8
Y 2
Y 8
</code></pre>
<p>I'd like to add a column that has a number with the internal sequence of numbers for each code, so that my table looks like this;</p>
<pre><code>Code Number Seq... | [
{
"answer_id": 492415,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 1,
"selected": false,
"text": "<p>look up the functions row_number() and RANK() in Books On Line</p>\n"
},
{
"answer_id": 492425,
"author": "Ry... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41556/"
] | I have a table in SqlServer 9 with data of the form
```
Code Number
J 0
J 5
J 8
Y 2
Y 8
```
I'd like to add a column that has a number with the internal sequence of numbers for each code, so that my table looks like this;
```
Code Number Seq
J 0 1
J 5 ... | Look at the [ROW\_NUMBER()](http://msdn.microsoft.com/en-us/library/ms186734.aspx) function.
```
DECLARE @Number TABLE (
Code nvarchar(1)
, Number int
)
INSERT @Number VALUES ('J', 0)
INSERT @Number VALUES ('J', 5)
INSERT @Number VALUES ('J', 8)
INSERT @Number VALUES ('Y', 2)
INSERT @Number VALUES (... |
492,383 | <p>I get the following error when I try to concatenate
Operand type clash: text in incompatible with bit
Invalid operator for datatype: Operator equals Add, Type equal bit</p>
<pre><code>SELECT
F.SubmissionId, F.FormId,
F.DocumentTitle + F.Archive AS DocumentTitle,
F.Keywords, F.PublishDate, F.PostedDate, F.Exp... | [
{
"answer_id": 492397,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 2,
"selected": false,
"text": "<p>Why don't you do it in the presentation layer whatever it might be in your case?</p>\n\n<p>If it's not an option,... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I get the following error when I try to concatenate
Operand type clash: text in incompatible with bit
Invalid operator for datatype: Operator equals Add, Type equal bit
```
SELECT
F.SubmissionId, F.FormId,
F.DocumentTitle + F.Archive AS DocumentTitle,
F.Keywords, F.PublishDate, F.PostedDate, F.ExpiredDate,
F... | you need to convert, run this to see what I mean
```
declare @i bit
select @i = 1
select 'abc' + convert(varchar(1),@i) -- fine
select 'abc' + @i -- will fail
``` |
492,384 | <p>First off, here is some code:</p>
<pre><code>int main()
{
int days[] = {1,2,3,4,5};
int *ptr = days;
printf("%u\n", sizeof(days));
printf("%u\n", sizeof(ptr));
return 0;
}
</code></pre>
<p>Is there a way to find out the size of the array that <code>ptr</code> is pointing to (instead of just g... | [
{
"answer_id": 492410,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 9,
"selected": true,
"text": "<p>No, you can't. The compiler doesn't know what the pointer is pointing to. There are tricks, like ending the array w... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33324/"
] | First off, here is some code:
```
int main()
{
int days[] = {1,2,3,4,5};
int *ptr = days;
printf("%u\n", sizeof(days));
printf("%u\n", sizeof(ptr));
return 0;
}
```
Is there a way to find out the size of the array that `ptr` is pointing to (instead of just giving its size, which is four bytes o... | No, you can't. The compiler doesn't know what the pointer is pointing to. There are tricks, like ending the array with a known out-of-band value and then counting the size up until that value, but that's not using `sizeof()`.
Another trick is the one mentioned by [Zan](https://stackoverflow.com/users/13422/zan-lynx),... |
492,387 | <p>When I compile the Python code below, I get</p>
<blockquote>
<p>IndentationError: unindent does not match any outer indentation level</p>
</blockquote>
<hr />
<pre><code>import sys
def Factorial(n): # Return factorial
result = 1
for i in range (1,n):
result = result * i
print "factorial is ... | [
{
"answer_id": 492399,
"author": "Kevin Tighe",
"author_id": 39461,
"author_profile": "https://Stackoverflow.com/users/39461",
"pm_score": 11,
"selected": true,
"text": "<p>Other posters are probably correct...there might be spaces mixed in with your tabs. Try doing a search & replac... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29505/"
] | When I compile the Python code below, I get
>
> IndentationError: unindent does not match any outer indentation level
>
>
>
---
```
import sys
def Factorial(n): # Return factorial
result = 1
for i in range (1,n):
result = result * i
print "factorial is ",result
return result
```
Why? | Other posters are probably correct...there might be spaces mixed in with your tabs. Try doing a search & replace to replace all tabs with a few spaces.
Try this:
```
import sys
def Factorial(n): # return factorial
result = 1
for i in range (1,n):
result = result * i
print "factorial is ",result
... |
492,391 | <p>How do you get the Domain Controller IP address programmatically using <code>C#</code>?</p>
| [
{
"answer_id": 492489,
"author": "Mike Marshall",
"author_id": 29798,
"author_profile": "https://Stackoverflow.com/users/29798",
"pm_score": 1,
"selected": false,
"text": "<p>Well here is the general workflow of how to get it as described at the MS site:</p>\n\n<p><a href=\"http://suppor... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32718/"
] | How do you get the Domain Controller IP address programmatically using `C#`? | Thanks All,
I done it as in this code
```
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices.ActiveDirectory;
public doIt()
{
Dir... |
492,407 | <p>I'm creating a WCF Client to an External REST API, but are getting the following error:</p>
<blockquote>
<p>OperationFormatter encountered an
invalid Message body</p>
</blockquote>
<p>The client hits the server correctly and does the 'Post' that I am requiring, but it is expecting a different response Element,... | [
{
"answer_id": 492429,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 0,
"selected": false,
"text": "<p>It would help if you posted the contract definition that you were using. Generally though, you are going to have to ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8534/"
] | I'm creating a WCF Client to an External REST API, but are getting the following error:
>
> OperationFormatter encountered an
> invalid Message body
>
>
>
The client hits the server correctly and does the 'Post' that I am requiring, but it is expecting a different response Element, basically appending 'Response'... | The BodyStyle in the operation contract has been set to **WrappedResponse**. Change the BodyStyle to **WebMessageBodyStyle.Bare**.
This tells the WCF runtime not to include the wrapper which is an XML node with the Name= MethodName+ the word "Response" |
492,436 | <p>I am having an issue when my asp.net AJAX Update Panel updates it renders the contents at the top of my table rather than in the place it belongs below is my code:</p>
<pre><code><tr>
<td>
</td>
<td>
<asp:CheckBox ID="ddCheckbox" runat="server" Text="Checkbox"
Au... | [
{
"answer_id": 492460,
"author": "Jim Petkus",
"author_id": 38053,
"author_profile": "https://Stackoverflow.com/users/38053",
"pm_score": 0,
"selected": false,
"text": "<p>Have you done a view source to confirm that it is actually rendering it in that location within the HTML itself? Bro... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3111/"
] | I am having an issue when my asp.net AJAX Update Panel updates it renders the contents at the top of my table rather than in the place it belongs below is my code:
```
<tr>
<td>
</td>
<td>
<asp:CheckBox ID="ddCheckbox" runat="server" Text="Checkbox"
AutoPostBack="true" OnCheckedChanged="ddChe... | 1) create a custom updatepanel control ( copy/paste from [SingingEels](http://www.singingeels.com/Articles/Making_Your_Own_Semantic_Controls.aspx) )
2) use this custom updatepanel control with an attribute `RenderedElement="TBODY"`
3) nest your table as follow:
```
<TABLE>
<TR>
<TD>outside updatepanel</TD>
<... |
492,452 | <p>I have this list </p>
<pre><code>["camilla_farnestam@hotmail.com : martin00", ""],
</code></pre>
<p>How do I split so it only be left with:</p>
<pre><code>camilla_farnestam@hotmail.com:martin00
</code></pre>
| [
{
"answer_id": 492456,
"author": "Abgan",
"author_id": 46308,
"author_profile": "https://Stackoverflow.com/users/46308",
"pm_score": 2,
"selected": false,
"text": "<p>Do you want to have: <code>aList[0]</code> ? </p>\n\n<p><strong>EDIT::</strong><br>\nOh, you have a tuple with the list ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have this list
```
["camilla_farnestam@hotmail.com : martin00", ""],
```
How do I split so it only be left with:
```
camilla_farnestam@hotmail.com:martin00
``` | Do you want to have: `aList[0]` ?
**EDIT::**
Oh, you have a tuple with the list in it!
Now I see:
```
al = ["camilla_farnestam@hotmail.com : martin00", ""],
#type(al) == tuple
#len(al) == 1
aList = al[0]
#type(aList) == list
#len(aList) == 2
#Now you can type:
aList[0]
#and you get:
"camilla_farnestam@hotmail.com... |
492,454 | <p>I have a byte array that I am reading in from a NetworkStream. The first two bytes tell the length of the packet that follows and then the packet is read into a byte array of that length. The data in that I need to read from the NetworkStream/byte array has a few Strings, i.e. variable length data terminated by new ... | [
{
"answer_id": 492471,
"author": "Binary Worrier",
"author_id": 18797,
"author_profile": "https://Stackoverflow.com/users/18797",
"pm_score": 4,
"selected": true,
"text": "<p>Personally I would</p>\n\n<ol>\n<li>Put an Int16 at the start of the\nstrings, so you know how long\nthey're goin... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34386/"
] | I have a byte array that I am reading in from a NetworkStream. The first two bytes tell the length of the packet that follows and then the packet is read into a byte array of that length. The data in that I need to read from the NetworkStream/byte array has a few Strings, i.e. variable length data terminated by new lin... | Personally I would
1. Put an Int16 at the start of the
strings, so you know how long
they're going to be, and
2. Use the IO.BinaryReader class to
do the reading, it'll "read", ints,
strings, chars etc into variable e.g. BinReader.ReadInt16() will read two bytes, return the int16 they represent, and move two bytes on i... |
492,457 | <p>I have a JFreeChart line plot that is updated dynamically with one data point for every iteration of my algorithm. Because the number of data points can quickly become very large, I have used the <a href="http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/ValueAxis.html#setFixedAutoRange(double)" rel=... | [
{
"answer_id": 492804,
"author": "Dan Dyer",
"author_id": 5171,
"author_profile": "https://Stackoverflow.com/users/5171",
"pm_score": 0,
"selected": false,
"text": "<p>I now have a working solution, although I'm still interested in better approaches,</p>\n\n<p>Initially I set the range o... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5171/"
] | I have a JFreeChart line plot that is updated dynamically with one data point for every iteration of my algorithm. Because the number of data points can quickly become very large, I have used the [setFixedAutoRange(double)](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/ValueAxis.html#setFixedAutoRang... | It looks like you're looking for a solution that involves configuring JFreeChart to do it for you, rather than manually setting the range.
I can't help with that....but here are some other ugly solutions :P ....
You could do something like this (sorry for the pseudo-code):
```
while(producingData) {
this.produceD... |
492,482 | <p>I'm trying to write a Ruby script that will ssh over to a server, run a given command, and fetch the output from it. Here's what I've got so far, mostly adapted from the <a href="http://www.pragprog.com/titles/ruby/programming-ruby" rel="nofollow noreferrer">Programming Ruby</a> book:</p>
<pre><code>require 'pty'
r... | [
{
"answer_id": 495082,
"author": "Ryan Bigg",
"author_id": 15245,
"author_profile": "https://Stackoverflow.com/users/15245",
"pm_score": 4,
"selected": true,
"text": "<p>For this I recommend using the net-ssh gem: <code>sudo gem install net-ssh</code>: <a href=\"http://net-ssh.rubyforge.... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/422/"
] | I'm trying to write a Ruby script that will ssh over to a server, run a given command, and fetch the output from it. Here's what I've got so far, mostly adapted from the [Programming Ruby](http://www.pragprog.com/titles/ruby/programming-ruby) book:
```
require 'pty'
require 'expect'
$expect_verbose = true
PTY.spawn("... | For this I recommend using the net-ssh gem: `sudo gem install net-ssh`: <http://net-ssh.rubyforge.org/ssh/v2/api/index.html>
The code goes a little like this:
```
require 'rubygems'
require 'net/ssh'
Net::SSH.start('your-server', 'username', :password => "password") do |ssh|
puts ssh.exec!("ls -la")
end
``` |
492,483 | <p>When piping the output of a Python program, the Python interpreter gets confused about encoding and sets it to None. This means a program like this:</p>
<pre><code># -*- coding: utf-8 -*-
print u"åäö"
</code></pre>
<p>will work fine when run normally, but fail with:</p>
<blockquote>
<p>UnicodeEncodeError: 'asci... | [
{
"answer_id": 492711,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 8,
"selected": true,
"text": "<p>Your code works when run in an script because Python encodes the output to whatever encoding your terminal application is... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51647/"
] | When piping the output of a Python program, the Python interpreter gets confused about encoding and sets it to None. This means a program like this:
```
# -*- coding: utf-8 -*-
print u"åäö"
```
will work fine when run normally, but fail with:
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in ... | Your code works when run in an script because Python encodes the output to whatever encoding your terminal application is using. If you are piping you must encode it yourself.
A rule of thumb is: Always use Unicode internally. Decode what you receive, and encode what you send.
```
# -*- coding: utf-8 -*-
print u"åäö"... |
492,500 | <p>Here is the structure of the data my object will need to expose (the data is NOT really stored in XML, it was just the easiest way to illustrate the layout):</p>
<pre><code><Department id="Accounting">
<Employee id="1234">Joe Jones</Employee>
<Employee id="5678">Steve Smith</Employee&... | [
{
"answer_id": 492512,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "<ul>\n<li>A department object</li>\n<li>An employee object</li>\n<li>An employeeCollection object. (optional, you can j... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] | Here is the structure of the data my object will need to expose (the data is NOT really stored in XML, it was just the easiest way to illustrate the layout):
```
<Department id="Accounting">
<Employee id="1234">Joe Jones</Employee>
<Employee id="5678">Steve Smith</Employee>
</Department>
<Department id="Marketing"... | ```
Class Department
Public Id As Integer
Public Employees As List(Of Employee)
End Class
Class Employee
Public Id As Integer
Public Name As String
End Class
```
Something like that (can't remember my VB syntax). Be sure to use Properties versus Public members... |
492,519 | <p>I'm calling a function in Python which I know may stall and force me to restart the script. </p>
<p>How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds the script cancels it and does something else?</p>
| [
{
"answer_id": 494273,
"author": "piro",
"author_id": 10138,
"author_profile": "https://Stackoverflow.com/users/10138",
"pm_score": 9,
"selected": true,
"text": "<p>You may use the <a href=\"http://docs.python.org/library/signal.html\" rel=\"noreferrer\">signal</a> package if you are run... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | I'm calling a function in Python which I know may stall and force me to restart the script.
How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds the script cancels it and does something else? | You may use the [signal](http://docs.python.org/library/signal.html) package if you are running on UNIX:
```
In [1]: import signal
# Register an handler for the timeout
In [2]: def handler(signum, frame):
...: print("Forever is over!")
...: raise Exception("end of time")
...:
# This function *may* ... |
492,535 | <p>In asp.net if you define an asp:ListBox as follows:</p>
<pre><code><asp:ListBox ID="listBox2" runat="server" SelectionMode="Single" Rows="3">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:L... | [
{
"answer_id": 492586,
"author": "weffey",
"author_id": 13208,
"author_profile": "https://Stackoverflow.com/users/13208",
"pm_score": 0,
"selected": false,
"text": "<p>It's bit clumsy, but I've done this once, and would welcome a better solution.</p>\n\n<pre><code> //get the selec... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52102/"
] | In asp.net if you define an asp:ListBox as follows:
```
<asp:ListBox ID="listBox2" runat="server" SelectionMode="Single" Rows="3">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:... | Here's how I've done it in the past. Note that this scrolls the view to the last item in the listbox.
```
function FocusSelected()
{
var lb = document.getElementById("listBox1");
if (lb != null)
{
var options = lb.options;
for (var i = options.length - 1; i > 0 ; i--)
{
if (options[i].selected ... |
492,539 | <p>Can you tell me what the difference is between these methods of attaching an event handler?</p>
<pre><code>//Method 1
this.button4.Click += new RoutedEventHandler(button4_Click);
//Method 2
this.button4.Click += button4_Click;
...
void button4_Click(object sender, RoutedEventArgs e) { }
</code></pre>
| [
{
"answer_id": 492545,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 1,
"selected": false,
"text": "<p>No difference whatsoever - the second is just syntactic shugar added in C# 2.0. And in C# 3.0 lambdas are even mo... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can you tell me what the difference is between these methods of attaching an event handler?
```
//Method 1
this.button4.Click += new RoutedEventHandler(button4_Click);
//Method 2
this.button4.Click += button4_Click;
...
void button4_Click(object sender, RoutedEventArgs e) { }
``` | As Anton says, there's no difference.
Just as a bit more background, this isn't specific to events. That's just one use of the feature in C# 2.0, which is implicit conversion of method groups to delegates. So you can similarly use it like this:
```
EventHandler handler = button4_click;
```
Another change to delegat... |
492,547 | <p>I'm in the middle of adding a tagging system to my website. I want to be able to easily add/edit items tags.</p>
<p>My current tags table structure is:</p>
<pre><code>Table: Item
Columns: ItemID, Title, Content
Table: Tag
Columns: TagID, Title, Tag_Counter
Table: ItemTag
Columns: ItemID, TagID
</code></pre>
<p>... | [
{
"answer_id": 494685,
"author": "Sophia",
"author_id": 59587,
"author_profile": "https://Stackoverflow.com/users/59587",
"pm_score": 2,
"selected": true,
"text": "<p>If you don't want to code it all by hand, you could try an open source solution.</p>\n\n<p>For example, \n<a href=\"https... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59361/"
] | I'm in the middle of adding a tagging system to my website. I want to be able to easily add/edit items tags.
My current tags table structure is:
```
Table: Item
Columns: ItemID, Title, Content
Table: Tag
Columns: TagID, Title, Tag_Counter
Table: ItemTag
Columns: ItemID, TagID
```
I really like the implementation ... | If you don't want to code it all by hand, you could try an open source solution.
For example,
<https://code.google.com/p/phptagengine/>
If you want something more powerful that integrates with Flicker, Technorati, Delicious, etc the ZEND\_Service framework has some pretty cool libraries. |
492,556 | <p>I am using the CakePHP XmlHelper to parse XML files like: </p>
<pre><code>App::import('Xml');
$file = "my_xml_file.xml";
$parsed_xml =& new XML($file);
</code></pre>
<p>How can I use it to load XML files from URLs like <a href="http://www.site.com/file.xml" rel="nofollow noreferrer">http://www.site.com/file.xm... | [
{
"answer_id": 492609,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<pre><code>$contents = file_get_contents(\"http://www.site.com/file.xml\");\n$file = fopen(\"temp.xml\", \"rb\");\nfwrite($fil... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2274/"
] | I am using the CakePHP XmlHelper to parse XML files like:
```
App::import('Xml');
$file = "my_xml_file.xml";
$parsed_xml =& new XML($file);
```
How can I use it to load XML files from URLs like <http://www.site.com/file.xml>
Thanks! | It's simple
```
App::import('Xml');
$url = "http://www.example.com/xml_file.xml";
$parsed_xml =& new XML($url);
```
Just using the URL instead of the file, Cake will internally choose the way to open the file |
492,558 | <p>I have a Git repo that I have deleted four files from using <code>rm</code> (<strong>not</strong> <code>git rm</code>), and my Git status looks like this:</p>
<pre><code># deleted: file1.txt
# deleted: file2.txt
# deleted: file3.txt
# deleted: file4.txt
</code></pre>
<p>How do I remove thes... | [
{
"answer_id": 492591,
"author": "Cody Caughlan",
"author_id": 25398,
"author_profile": "https://Stackoverflow.com/users/25398",
"pm_score": 10,
"selected": false,
"text": "<p>You can use </p>\n\n<pre><code>git add -u\n</code></pre>\n\n<p>To add the deleted files to the staging area, the... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12037/"
] | I have a Git repo that I have deleted four files from using `rm` (**not** `git rm`), and my Git status looks like this:
```
# deleted: file1.txt
# deleted: file2.txt
# deleted: file3.txt
# deleted: file4.txt
```
How do I remove these files from Git without having to manually go through and ad... | ### For Git 1.x
```
$ git add -u
```
This tells git to automatically stage tracked files -- including deleting the previously tracked files.
### For Git 2.0
To stage your whole working tree:
```
$ git add -u :/
```
To stage just the current path:
```
$ git add -u .
``` |
492,559 | <p>Okay so Here's my issue. I have a table, a bit like Apple's addressBook.app that uses different cell subclasses to display information in different ways. On this particular app I have 3 different UiTableViewCell subclasses, all with their own nibs.</p>
<p>I can't get the code right :-( if I try and access the insta... | [
{
"answer_id": 492837,
"author": "Ryan Townshend",
"author_id": 24707,
"author_profile": "https://Stackoverflow.com/users/24707",
"pm_score": 2,
"selected": false,
"text": "<p>Matt Gallagher has an article that lays out a cleaner way to accomplish this type of table.\nHe breaks out the c... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51420/"
] | Okay so Here's my issue. I have a table, a bit like Apple's addressBook.app that uses different cell subclasses to display information in different ways. On this particular app I have 3 different UiTableViewCell subclasses, all with their own nibs.
I can't get the code right :-( if I try and access the instance variab... | Matt Gallagher has an article that lays out a cleaner way to accomplish this type of table.
He breaks out the cell specific code into their own classes. Makes it alot easier to manage.
[cocoawithlove.com - Heterogeneous cells in a UITableViewController](http://cocoawithlove.com/2008/12/heterogeneous-cells-in.html)
In... |
492,573 | <p>I've got a parent page and an iframe inside that page. The links in the parent control the page that gets loaded in the iframe. What I want to do is refresh the parent page when the iframe gets loaded.
I've got this in the iframe:</p>
<pre><code>RefreshParent(){
parent.location.reload();
}
<body onload="Ref... | [
{
"answer_id": 492593,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": true,
"text": "<p>You can't refresh the parent page without reloading the iframe.</p>\n\n<p>What you could do is use <a href=\"http://en.wiki... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10609/"
] | I've got a parent page and an iframe inside that page. The links in the parent control the page that gets loaded in the iframe. What I want to do is refresh the parent page when the iframe gets loaded.
I've got this in the iframe:
```
RefreshParent(){
parent.location.reload();
}
<body onload="RefreshParent();">
... | You can't refresh the parent page without reloading the iframe.
What you could do is use [AJAX](http://en.wikipedia.org/wiki/AJAX) to update the parent's content, but that could be a fair amount of work (using the jQuery or Prototype frameworks would make this easier). |
492,577 | <p>To sum up, i'm a totally beginner in libxml and I have to use an existing source code. The main idea is to apply a first xpath expression to extract a set of nodes from an xml file. Then, for each node, the second xpath expression shall be applied to extract some values.</p>
<p>Existing source code is:</p>
<pre><c... | [
{
"answer_id": 492622,
"author": "Jeremy French",
"author_id": 56672,
"author_profile": "https://Stackoverflow.com/users/56672",
"pm_score": 1,
"selected": false,
"text": "<p>you could concatinate your xpath expressions. </p>\n\n<p><em>edit</em></p>\n\n<p>//FORECAST/DAY/descendant::conte... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60292/"
] | To sum up, i'm a totally beginner in libxml and I have to use an existing source code. The main idea is to apply a first xpath expression to extract a set of nodes from an xml file. Then, for each node, the second xpath expression shall be applied to extract some values.
Existing source code is:
```
int xt_parseXmlRe... | Some sample code. Modify to suit your needs and language. This is C#, but it should be largely the same. Notice the second xpath is not starting with a "/" and is using an instance of the node returned from the first one. Neither of the xpaths end in a "/".
```
XmlDocument doc = new XmlDocument();
doc.Load(docfile);
X... |
492,580 | <p>I have a multiple menu's on my page which all use the same mouseover and click events, so I decided to get it into a function. However vars seem to always be assigned to the last of the arguments for the hover(function, function) function.</p>
<pre><code>$(document).ready( function() {
menuMouseOver = function() {
... | [
{
"answer_id": 492646,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": true,
"text": "<p>Your problem is that the <strong>hover event</strong> occurs outside of the scope of your executing method. So by the ti... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35197/"
] | I have a multiple menu's on my page which all use the same mouseover and click events, so I decided to get it into a function. However vars seem to always be assigned to the last of the arguments for the hover(function, function) function.
```
$(document).ready( function() {
menuMouseOver = function() {
for(i=0, u... | Your problem is that the **hover event** occurs outside of the scope of your executing method. So by the time the hover executes your *active* variable has already gone through the entire set and rests at the active state of your last element. So you are seeing this problem because that last log is an event, which is o... |
492,587 | <p>I'm working on a solution that contains a Windows Service and a WinForms client that interacts with that service.</p>
<p>In my pre-build and post-build events, I have some <code>net start</code> and <code>net stop</code> commands to start and stop the service, but there are times when this causes a problem (file's ... | [
{
"answer_id": 492646,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": true,
"text": "<p>Your problem is that the <strong>hover event</strong> occurs outside of the scope of your executing method. So by the ti... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57621/"
] | I'm working on a solution that contains a Windows Service and a WinForms client that interacts with that service.
In my pre-build and post-build events, I have some `net start` and `net stop` commands to start and stop the service, but there are times when this causes a problem (file's not found, service is already st... | Your problem is that the **hover event** occurs outside of the scope of your executing method. So by the time the hover executes your *active* variable has already gone through the entire set and rests at the active state of your last element. So you are seeing this problem because that last log is an event, which is o... |
492,600 | <h2>Question</h2>
<p>I'm writing some code that needs to be able to get the <strong>values</strong> of the parameters from the method that called into the class. I know how to get all the way to the ParameterInfo[] array, but I don't know how to then get the values. Is this even possible?</p>
<p>If it is, I think it ... | [
{
"answer_id": 492624,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 1,
"selected": false,
"text": "<p>You can't do it with either StackFrame or StackTrace. You can, however, employ some interception framework (such ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/448/"
] | Question
--------
I'm writing some code that needs to be able to get the **values** of the parameters from the method that called into the class. I know how to get all the way to the ParameterInfo[] array, but I don't know how to then get the values. Is this even possible?
If it is, I think it has something to do wit... | You cannot do it without introspecting the stack yourself (and this is fragile since many optimizations may mean the stack frame is not what you expect, or even that the parameter passed is not in fact what the method signature would suggest (it is perfectly possible for an optimizing JIT compiler to spot that you are ... |
492,613 | <p>I'm trying to write a stored procedure and depending on a certain column value, I want to be able to change what table I select from. I'll try to give an example:</p>
<pre><code>SELECT ItemNumber,
ItemType,
Description
FROM
CASE ItemType
WHEN 'A' THEN TableA
ELSE TableB
END
WHERE
CASE ItemType
W... | [
{
"answer_id": 492630,
"author": "Sunny Milenov",
"author_id": 8220,
"author_profile": "https://Stackoverflow.com/users/8220",
"pm_score": 0,
"selected": false,
"text": "<p>You are better of using UNION query to join the tables first, and then SELECT.</p>\n\n<p>Also, you may consider cre... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104949/"
] | I'm trying to write a stored procedure and depending on a certain column value, I want to be able to change what table I select from. I'll try to give an example:
```
SELECT ItemNumber,
ItemType,
Description
FROM
CASE ItemType
WHEN 'A' THEN TableA
ELSE TableB
END
WHERE
CASE ItemType
WHEN 'A' THEN It... | You can not use CASE statement in FROM clause, but you can use the following instead:
```
SELECT itemnumber, itemtype, description
FROM tablea
WHERE itemnumber = @itemnumber AND itemtype = 'A'
UNION ALL
SELECT itemnumber, itemtype, description
FROM tableb
WHERE partnumber = @itemnumber AND itemtype <> 'A'
``` |
492,614 | <p>I have a new database, similar to the old one but with more columns and tables. So the data on the old table is still useable and needs transferring.</p>
<p>The old database is on a different server to the new one. I want to transfer the data from one database to the other.</p>
<p>I have navicat, but it seems to t... | [
{
"answer_id": 492649,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 0,
"selected": false,
"text": "<p>Can you not transfer only a portion of the data for testing first? Then, later, transfer the entire thing when you're s... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31399/"
] | I have a new database, similar to the old one but with more columns and tables. So the data on the old table is still useable and needs transferring.
The old database is on a different server to the new one. I want to transfer the data from one database to the other.
I have navicat, but it seems to take forever using... | Doing a mysqldump on the source machine and then slurping it in on the other side, even on a 40-100MB file is well within reason. Do it from the command line.
```
(source machine)
mysqldump -u user -p password database > database.sql
```
..transfer file to recipient machine...
```
(recipient machine)
mysql -u user ... |
492,625 | <p>I have a page that I want it to have 2 different routes: "/Admin/Schedules" AND "/Schedules"</p>
<p>"/Admin/Schedules" if for admin users and the page will render some admin features and it needs to log in... on the other hand, "/Schedules" is for non-logged users and it will render non-admin features...</p>
... | [
{
"answer_id": 492661,
"author": "ajma",
"author_id": 60117,
"author_profile": "https://Stackoverflow.com/users/60117",
"pm_score": 0,
"selected": false,
"text": "<p>You can do it in your controller instead of the routing. RedirectToAction or RedirectToRoute can help you.</p>\n"
},
{... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60286/"
] | I have a page that I want it to have 2 different routes: "/Admin/Schedules" AND "/Schedules"
"/Admin/Schedules" if for admin users and the page will render some admin features and it needs to log in... on the other hand, "/Schedules" is for non-logged users and it will render non-admin features...
But, the page is th... | you could accomplish this in the controller as ajma said by just having an if condition and a switch statement in a method that checks if the user exist like so:
```
if(UserID !=null)
{
switch(UserPreference)
{
case 1:
action = "Schedules";
... |
492,627 | <p>Is it possible to change the border color on a <code><select/></code> element in an HTML form?</p>
<p>The <code>border-color</code> style works in Firefox but not IE.</p>
<p>I could find no real answers on Google.</p>
| [
{
"answer_id": 492638,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "<p>No, the <code><select></code> control is a system-level control, not a client-level control in... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to change the border color on a `<select/>` element in an HTML form?
The `border-color` style works in Firefox but not IE.
I could find no real answers on Google. | I would consinder enclosing that select block within a div block and setting the border property like this:
```html
<div style="border: 2px solid blue;">
<select style="width: 100%;">
<option value="Sal">Sal</option>
<option value="Awesome">Awesome!</option>
</select>
</div>
```
You should be able to... |
492,679 | <p>I have a SQL query, that returns a set of rows:</p>
<pre><code>SELECT id, name FROM users where group = 2
</code></pre>
<p>I need to also include a column that has an incrementing integer value, so the first row needs to have a 1 in the counter column, the second a 2, the third a 3 etc</p>
<p>The query shown here... | [
{
"answer_id": 492696,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 4,
"selected": false,
"text": "<p>In SQL Server 2005 and up, you can use the <a href=\"http://msdn.microsoft.com/en-us/library/ms186734.aspx\" rel=\"no... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46354/"
] | I have a SQL query, that returns a set of rows:
```
SELECT id, name FROM users where group = 2
```
I need to also include a column that has an incrementing integer value, so the first row needs to have a 1 in the counter column, the second a 2, the third a 3 etc
The query shown here is just a simplified example, in... | For starters, something along the lines of:
```
SELECT my_first_column, my_second_column,
ROW_NUMBER() OVER (ORDER BY my_order_column) AS Row_Counter
FROM my_table
```
However, it's important to note that the `ROW_NUMBER() OVER (ORDER BY ...)` construct only determines the values of `Row_Counter`, it doesn't gua... |
492,683 | <p>I have a left outer join (below) returning results as expected. I need to limit the results from the 'right' table to the 'first' hit. Can I do that somehow? Currently, I get a result for every record in both tables, I only want to see one result from the table on the left (items) no matter how many results I have i... | [
{
"answer_id": 492704,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 7,
"selected": true,
"text": "<p>This will do the job for you.</p>\n\n<pre><code>from i in db.items\nlet p = db.photos.Where(p2 => i.id == p2.item_id).Fir... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459737/"
] | I have a left outer join (below) returning results as expected. I need to limit the results from the 'right' table to the 'first' hit. Can I do that somehow? Currently, I get a result for every record in both tables, I only want to see one result from the table on the left (items) no matter how many results I have in t... | This will do the job for you.
```
from i in db.items
let p = db.photos.Where(p2 => i.id == p2.item_id).FirstOrDefault()
orderby i.date descending
select new
{
itemName = i.name,
itemID = i.id,
id = i.id,
photoID = p == null ? null : p.PhotoID.ToString();
}
```
I got this sql when I generated it against my ow... |
492,698 | <p>I am building a section of an application that revolves around pulling information about transactions out of the database. Due to the nature of the data, there are many columns in the table that I want to filter on. I have a filter selection box with 15 fields that I want to be able to build up a where clause for ... | [
{
"answer_id": 492744,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 0,
"selected": false,
"text": "<p>First, you would need to use <code>Expression<Func<Transaction, bool>></code> for LINQ-to-SQL (that's wha... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24108/"
] | I am building a section of an application that revolves around pulling information about transactions out of the database. Due to the nature of the data, there are many columns in the table that I want to filter on. I have a filter selection box with 15 fields that I want to be able to build up a where clause for the L... | * In dynamic SQL... Since you only have one WHERE clause - you must concatenate predicates with AND.
* In linq query construction... you get as many WHERE clauses as you want. Linq will AND them together for you when it translates the query.
Example:
```
IQueryable<Transaction> query = db.Transactions;
if (filterByT... |
492,700 | <p>I have a block of text and I want to get its lines <strong>without</strong> losing the \r and \n at the end. Right now, I have the following (suboptimal code):</p>
<pre><code>string[] lines = tbIn.Text.Split('\n')
.Select(t => t.Replace("\r", "\r\n")).ToArray();
</code></pre>
<p>So I'm wond... | [
{
"answer_id": 492727,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 0,
"selected": false,
"text": "<p>If you are just going to replace the newline (<code>\\n</code>) then do something like this:</p>\n\n<pre><code>stri... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9476/"
] | I have a block of text and I want to get its lines **without** losing the \r and \n at the end. Right now, I have the following (suboptimal code):
```
string[] lines = tbIn.Text.Split('\n')
.Select(t => t.Replace("\r", "\r\n")).ToArray();
```
So I'm wondering - is there a better way to do it?
*... | The following seems to do the job:
```
string[] lines = Regex.Split(tbIn.Text, @"(?<=\r\n)(?!$)");
```
(?<=\r\n) uses 'positive lookbehind' to match after \r\n without consuming it.
(?!$) uses negative lookahead to prevent matching at the end of the input and so avoids a final line that is just an empty string. |
492,716 | <p>I want to reverse a regular expression. I.e. given a regular expression, I want to produce <em>any</em> string that will match that regex.</p>
<p>I know how to do this from a theoretical computer science background using a finite state machine, but I just want to know if someone has already written a library to do ... | [
{
"answer_id": 492728,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 3,
"selected": false,
"text": "<p>Unless your regex is extremely simple (i.e. no stars or pluses), there will be infinitely many strings which matc... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161922/"
] | I want to reverse a regular expression. I.e. given a regular expression, I want to produce *any* string that will match that regex.
I know how to do this from a theoretical computer science background using a finite state machine, but I just want to know if someone has already written a library to do this. :)
I'm usi... | Somebody else had a similar (duplicate?) question [here](https://stackoverflow.com/questions/4627464/generate-a-string-that-matches-a-regex-in-python), and I'd like to offer a little helper library for [generating random strings with Python](https://github.com/leapfrogonline/rstr) that I've been working on.
It include... |
492,754 | <p>I am trying to run Eclipse 3.4.1 on MacOS 10.5.6?
I think I am using java 1.5 when I run eclipse:</p>
<p>$ which java
/usr/bin/java
$ java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)</... | [
{
"answer_id": 492766,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 1,
"selected": false,
"text": "<p>Take a look at this line:</p>\n\n<pre><code>java.lang.UnsupportedClassVersionError: Bad version number in .class fi... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60311/"
] | I am trying to run Eclipse 3.4.1 on MacOS 10.5.6?
I think I am using java 1.5 when I run eclipse:
$ which java
/usr/bin/java
$ java -version
java version "1.5.0\_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0\_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0\_16-133, mixed mode, sharing)
And the... | Eclipse on Mac OS X on Intels only works with JDK 5 (it's horrible). I always have to create two versions of my plugins.
However, it seems that the Android editor plugin that you're using was compiled against 1.6, so I'm not sure that there's a solution... |
492,786 | <p>I'm working on a login page for my website and I want to bold the label that comes <strong>before</strong> the input box when the text box gains focus. Right now I have the following markup:</p>
<pre><code><label for="username">Username:</label>
<input type="textbox" id="username" />
<label fo... | [
{
"answer_id": 492828,
"author": "JayTee",
"author_id": 20153,
"author_profile": "https://Stackoverflow.com/users/20153",
"pm_score": 3,
"selected": false,
"text": "<p>There's no selector that will give you the previous element using CSS..</p>\n\n<p>You will need to use javascript to han... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] | I'm working on a login page for my website and I want to bold the label that comes **before** the input box when the text box gains focus. Right now I have the following markup:
```
<label for="username">Username:</label>
<input type="textbox" id="username" />
<label for="password">Password:</label>
<input type="text... | It would be possible to use the 'adjacent sibling selector' if the `input` was before the `label`. Just put the `input` before the `label`, and then modify the layout to put `label` before the `input`. Here's an example:
```
<head runat="server">
<title></title>
<style type="text/css">
input:focus + label ... |
492,799 | <p>When comparing two strings in c# for equality, what is the difference between InvariantCulture and Ordinal comparison?</p>
| [
{
"answer_id": 492885,
"author": "JaredReisinger",
"author_id": 60299,
"author_profile": "https://Stackoverflow.com/users/60299",
"pm_score": 9,
"selected": true,
"text": "<h2>InvariantCulture</h2>\n\n<p>Uses a \"standard\" set of character orderings (a,b,c, ... etc.). This is in contra... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45280/"
] | When comparing two strings in c# for equality, what is the difference between InvariantCulture and Ordinal comparison? | InvariantCulture
----------------
Uses a "standard" set of character orderings (a,b,c, ... etc.). This is in contrast to some specific locales, which may sort characters in different orders ('a-with-acute' may be before ***or*** after 'a', depending on the locale, and so on).
Ordinal
-------
On the other hand, looks... |
492,802 | <p>A static function <code>retUnique()</code> returns a unique value. My question is that if there are
many users who are using the same function at a given point of time, what happens? Is there a best practice to make sure that each users accessing this static function simultaneously get a unique value and also do no... | [
{
"answer_id": 492885,
"author": "JaredReisinger",
"author_id": 60299,
"author_profile": "https://Stackoverflow.com/users/60299",
"pm_score": 9,
"selected": true,
"text": "<h2>InvariantCulture</h2>\n\n<p>Uses a \"standard\" set of character orderings (a,b,c, ... etc.). This is in contra... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55428/"
] | A static function `retUnique()` returns a unique value. My question is that if there are
many users who are using the same function at a given point of time, what happens? Is there a best practice to make sure that each users accessing this static function simultaneously get a unique value and also do not face threadi... | InvariantCulture
----------------
Uses a "standard" set of character orderings (a,b,c, ... etc.). This is in contrast to some specific locales, which may sort characters in different orders ('a-with-acute' may be before ***or*** after 'a', depending on the locale, and so on).
Ordinal
-------
On the other hand, looks... |
492,822 | <p>I am wondering what type the 'value' keyword in a property takes.</p>
<p>so:</p>
<pre><code>public class Test
{
string _numberAsString;
int _number = -1;
public Test() {}
public string NumberAsString
{
get { return _numberAsString; }
set { _numberAsString= value; }
}
... | [
{
"answer_id": 492853,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, the type of 'value' is determined by the return type of the property. What exactly are you trying to accomplish?... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26463/"
] | I am wondering what type the 'value' keyword in a property takes.
so:
```
public class Test
{
string _numberAsString;
int _number = -1;
public Test() {}
public string NumberAsString
{
get { return _numberAsString; }
set { _numberAsString= value; }
}
public int Number
... | Yes, the type of 'value' is determined by the return type of the property. What exactly are you trying to accomplish? Do you want to be able to set either Number or NumberAsString to a valid value and get a result back out from either property?
If that's the case you need to do something like this:
```
public class T... |
492,833 | <p>How do you get the proper index of a selected input from a set of input elements with irregularly numbered indexes using JQuery? JQuery's "index" function always returns a value starting from 0 instead of the indexes I used. My code is below:</p>
<p>JQuery:</p>
<pre><code>$("input[name^=myboxes]").click(function... | [
{
"answer_id": 492866,
"author": "JayTee",
"author_id": 20153,
"author_profile": "https://Stackoverflow.com/users/20153",
"pm_score": 4,
"selected": true,
"text": "<p>The value of your ID does not have an \"index\" property. It's just a string.</p>\n\n<p>One suggestion: parse the id str... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30133/"
] | How do you get the proper index of a selected input from a set of input elements with irregularly numbered indexes using JQuery? JQuery's "index" function always returns a value starting from 0 instead of the indexes I used. My code is below:
JQuery:
```
$("input[name^=myboxes]").click(function() {
var elemen... | The value of your ID does not have an "index" property. It's just a string.
One suggestion: parse the id string to get your value:
```
$("input[name^=myboxes]").click(function() {
var element_id = $(this).attr('id');
//the initial starting point of the substring is based on "myboxes["
var ix = element_id.... |
492,838 | <p>I'm puzzled with this test script:</p>
<pre><code>#!perl
use strict;
use warnings;
use encoding 'utf8';
use Test::More 'no_plan';
ok('áá' =~ m/á/, 'ok direct match');
my $re = qr{á};
ok('áá' =~ m/$re/, 'ok qr-based match');
like('áá', $re, 'like qr-based match');
</code></pre>
<p>The three tests fail, but I wa... | [
{
"answer_id": 493019,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 2,
"selected": false,
"text": "<p>It works fine on my computer (on perl 5.10). Maybe you should try replacing that <code>use encoding 'utf8'</code>... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24579/"
] | I'm puzzled with this test script:
```
#!perl
use strict;
use warnings;
use encoding 'utf8';
use Test::More 'no_plan';
ok('áá' =~ m/á/, 'ok direct match');
my $re = qr{á};
ok('áá' =~ m/$re/, 'ok qr-based match');
like('áá', $re, 'like qr-based match');
```
The three tests fail, but I was expecting that the `use ... | **Do not** use the [`encoding` pragma](http://perldoc.perl.org/encoding.html). It’s broken. (Juerd Waalboer gave a great talk where he mentioned this at YAPC::EU 2k8.)
It does at least two things at once that do not belong together:
1. It specifies an encoding for your source file.
2. It specifies an encoding for you... |
492,860 | <p>i have:</p>
<pre><code>for i in range(2,n):
if(something):
do something
else:
do something else
i = 2 **restart the loop
</code></pre>
<p>But that doesn't seem to work. Is there a way to restart that loop? </p>
<p>Thanks</p>
| [
{
"answer_id": 492864,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": false,
"text": "<p>Changing the index variable <code>i</code> from within the loop is unlikely to do what you expect. You may need to use... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29505/"
] | i have:
```
for i in range(2,n):
if(something):
do something
else:
do something else
i = 2 **restart the loop
```
But that doesn't seem to work. Is there a way to restart that loop?
Thanks | You may want to consider using a different type of loop where that logic is applicable, because it is the most obvious answer.
perhaps a:
```
i=2
while i < n:
if something:
do something
i += 1
else:
do something else
i = 2 #restart the loop
``` |
492,865 | <p>I am trying to fire an event on the right and left arrow key presses with jQuery. Using the following code, I can fire events on any of the alphanumeric keys, but the cursor keys (up, down, left, right) fire nothing. I am developing the site primarily for IE users because it is a line of business app. Am I doing som... | [
{
"answer_id": 492873,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 7,
"selected": true,
"text": "<p><strong>e.which</strong> doesn't work in IE try <strong>e.keyCode</strong>, also you probably want to use keydown() inste... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] | I am trying to fire an event on the right and left arrow key presses with jQuery. Using the following code, I can fire events on any of the alphanumeric keys, but the cursor keys (up, down, left, right) fire nothing. I am developing the site primarily for IE users because it is a line of business app. Am I doing someth... | **e.which** doesn't work in IE try **e.keyCode**, also you probably want to use keydown() instead of keypress() if you are targeting IE.
See <http://unixpapa.com/js/key.html> for more information. |
492,872 | <p>How do I go about if I need to initialize an object's base with existing object? For example, in this scenario:</p>
<pre><code>public class A
{
public string field1;
public string field2;
}
public class B : A
{
public string field3;
public void Assign(A source)
{
this.base = source; // ... | [
{
"answer_id": 492886,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": false,
"text": "<p>No, the syntax you are trying is not possible. In C# .NET you need to do:</p>\n\n<pre><code>public void Assign(A source)... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14395/"
] | How do I go about if I need to initialize an object's base with existing object? For example, in this scenario:
```
public class A
{
public string field1;
public string field2;
}
public class B : A
{
public string field3;
public void Assign(A source)
{
this.base = source; // <-- will not w... | Unfortunately `base` is readonly.
[Edit]
Well perhaps not so unfortunate. The relationship between a base class and a child class is `IS-A` not `HAS-A`. By allowing a child class to change the instance of the base class you are allowing the child class to change its own reference since it `IS-A` base class. If you ... |
492,923 | <p>OK, so I'm just starting to think how to implement a new graphical plugin for Paint.NET and I will need to know how to find the most common integer in a 2d array of integers. Is there a built-in to C# way to do this? Or, does anyone have a slick way to do it?</p>
<p>The array will look something like this:</p>
<... | [
{
"answer_id": 492960,
"author": "Crashworks",
"author_id": 53543,
"author_profile": "https://Stackoverflow.com/users/53543",
"pm_score": 3,
"selected": false,
"text": "<p>It's at least O(n*m) any way you slice it -- you are going to have to look at each cell at least once. The place to ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20848/"
] | OK, so I'm just starting to think how to implement a new graphical plugin for Paint.NET and I will need to know how to find the most common integer in a 2d array of integers. Is there a built-in to C# way to do this? Or, does anyone have a slick way to do it?
The array will look something like this:
```
300 300 300 3... | Take a look at the LocalHistogramEffect code in Paint.NET, notably LocalHistorgramEffect.RenderRect.
I walks the input image, maintaining a histogram of intensities for each source pixel withing 'r' pixels of the destination pixel. As the output pixels are traversed, it adds the leading edge to the histogram and subtr... |
492,932 | <p>I just lost about an hour's of work when my computer crashed. Is there a timed autosave feature in Visual Studio 2008? </p>
<p>If yes, where is it configured.</p>
<p>It's probably obvious, but I'm not finding it.</p>
| [
{
"answer_id": 492944,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 4,
"selected": true,
"text": "<p>Tools / Options / Environment / AutoRecover </p>\n\n<p>?</p>\n\n<p>Seems that the backup files are in this fol... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10119/"
] | I just lost about an hour's of work when my computer crashed. Is there a timed autosave feature in Visual Studio 2008?
If yes, where is it configured.
It's probably obvious, but I'm not finding it. | Tools / Options / Environment / AutoRecover
?
Seems that the backup files are in this folder:
```
\...\My Documents\Visual Studio <version>\Backup Files\<projectname>
``` |
492,936 | <p>I'm looking for a free advanced dropdown list control. Basically something that provides a dropdown list which can have icons, and multiple bits of text per entry (preferably one large bit of text and then a smaller bit of text underneath).</p>
<p>Anyone know of such a control? I've had a look but can't seem to fin... | [
{
"answer_id": 492944,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 4,
"selected": true,
"text": "<p>Tools / Options / Environment / AutoRecover </p>\n\n<p>?</p>\n\n<p>Seems that the backup files are in this fol... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1912/"
] | I'm looking for a free advanced dropdown list control. Basically something that provides a dropdown list which can have icons, and multiple bits of text per entry (preferably one large bit of text and then a smaller bit of text underneath).
Anyone know of such a control? I've had a look but can't seem to find one.
If... | Tools / Options / Environment / AutoRecover
?
Seems that the backup files are in this folder:
```
\...\My Documents\Visual Studio <version>\Backup Files\<projectname>
``` |
492,952 | <p>I have a C# web service running on a separate server machine. I would like to be able to retrieve the client machine name when using a specific method on the web service. I have searched online and people have mentioned that this would be difficult to retrieve client machine names if the clients were connected to a ... | [
{
"answer_id": 492962,
"author": "Kevin Tighe",
"author_id": 39461,
"author_profile": "https://Stackoverflow.com/users/39461",
"pm_score": 2,
"selected": false,
"text": "<p>I don't think this is really possible. If the user is behind a router all you're going to get is whatever the rout... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44707/"
] | I have a C# web service running on a separate server machine. I would like to be able to retrieve the client machine name when using a specific method on the web service. I have searched online and people have mentioned that this would be difficult to retrieve client machine names if the clients were connected to a rou... | ```
HttpContext.Current.Request.UserHostAddress
HttpContext.Current.Request.UserHostName
``` |
492,966 | <p>I have an interesting problem that I'm unsure how best to solve. </p>
<p>I have JS scripts which contain the following:</p>
<pre><code> var obj = new namespace.MyObjectName("key", [12, 11, 22, 33, 454, 552, 222], [33, 22, 33, 11, 22, 222, 111]);
namespace.MyObjectName = function(keyName, data1, data2) {
... | [
{
"answer_id": 493006,
"author": "Kristian J.",
"author_id": 4588,
"author_profile": "https://Stackoverflow.com/users/4588",
"pm_score": 1,
"selected": false,
"text": "<p>Regarding (2), it's possible to run javascript in a sandbox by using an iframe, check out for instance Dean Edwards' ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52175/"
] | I have an interesting problem that I'm unsure how best to solve.
I have JS scripts which contain the following:
```
var obj = new namespace.MyObjectName("key", [12, 11, 22, 33, 454, 552, 222], [33, 22, 33, 11, 22, 222, 111]);
namespace.MyObjectName = function(keyName, data1, data2) {
this.myData1 = data1;... | Regarding (2), it's possible to run javascript in a sandbox by using an iframe, check out for instance Dean Edwards' [Sandbox.eval()](http://dean.edwards.name/weblog/2006/11/sandbox/) or the [Slickspeed Selectors Test](http://mootools.net/slickspeed/). |
492,967 | <p>I have set of scripts for doing scripted installs. You can use the scripts on any server 2008 machine. However, I need to check if .NET 3.5 has been installed (before the scripts run) using a dos batch file. Is that possible? </p>
<p>I know I can check if a file in the <code>C:\WINDOWS\Microsoft.NET\Framework\v... | [
{
"answer_id": 492996,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 5,
"selected": true,
"text": "<p>Unfortunately the best way would be to check for that directory. I am not sure what you mean but \"actually install... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have set of scripts for doing scripted installs. You can use the scripts on any server 2008 machine. However, I need to check if .NET 3.5 has been installed (before the scripts run) using a dos batch file. Is that possible?
I know I can check if a file in the `C:\WINDOWS\Microsoft.NET\Framework\v3.5` exists, but it... | Unfortunately the best way would be to check for that directory. I am not sure what you mean but "actually installed" as .NET 3.5 uses the same CLR as .NET 3.0 and .NET 2.0 so all new functionality is wrapped up in new assemblies that live in that directory. Basically, if the directory is there then 3.5 is installed.
... |
492,977 | <p>I have a server set up with IIS, and my site has some pages which should allow anonymous access and some pages which should require the "Integrated Windows authentication". On the Authentication Method screen in IIS it looks like you can enable both "Integrated Windows Authentication" and anonymous access, but the ... | [
{
"answer_id": 492993,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 3,
"selected": true,
"text": "<p>You have to use the <a href=\"http://msdn.microsoft.com/en-us/library/8d82143t(v=vs.100).aspx\" rel=\"nofollow nor... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/466/"
] | I have a server set up with IIS, and my site has some pages which should allow anonymous access and some pages which should require the "Integrated Windows authentication". On the Authentication Method screen in IIS it looks like you can enable both "Integrated Windows Authentication" and anonymous access, but the docu... | You have to use the [authorization section in web.config](http://msdn.microsoft.com/en-us/library/8d82143t(v=vs.100).aspx).
To make only specific folders require authentication, you can have web.config with only the authorization element in subfolders like so:
```
<configuration>
<system.web>
<authorization>... |
492,992 | <p>I'd like to get the objects that are updated in the last 10 seconds from the ActiveRecord's find. </p>
<p>I tried doing this</p>
<pre><code>@chats = Chat.find(:all, :conditions => ["updated_at > ?", 10.seconds.ago] )
</code></pre>
<p>as well as</p>
<pre><code>@chats = Chat.find(:all, :conditions => ["up... | [
{
"answer_id": 493226,
"author": "Scott Miller",
"author_id": 43962,
"author_profile": "https://Stackoverflow.com/users/43962",
"pm_score": 3,
"selected": true,
"text": "<p>Are you sure that you are querying on the right column? I am thinking that you might need to look at the created_a... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47937/"
] | I'd like to get the objects that are updated in the last 10 seconds from the ActiveRecord's find.
I tried doing this
```
@chats = Chat.find(:all, :conditions => ["updated_at > ?", 10.seconds.ago] )
```
as well as
```
@chats = Chat.find(:all, :conditions => ["updated_at > ?", Time.now-10.seconds] )
```
and even ... | Are you sure that you are querying on the right column? I am thinking that you might need to look at the created\_at timestamp instead. I don't know your application, but I am surprised you are updating existing chats, instead of just inserting new ones.
So... if my assumption is correct, this might be what you are lo... |
492,994 | <p>Can someone suggest a way to compare the values of <strong>two dates</strong> greater than, less than, and not in the past using JavaScript? The values will be coming from text boxes.</p>
| [
{
"answer_id": 493008,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "<pre><code>var date = new Date(); // will give you todays date.\n\n// following calls, will let you set new dates.\nsetDate() ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/492994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41508/"
] | Can someone suggest a way to compare the values of **two dates** greater than, less than, and not in the past using JavaScript? The values will be coming from text boxes. | The [Date object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) will do what you want - construct one for each date, then compare them using the `>`, `<`, `<=` or `>=`.
The `==`, `!=`, `===`, and `!==` operators require you to use `date.getTime()` as in
```
var d1 = new Date()... |
493,000 | <p>i'd like to read binary data from a blob, using the Stream interface around it.</p>
<p>But i don't want the blob to have to be loaded entirely client side and stored in memory, or in a file. </p>
<p>i want the code that uses the blob to be able to seek and read, and only as much data that is needed to support seek... | [
{
"answer_id": 493056,
"author": "Seibar",
"author_id": 357,
"author_profile": "https://Stackoverflow.com/users/357",
"pm_score": 0,
"selected": false,
"text": "<p>You will want to use ADO.NET's <code>SqlDataReader</code> object with the <code>SequentialAccess</code> CommandBehavior. Thi... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | i'd like to read binary data from a blob, using the Stream interface around it.
But i don't want the blob to have to be loaded entirely client side and stored in memory, or in a file.
i want the code that uses the blob to be able to seek and read, and only as much data that is needed to support seek/read is brought ... | With newer versions of SQL Server you can just use plain SQL with the SUBSTRING() function on binary data types as well as text.
See <http://msdn.microsoft.com/en-us/library/ms187748.aspx>
To get the size of the image:
```
select datalength(blobcolumn) from myimages where imgid = 12345;
```
To read the first 8 byte... |
493,010 | <p>Is there an equivalent of</p>
<pre><code>PRINT 'hello world'
</code></pre>
<p>which can be called from CLR (C#) code?</p>
<p>I'm trying to output some debug information in my function. I can't run the VS debugger because this is a remote server.</p>
<p>Thanks!</p>
| [
{
"answer_id": 493023,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 3,
"selected": false,
"text": "<p>You should just be able to do:</p>\n\n<pre><code>SqlContext.Pipe.Send(\"hello world\");\n</code></pre>\n\n<p>If you... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47693/"
] | Is there an equivalent of
```
PRINT 'hello world'
```
which can be called from CLR (C#) code?
I'm trying to output some debug information in my function. I can't run the VS debugger because this is a remote server.
Thanks! | The answer is that you cannot do the equivalent of
```
PRINT 'Hello World'
```
from inside a `[SqlFunction()]`. You can do it however from a `[SqlProcedure()]` using
```
SqlContext.Pipe.Send("hello world")
```
This is consistent with T-SQL, where you would get the error "Invalid use of a side-effecting operator '... |
493,028 | <p>Problem in running Junit tests in eclipse 3.4.1 on Mac OS</p>
<p>I am getting this error:
'Lanuching AllTests' has encountered a problem.
Cannot connect to VM.</p>
<pre>
!ENTRY org.eclipse.core.net 1 0 2009-01-29 10:07:44.047
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.25
4/16|*.... | [
{
"answer_id": 494712,
"author": "guerda",
"author_id": 32043,
"author_profile": "https://Stackoverflow.com/users/32043",
"pm_score": 0,
"selected": false,
"text": "<p>Eclipse and JUnit communicate via IPC (Inter Process Communication). Here, you're using android with a specific virtual ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60311/"
] | Problem in running Junit tests in eclipse 3.4.1 on Mac OS
I am getting this error:
'Lanuching AllTests' has encountered a problem.
Cannot connect to VM.
```
!ENTRY org.eclipse.core.net 1 0 2009-01-29 10:07:44.047
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.25
4/16|*.169.254/16 by a... | This is what I did that solved my problem (Eclipse on MacOSX Lion):
* Go to project properties->Java Build Path->Libraries
* Add JRE System Library
* Go to Order and Export tab, move JRE System Library up to top.
Hope it helps. |
493,033 | <p>I have the following text:</p>
<pre><code><i><b>It is noticeably faster.</b></i> <i><b>They take less disk space.</i>
</code></pre>
<p>And the following regex:</p>
<pre><code>(</[b|i|u]>)+(\s*)(<[b|i|u]>)+
</code></pre>
<p>The matching creates the following g... | [
{
"answer_id": 493051,
"author": "Brian",
"author_id": 18192,
"author_profile": "https://Stackoverflow.com/users/18192",
"pm_score": 1,
"selected": false,
"text": "<p>You can't. A group can only hold one thing, even if it hits more than one thing in the same match because of a +, *, or ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508/"
] | I have the following text:
```
<i><b>It is noticeably faster.</b></i> <i><b>They take less disk space.</i>
```
And the following regex:
```
(</[b|i|u]>)+(\s*)(<[b|i|u]>)+
```
The matching creates the following groups:
```
0: </b></i> <b><i>
1: </i>
2: spaces
3: <b>
```
How can I change my regex so it creates... | I suspect you've already got what you need - you just need to enumerate the captures for each group. Here's a sample program showing that in action:
```
using System;
using System.Text.RegularExpressions;
class Test
{
static void Main()
{
string text =
"<i><b>It is noticeably faster.</b></i> <i><b>Th... |
493,046 | <p>I am a newbie to Python and have come across the following example in my book that is not explained very well. Here is my print out from the interpreter:</p>
<pre><code>>>> s = 'spam'
>>> s[:-1]
'spa'
</code></pre>
<p>Why does slicing with no beginning bound and a <code>'-1'</code> return every e... | [
{
"answer_id": 493057,
"author": "Redwood",
"author_id": 1512,
"author_profile": "https://Stackoverflow.com/users/1512",
"pm_score": 6,
"selected": true,
"text": "<p>Yes, calling <code>s[0:-1]</code> is exactly the same as calling <code>s[:-1]</code>.</p>\n\n<p>Using a negative number as... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14723/"
] | I am a newbie to Python and have come across the following example in my book that is not explained very well. Here is my print out from the interpreter:
```
>>> s = 'spam'
>>> s[:-1]
'spa'
```
Why does slicing with no beginning bound and a `'-1'` return every element except the last one? Is calling `s[0:-1]` logica... | Yes, calling `s[0:-1]` is exactly the same as calling `s[:-1]`.
Using a negative number as an index in python returns the nth element from the right-hand side of the list (as opposed to the usual left-hand side).
so if you have a list as so:
```
myList = ['a', 'b', 'c', 'd', 'e']
print myList[-1] # prints 'e'
```
... |
493,052 | <p>In managed C++/CLI, I could do this either as (1):</p>
<pre><code>array<System::Byte>^ css_keycode = {0x51, 0x67, 0x67, 0xc5, 0xe0, 0x00};
</code></pre>
<p>or (2):</p>
<pre><code>array<System::Byte>^ css_keycode;
css_keycode = gcnew array<System::Byte>(6) {0x51, 0x67, 0x67, 0xc5, 0xe0, 0x00};
<... | [
{
"answer_id": 493072,
"author": "Tobias Wärre",
"author_id": 21097,
"author_profile": "https://Stackoverflow.com/users/21097",
"pm_score": 0,
"selected": false,
"text": "<p>It seems like if you want to initialize an array like that </p>\n\n<pre><code>(array = {elem1, elem2,etc})\n</code... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22329/"
] | In managed C++/CLI, I could do this either as (1):
```
array<System::Byte>^ css_keycode = {0x51, 0x67, 0x67, 0xc5, 0xe0, 0x00};
```
or (2):
```
array<System::Byte>^ css_keycode;
css_keycode = gcnew array<System::Byte>(6) {0x51, 0x67, 0x67, 0xc5, 0xe0, 0x00};
```
But I apparently can't do (3):
```
array<System::... | You have to differ between initialization and assignment. It's like Tobias Wärre said in his post.
You can't do (3) because assingnment does not work with the *initialization brackets*.
(4) does work because you ardinarly assign the new values to your array.
Actually the following should work:
```
public ref class dec... |
493,090 | <p>Anyone have a regex to strip lat/long from a string? such as:</p>
<p>ID: 39.825 -86.88333</p>
| [
{
"answer_id": 493101,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 3,
"selected": false,
"text": "<p>To match one value</p>\n\n<pre><code>-?\\d+\\.\\d+\n</code></pre>\n\n<p>For both values:</p>\n\n<pre><code>(-?\\d+\\.\\d+... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51695/"
] | Anyone have a regex to strip lat/long from a string? such as:
ID: 39.825 -86.88333 | ```
var latlong = 'ID: 39.825 -86.88333';
var point = latlong.match( /-?\d+\.\d+/g );
//result: point = ['39.825', '-86.88333'];
``` |
493,098 | <p>I am trying to construct a sql select statement that does the following:</p>
<pre><code>SELECT GetDate() Mon, GetDate() Tues
</code></pre>
<p>But I also want to be able to put WHERE restrictions on each column (Mon, Tues). So I want something like this, but it is not correct:</p>
<pre><code>SELECT (GetDate() Mon... | [
{
"answer_id": 493103,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": 0,
"selected": false,
"text": "<pre><code>SELECT (select GetDate() Mon WHERE (1=1)), (select GetDate() Tues WHERE (1=1))\n</code></pre>\n"
},
{
"answ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55057/"
] | I am trying to construct a sql select statement that does the following:
```
SELECT GetDate() Mon, GetDate() Tues
```
But I also want to be able to put WHERE restrictions on each column (Mon, Tues). So I want something like this, but it is not correct:
```
SELECT (GetDate() Mon WHERE (1=1)), (GetDate() TuesWHERE (1... | With column names:
```
select
(select getDate() where (1=1)) Mon,
(select getDate() where (2=2)) Tues
``` |
493,102 | <p>For some reason Eclipse doesn't remember source lookup path for some java projects, and every time during debugging (after redeploying) I need to press "Edit source lookup path" button and add current project to the list.</p>
<p>Does anyone know how to make it remember selected source location?</p>
<p><strong>EDIT... | [
{
"answer_id": 493205,
"author": "Yoni",
"author_id": 36071,
"author_profile": "https://Stackoverflow.com/users/36071",
"pm_score": 4,
"selected": true,
"text": "<p>Try looking at the Run/Debug configuration for what you are executing, and check the source tab. You can add elements manua... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20128/"
] | For some reason Eclipse doesn't remember source lookup path for some java projects, and every time during debugging (after redeploying) I need to press "Edit source lookup path" button and add current project to the list.
Does anyone know how to make it remember selected source location?
**EDIT:**
It is a tomcat proj... | Try looking at the Run/Debug configuration for what you are executing, and check the source tab. You can add elements manually, but that is really not recommended.
The elements in the source tab are based on the classpath of the project containing the element that you run. In the case of running tomcat, the source pat... |
493,109 | <p>I'm trying to get string data from a web service and populate a thickbox with this data. I feel like this should be the easiest part of the task but so far this is where I'm stuck.</p>
<p>Here is the code in question...</p>
<pre><code>
function AjaxRequestHandler(layerName) {
PageMethods.AjaxRequestHandler(la... | [
{
"answer_id": 493158,
"author": "slf",
"author_id": 13263,
"author_profile": "https://Stackoverflow.com/users/13263",
"pm_score": 1,
"selected": false,
"text": "<p>The thickbox just displays the content that it wraps. I haven't tried it, but if you give the <a href and id=\"myupdata... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49294/"
] | I'm trying to get string data from a web service and populate a thickbox with this data. I feel like this should be the easiest part of the task but so far this is where I'm stuck.
Here is the code in question...
```
function AjaxRequestHandler(layerName) {
PageMethods.AjaxRequestHandler(layerName, OnSucceeded);... | Solved it! What you said slf was the basic gist of what needed to be done. However, I needed to dig into the ThickBox CSS and find the actual class that was the body that would hold the Ajax data and inject that with the string. So this is the line of code I really needed.
```
$("#TB_ajaxContent").html(result);
```
W... |
493,117 | <p>I want to show an image from a URL and I want that image to have a given size but I want to maintain the ratio between height and width.</p>
| [
{
"answer_id": 493139,
"author": "Mike Robinson",
"author_id": 43687,
"author_profile": "https://Stackoverflow.com/users/43687",
"pm_score": 3,
"selected": false,
"text": "<p>CSS:</p>\n\n<pre><code>img {\n width: 30%;\n height: auto;\n}\n</code></pre>\n\n<p>Something like this?</p>\n"
... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41385/"
] | I want to show an image from a URL and I want that image to have a given size but I want to maintain the ratio between height and width. | CSS:
```
img {
width: 30%;
height: auto;
}
```
Something like this? |
493,119 | <p>I am testing a simple query to get data from an AS400 database. <strong>I am not sure if the way I am using the SQL query is correct.</strong> </p>
<p>I get an error: "The parameter is incorrect."</p>
<pre><code>Select FIELD1, FIELD2 From Mylibrary.MyTable WHERE FIELD1 = @Field1
</code></pre>
<p>I don't get an er... | [
{
"answer_id": 493213,
"author": "Paul Morgan",
"author_id": 16322,
"author_profile": "https://Stackoverflow.com/users/16322",
"pm_score": 1,
"selected": false,
"text": "<p>Picflight,</p>\n\n<p>You might have connected using the <a href=\"http://publib.boulder.ibm.com/iseries/v5r2/ic2924... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59941/"
] | I am testing a simple query to get data from an AS400 database. **I am not sure if the way I am using the SQL query is correct.**
I get an error: "The parameter is incorrect."
```
Select FIELD1, FIELD2 From Mylibrary.MyTable WHERE FIELD1 = @Field1
```
I don't get an error when I run the following query:
```
Selec... | Ok, I got the solution by playing around and trying different things.
As I said before, I am used to OLEDB and ADO.Net so I am used to doing things like:
```
Select FIELD1, FIELD2 From Mylibrary.MyTable WHERE FIELD1 = @Field1
```
which work in Access and SQL Server but not in AS/400.
I got the following to work:
... |
493,132 | <p>Is there any way to enable execution-time variable expansion for cmd.exe (normally done by typing <code>cmd /V:ON</code>) without starting a new instance of cmd.exe?</p>
<p>Similarly, can other settings/flags be changed on the fly?</p>
| [
{
"answer_id": 493171,
"author": "Blorgbeard",
"author_id": 369,
"author_profile": "https://Stackoverflow.com/users/369",
"pm_score": 4,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>setlocal enabledelayedexpansion\n</code></pre>\n\n<p>There's also</p>\n\n<pre><code>setlocal ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21475/"
] | Is there any way to enable execution-time variable expansion for cmd.exe (normally done by typing `cmd /V:ON`) without starting a new instance of cmd.exe?
Similarly, can other settings/flags be changed on the fly? | Try this:
```
setlocal enabledelayedexpansion
```
There's also
```
setlocal enableextensions
```
which is the equivalent of `cmd /E:ON`.
Reference: `setlocal /?`. |
493,174 | <p>I need to convert <code>one</code> into <code>1</code>, <code>two</code> into <code>2</code> and so on.</p>
<p>Is there a way to do this with a library or a class or anything?</p>
| [
{
"answer_id": 493250,
"author": "Jeff Bauer",
"author_id": 41759,
"author_profile": "https://Stackoverflow.com/users/41759",
"pm_score": 3,
"selected": false,
"text": "<p>Here's the trivial case approach:</p>\n\n<pre><code>>>> number = {'one':1,\n... 'two':2,\n... ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to convert `one` into `1`, `two` into `2` and so on.
Is there a way to do this with a library or a class or anything? | The majority of this code is to set up the numwords dict, which is only done on the first call.
```
def text2int(textnum, numwords={}):
if not numwords:
units = [
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen",... |
493,175 | <p>I'm working on some JQuery to hide/show some content when I click a link. I can create something like:</p>
<pre><code><a href="#" onclick="jquery_stuff" />
</code></pre>
<p>But if I click that link while I'm scrolled down on a page, it will jump back up to the top of the page.</p>
<p>If I do something like:... | [
{
"answer_id": 493182,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 7,
"selected": true,
"text": "<p>Put a \"return false;\" on the second option:</p>\n\n<pre><code><a href=\"\" onclick=\"jquery_stuff; return fals... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12624/"
] | I'm working on some JQuery to hide/show some content when I click a link. I can create something like:
```
<a href="#" onclick="jquery_stuff" />
```
But if I click that link while I'm scrolled down on a page, it will jump back up to the top of the page.
If I do something like:
```
<a href="" onclick="jquery_stuff"... | Put a "return false;" on the second option:
```
<a href="" onclick="jquery_stuff; return false;" />
``` |
493,209 | <p>The following code executes properly when the data key has no data to send, i.e. data: "{}" an empty JSON object and the webservice takes no parameters. I would like to post some data to the webservice but I am running into trouble.</p>
<p>When I try to set this to data:"{'name':'Niall','surname':'Smith'}", I get ... | [
{
"answer_id": 493257,
"author": "Chetan S",
"author_id": 31284,
"author_profile": "https://Stackoverflow.com/users/31284",
"pm_score": 2,
"selected": false,
"text": "<p>This should work. You should pass json as a string, with a parameter name 'json' (which is the same as parameter name ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5197/"
] | The following code executes properly when the data key has no data to send, i.e. data: "{}" an empty JSON object and the webservice takes no parameters. I would like to post some data to the webservice but I am running into trouble.
When I try to set this to data:"{'name':'Niall','surname':'Smith'}", I get an error
`... | I think the webservice expects the parameter `json` to be set. Try this AJAX call :
```
var data = {'name':'niall'};
$.ajax({
type: "POST",
url: "/WebServices/BasketServices.asmx/AddItemToBasket",
data: "json=" + JSON.stringify(data),
contentType: "application/json; charset=utf-8",
dataType: "json... |
493,219 | <p>I would like to use the scrolling/panning functionality of the UIScrollView but I would like to handle all the zooming and scaling myself. My current plan is to have a viewController that owns a UIView (I'll call it view1) with multiple UIViews and UIScrollViews as children.</p>
<p>Is it possible for view1 to handl... | [
{
"answer_id": 513608,
"author": "Brad Larson",
"author_id": 19679,
"author_profile": "https://Stackoverflow.com/users/19679",
"pm_score": 2,
"selected": false,
"text": "<p>You can indeed have the main hosting view intercept multitouch events and do scaling of the underlying UIViews prog... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60353/"
] | I would like to use the scrolling/panning functionality of the UIScrollView but I would like to handle all the zooming and scaling myself. My current plan is to have a viewController that owns a UIView (I'll call it view1) with multiple UIViews and UIScrollViews as children.
Is it possible for view1 to handle all mult... | Thanks for your suggestion brad. the solution I ended up using was to extend UIScrollView and override the touchesMoved:withEvent: method with this:
```
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([[event touchesForView:self] count] == 1)
[super touchesMoved:touches withEvent:ev... |
493,223 | <p>I have a problem where my table stores the date as</p>
<pre><code>2009-01-10 10:00:00.000
</code></pre>
<p>and I have another table which stores the date as</p>
<pre><code>2009-01-10 12:00:00.000
</code></pre>
<p>I know they are not the same but the dates are, is there away in SQL to easily drop the time and kee... | [
{
"answer_id": 493229,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 3,
"selected": false,
"text": "<p>Look <a href=\"https://stackoverflow.com/questions/202243/custom-date-time-formatting-in-sql-server/202288#202288\">... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55057/"
] | I have a problem where my table stores the date as
```
2009-01-10 10:00:00.000
```
and I have another table which stores the date as
```
2009-01-10 12:00:00.000
```
I know they are not the same but the dates are, is there away in SQL to easily drop the time and keep just the dates for comparison? Thanks. | Run this
```
SELECT DATEADD(dd, DATEDIFF(d, 0, Getdate()), 0)
```
change Getdate() to your column name to strip the date
BTW if you are doing a comparison it is better to do >= and < since it will perform better |
493,232 | <p>What is the proper CSS syntax for applying multiple pseudo classes to a selector. I'd like to insert "," after each item in a list except the last one. I am using the following css:</p>
<pre><code>ul.phone_numbers li:after {
content: ",";
}
ul.phone_numbers li:last-child:after {
content: "";
}
</code></p... | [
{
"answer_id": 493265,
"author": "roborourke",
"author_id": 42147,
"author_profile": "https://Stackoverflow.com/users/42147",
"pm_score": 1,
"selected": false,
"text": "<p>IE8 doesn't support last-child :( They're focused on sorting out CSS 2.1 support it looks like. Why microsoft haven'... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43816/"
] | What is the proper CSS syntax for applying multiple pseudo classes to a selector. I'd like to insert "," after each item in a list except the last one. I am using the following css:
```
ul.phone_numbers li:after {
content: ",";
}
ul.phone_numbers li:last-child:after {
content: "";
}
```
This works fine on F... | `:last-child` is a pseudo-class, whereas `:after` (or `::after` in CSS3) is a pseudo-element.
To quote [the standard](http://www.w3.org/TR/CSS21/selector.html#pseudo-classes):
>
> Pseudo-classes are allowed anywhere in selectors while pseudo-elements may only be appended after the last simple selector of the selecto... |
493,233 | <p>I have a question about the meaning (evaluation) of Boolean variables in return statements in Java.</p>
<p>I know that:</p>
<pre><code>if (var) { ... }
</code></pre>
<p>is the same as:</p>
<pre><code>if (var==true) { ... }
</code></pre>
<p>In the second case we explicitly say var==true, but we don't need to do ... | [
{
"answer_id": 493256,
"author": "Rob Hruska",
"author_id": 29995,
"author_profile": "https://Stackoverflow.com/users/29995",
"pm_score": 4,
"selected": false,
"text": "<p>It's not an \"implicit assumption,\" it's what the compiler's doing. The <code>b < a</code> is just an expression... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42155/"
] | I have a question about the meaning (evaluation) of Boolean variables in return statements in Java.
I know that:
```
if (var) { ... }
```
is the same as:
```
if (var==true) { ... }
```
In the second case we explicitly say var==true, but we don't need to do this, because Java evaluates var as true anyway. I hope ... | It's not an "implicit assumption," it's what the compiler's doing. The `b < a` is just an expression, the same as if it were used for an `if` statement. The expression evaluates to a `boolean`, which is then returned.
Also noteworthy, you seem to interchange `boolean` and `Boolean` as though they're the same, but they... |
493,236 | <p>I'm wondering what is the best practice for moving a website to another server (along with all settings, etc.)</p>
<ul>
<li>Manually recreate the site on the new server (not maintainable for obvious reasons)</li>
<li>Copy the applicationHost.config settings file</li>
<li>Use appcmd to make a backup and restore</li>... | [
{
"answer_id": 493373,
"author": "chews",
"author_id": 33966,
"author_profile": "https://Stackoverflow.com/users/33966",
"pm_score": 8,
"selected": true,
"text": "<p>I'd say export your server config in IIS manager:</p>\n\n<ol>\n<li>In IIS manager, click the Server node</li>\n<li>Go to S... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109/"
] | I'm wondering what is the best practice for moving a website to another server (along with all settings, etc.)
* Manually recreate the site on the new server (not maintainable for obvious reasons)
* Copy the applicationHost.config settings file
* Use appcmd to make a backup and restore
* Use MSDeploy to publish the si... | I'd say export your server config in IIS manager:
1. In IIS manager, click the Server node
2. Go to Shared Configuration under "Management"
3. Click “Export Configuration”. (You can use a password if you are sending them across the internet, if you are just gonna move them via a USB key then don't sweat it.)
4. Move t... |
493,239 | <p>For a game I'm trying to determine the frequency that a certain # will show up at a given # of dice being rolled. I know... that question seems odd. Let me try to explain it with real numbers.</p>
<p>So, for 1 die, the frequency for each number will be identical. 1-6 will show up equal number of times.</p>
<p>Now ... | [
{
"answer_id": 493263,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 4,
"selected": false,
"text": "<p>There are 6*6 = 36 combinations for two dice.</p>\n\n<p>2 = 1+1 can only appear once, so its frequency is 1/36.\n3 = 1+... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36620/"
] | For a game I'm trying to determine the frequency that a certain # will show up at a given # of dice being rolled. I know... that question seems odd. Let me try to explain it with real numbers.
So, for 1 die, the frequency for each number will be identical. 1-6 will show up equal number of times.
Now for 2 dice, thing... | Rough draft of a recursive way to do it:
```
public static IEnumerable<KeyValuePair<int, int>> GetFrequenciesByOutcome(int nDice, int nSides)
{
int maxOutcome = (nDice * nSides);
Dictionary<int, int> outcomeCounts = new Dictionary<int, int>();
for(int i = 0; i <= maxOutcome; i++)
outcomeCounts[i] =... |
493,244 | <p>Can someone help me figure out the following make file?</p>
<pre><code>BINS=file1 file2 file3
all: $(BINS)
clean:
rm -f $(BINS) *~
$*: $@.c
gcc -g -o $@ $?
</code></pre>
<p>Here are my questions:</p>
<ol>
<li>What is the -g option of gcc?</li>
<li>What are $* and $@</li>
<li>How does it know ... | [
{
"answer_id": 493268,
"author": "nicerobot",
"author_id": 23056,
"author_profile": "https://Stackoverflow.com/users/23056",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://www.gnu.org/software/make/manual/make.html\" rel=\"nofollow noreferrer\">The GNU Make Manual</a></p>... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40825/"
] | Can someone help me figure out the following make file?
```
BINS=file1 file2 file3
all: $(BINS)
clean:
rm -f $(BINS) *~
$*: $@.c
gcc -g -o $@ $?
```
Here are my questions:
1. What is the -g option of gcc?
2. What are $\* and $@
3. How does it know to execute the last target?
Thanks! | From the `gcc` and `make` documentation:
1. "-g Produce debugging information in the operating system's native format".
2. a. "$\* The stem with which an implicit rule matches (see How Patterns Match). If the target is dir/a.foo.b and the target pattern is a.%.b then the stem is dir/foo. The stem is useful for constru... |
493,245 | <p>I am working on a site, and everything is working in my local environment as well as on a test server I have here and everything works fine. <em>but</em> when I upload it to my host, nothing seems to work!?</p>
<p>The Asp.Net javascript validators fire, but any and all of the jquery is not working? I even put in ... | [
{
"answer_id": 493255,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "<pre><code><script src=\"/jquery.js\" type=\"text/javascript\"></script>\n</code></pre>\n\n... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14777/"
] | I am working on a site, and everything is working in my local environment as well as on a test server I have here and everything works fine. *but* when I upload it to my host, nothing seems to work!?
The Asp.Net javascript validators fire, but any and all of the jquery is not working? I even put in a simple
```
$("#... | my host did not default to have .js in their MIME types, so I had to add it in:
```
extension: .js
application/x-javascript
``` |
493,285 | <p>I've created in my CoreData app an entity with some attributes. Imagine a tableview and a bound NSArrayController. With both I create (and edit) my entity "instances". My question is how I can get the values of these attributes to my code. If there are more questions: <a href="http://twitter.com/xP_ablo" rel="nofoll... | [
{
"answer_id": 496069,
"author": "Abizern",
"author_id": 41116,
"author_profile": "https://Stackoverflow.com/users/41116",
"pm_score": 1,
"selected": false,
"text": "<p>If I have this correct, you have a TableView, bound to an NSArrayController which is bound to your data.</p>\n\n<p>The ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59518/"
] | I've created in my CoreData app an entity with some attributes. Imagine a tableview and a bound NSArrayController. With both I create (and edit) my entity "instances". My question is how I can get the values of these attributes to my code. If there are more questions: <http://twitter.com/xP_ablo> | You need to somehow get a reference to the NSArrayController. If you are loading the NIB yourself, you can add an IBOutlet instance to the class that is set as the NIBs "File Owner". When you load a nib, you supply the instance of the NIB's "File Owner" class as the owner. If you are not loading the NIB yourself (i.e. ... |
493,296 | <p>I want to show an image from an URL with a certain width and height even if it has a different size ratio.
So I want to resize (maintaining the ratio) and then cut the image to the size I want.
<p>
I can resize with html <code>img</code> property and I can cut with <code>background-image</code>.
<br>
How can I do b... | [
{
"answer_id": 493314,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 1,
"selected": false,
"text": "<p>You can put the img tag in a div tag and do both, but I would recommend against scaling images in the browser. It ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41385/"
] | I want to show an image from an URL with a certain width and height even if it has a different size ratio.
So I want to resize (maintaining the ratio) and then cut the image to the size I want.
I can resize with html `img` property and I can cut with `background-image`.
How can I do both?
Example:
This image:
![e... | You could use a combination of both methods eg.
```css
.crop {
width: 200px;
height: 150px;
overflow: hidden;
}
.crop img {
width: 400px;
height: 300px;
margin: -75px 0 0 -100px;
}
```
```html
<div class="crop">
<img src="https://i... |
493,323 | <p>is it possible to change the selected item in a winforms application using c# UI automation (same logic as UIspy.exe)? I would like to change the selected item to a specific item (I know it's index/position in the list).</p>
| [
{
"answer_id": 3695386,
"author": "sizu",
"author_id": 444815,
"author_profile": "https://Stackoverflow.com/users/444815",
"pm_score": 2,
"selected": false,
"text": "<pre><code> public static void ActionSelectComboBoxItem(AutomationElement comboBoxElement, int indexToSelect){\n ... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38438/"
] | is it possible to change the selected item in a winforms application using c# UI automation (same logic as UIspy.exe)? I would like to change the selected item to a specific item (I know it's index/position in the list). | ```
public static void ActionSelectComboBoxItem(AutomationElement comboBoxElement, int indexToSelect){
if(comboBoxElement == null)
throw new Exception("Combo Box not found");
//Get the all the list items in the ComboBox
AutomationElementCollection comboboxItem = comboBoxElement.... |
493,334 | <p>I'm designing a RESTful Web app that will provide an authentication system for several other apps. The other apps will query this app through HTTP and get back XML describing authenticated users.</p>
<p>The authentication app needs to keep track of <strong>which users</strong> are allowed to <strong>do what</strong... | [
{
"answer_id": 493389,
"author": "Ian Jacobs",
"author_id": 22818,
"author_profile": "https://Stackoverflow.com/users/22818",
"pm_score": 0,
"selected": false,
"text": "<p>Personally I tend to err on the side of normalization. At least in my experience some kind of additional modules ge... | 2009/01/29 | [
"https://Stackoverflow.com/questions/493334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] | I'm designing a RESTful Web app that will provide an authentication system for several other apps. The other apps will query this app through HTTP and get back XML describing authenticated users.
The authentication app needs to keep track of **which users** are allowed to **do what** on **which applications.**
I'm wo... | The schema looks sane,
You would send
`<login><username>abc</username><password>xyz</password><app>51</app></login>`
and you get back
`<auth>
<user>
<username>abc</a>
<lastlogin>123456464</lastlogin>
</user>
<app>
<name>Equipment Inventory</name>
<version>3.1.5e</version>
</app>
<roles>
<role>admin</role>
<role>ma... |