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 |
|---|---|---|---|---|---|---|
546,492 | <p>I've an issue with a project I try to deliver using the <a href="http://one-jar.sourceforge.net/" rel="nofollow noreferrer">one-jar</a> packager to simplify the deployment process.<br>
Without the packaging, everything works fine and the logging configuration is perfectly loaded, but within the packaging, only part ... | [
{
"answer_id": 546582,
"author": "Nick Fortescue",
"author_id": 5346,
"author_profile": "https://Stackoverflow.com/users/5346",
"pm_score": 1,
"selected": false,
"text": "<p>It could be in your jars you have more than one logging.properties file, with similar but slightly different setti... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9396/"
] | I've an issue with a project I try to deliver using the [one-jar](http://one-jar.sourceforge.net/) packager to simplify the deployment process.
Without the packaging, everything works fine and the logging configuration is perfectly loaded, but within the packaging, only part of the configuration is appied.
So, here... | Use `LogManager.getLogManager().readConfiguration(LogManager.class.getResourceAsStream("/logging.debug.properties"));`
(note the extra slash). |
546,497 | <p>I am having trouble setting up the configuration of Spring.Net so that I can use Rhino Mocks to generate a mock object. I realise that GenerateMock is a static method and so I need to use the factory-method in the config, but I just can't get it to work. This is the configuration I am using:</p>
<pre><code><obje... | [
{
"answer_id": 549603,
"author": "Erich Eichinger",
"author_id": 51264,
"author_profile": "https://Stackoverflow.com/users/51264",
"pm_score": 3,
"selected": true,
"text": "<p>Actually you only specify the typename but not the assembly name in the generics argument. It should better read... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60551/"
] | I am having trouble setting up the configuration of Spring.Net so that I can use Rhino Mocks to generate a mock object. I realise that GenerateMock is a static method and so I need to use the factory-method in the config, but I just can't get it to work. This is the configuration I am using:
```
<object id="exampleObj... | Actually you only specify the typename but not the assembly name in the generics argument. It should better read
```
factory-method="GenerateMock<[MyNamespace.MyInterface, MyAssembly]>"
```
Note the square brackets to quote the full qualified typename and you need to grab a recent nightly build.
The full qualifie... |
546,505 | <p>I'd like to be able to start with a year, and calculate occurrences of Friday the 13th. A brute force solution is easy and obvious. I have something slightly better, but I have no doubt that someone else can come up with an elegant algorithm for this.</p>
<p>Perhaps a little trickier, I'd be interested in giving ... | [
{
"answer_id": 546538,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 1,
"selected": false,
"text": "<pre><code>initialize startDate to 13th of the month given in the current year\nwhile (true) {\n if (startDate.dayOfWeek =... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] | I'd like to be able to start with a year, and calculate occurrences of Friday the 13th. A brute force solution is easy and obvious. I have something slightly better, but I have no doubt that someone else can come up with an elegant algorithm for this.
Perhaps a little trickier, I'd be interested in giving the program ... | Any month that starts with a Sunday has a Friday on the thirteenth. There are only 14 combinations possible knowing what day the first of the year is on (with or without leap year, and sun-sat). You should just calculate it once and get it over with. You'd only check 14\*12 possible months to start out with, well with ... |
546,508 | <p>Is it possible to split a file? For example you have huge wordlist, I want to split it so that it becomes more than one file. How is this possible? </p>
| [
{
"answer_id": 546535,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 2,
"selected": false,
"text": "<p>Sure it's possible:</p>\n\n<pre><code>open input file\nopen output file 1\ncount = 0\nfor each line in file:\n ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65122/"
] | Is it possible to split a file? For example you have huge wordlist, I want to split it so that it becomes more than one file. How is this possible? | This one splits a file up by newlines and writes it back out. You can change the delimiter easily. This can also handle uneven amounts as well, if you don't have a multiple of splitLen lines (20 in this example) in your input file.
```
splitLen = 20 # 20 lines per file
outputBase = 'output' # output.1.txt, out... |
546,517 | <p>Our enterprise app currently uses Json.js I downloaded the JQuery js file, included it in a page that uses json and I started getting Javascript errors in the json.js file. The error is:</p>
<pre><code>Microsoft JScript runtime error: Object doesnt suppor this propety or method
</code></pre>
<p>Is this a known iss... | [
{
"answer_id": 546559,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 0,
"selected": false,
"text": "<p>I use the json2.js file from <a href=\"http://json.org\" rel=\"nofollow noreferrer\">http://json.org</a> and the jQuer... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Our enterprise app currently uses Json.js I downloaded the JQuery js file, included it in a page that uses json and I started getting Javascript errors in the json.js file. The error is:
```
Microsoft JScript runtime error: Object doesnt suppor this propety or method
```
Is this a known issue?
EDIT:
I am not sure ... | Looks as though Json.js does use $ as a variable name. In these cases you need to use [JQuery's noconflict function](http://docs.jquery.com/Core/jQuery.noConflict). Basically you have to put the JQuery script tag above the Json script tag and call noconflict on jquery before the Json library gets loaded. One nice featu... |
546,546 | <p>Somebody please help me by modying this code.when i retrieve the Login value through stored procedure call, i am getting this error message "Procedure or function 'GetUserLogin' expects parameter '@UserName', which was not supplied."
Here is my code:</p>
<pre><code>public int GetLogin(string UserName, string Passwo... | [
{
"answer_id": 546576,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 0,
"selected": false,
"text": "<p>Add this before you fill the dataset</p>\n\n<p><code>cmd.Parameters.AddWithValue(\"UserName\",UserName);</code></p>\n... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59637/"
] | Somebody please help me by modying this code.when i retrieve the Login value through stored procedure call, i am getting this error message "Procedure or function 'GetUserLogin' expects parameter '@UserName', which was not supplied."
Here is my code:
```
public int GetLogin(string UserName, string Password)
{
... | You need to add a UserName parameter to your command. Do something like this after you create your command, but before you execute it:
```
com.Parameters.Add("@UserName", SqlDbType.VarChar, 50);
com.Parameters["@UserName"].Value = UserName;
``` |
546,556 | <p>I have a ASP.NET MVC page of Events of a specific day. I'm also using jQuery datepicker and when I select a day, I create a function that send this selected day via <strong>Ajax</strong> to a MVC ActionResult method and this method will treat this day, will do all the database stuff and will return me all the Events... | [
{
"answer_id": 546578,
"author": "Jarrett Meyer",
"author_id": 5834,
"author_profile": "https://Stackoverflow.com/users/5834",
"pm_score": 0,
"selected": false,
"text": "<p>It has to do with the path. When you reference your scripts, be sure to use <% Url.Content(\"~/path/to/script\")... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60286/"
] | I have a ASP.NET MVC page of Events of a specific day. I'm also using jQuery datepicker and when I select a day, I create a function that send this selected day via **Ajax** to a MVC ActionResult method and this method will treat this day, will do all the database stuff and will return me all the Events of this selecte... | Add your mouseover/click event handlers again on ajaxComplete. jQuery selectors don't always work on document elements that are added dynamically to the page, like those returned from an AJAX call.
This code re-binds your event right after content population:
```
$.get("/getMyContent/" + eventID, "{}", function(conte... |
546,583 | <p>I'm having this weird situation : </p>
<p>My user's and system's PATH variable is different than the PATH in powershell.</p>
<p>When I do :</p>
<pre><code>PS C:\$env:path
C:\Windows\System32\WindowsPowerShell\v1.0\;c:\oldpath
</code></pre>
<p>However this is not correct, it looks like it stuck on some old PATH v... | [
{
"answer_id": 547075,
"author": "zdan",
"author_id": 4304,
"author_profile": "https://Stackoverflow.com/users/4304",
"pm_score": 7,
"selected": true,
"text": "<p>The change might be \"delayed\", so try one or more of these solutions:</p>\n\n<ul>\n<li><strong>Log off and on</strong> agai... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40322/"
] | I'm having this weird situation :
My user's and system's PATH variable is different than the PATH in powershell.
When I do :
```
PS C:\$env:path
C:\Windows\System32\WindowsPowerShell\v1.0\;c:\oldpath
```
However this is not correct, it looks like it stuck on some old PATH variable of my system, so none of the udp... | The change might be "delayed", so try one or more of these solutions:
* **Log off and on** again;
* Task Manager > **Restart "Windows Explorer"** (explorer.exe)
* **Restart your launcher app** (launchy, SlickRun, etc)
* **Reboot**
**Explanation:**
Powershell will inherit the environment of the process that launche... |
546,586 | <p>Given the type:</p>
<pre><code>class Field{
public string Name{get;set;}
public string[] DependsOn{get;set;}
}
</code></pre>
<p>Let's say I have an array of <code>Field</code> items:</p>
<pre><code>List<Field> fields = new List<Field>();
fields.Add(new Field() { Name = "FirstName" });
fields.A... | [
{
"answer_id": 546617,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 2,
"selected": false,
"text": "<p>Sounds like you need to sort these items in topological order. There are loads of pages on the web, probably Wikipedia is... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61525/"
] | Given the type:
```
class Field{
public string Name{get;set;}
public string[] DependsOn{get;set;}
}
```
Let's say I have an array of `Field` items:
```
List<Field> fields = new List<Field>();
fields.Add(new Field() { Name = "FirstName" });
fields.Add(new Field() { Name = "FullName",
... | Thanks for the tip Grzenio
I actually found something similar in java at <http://www.java2s.com/Code/Java/Collections-Data-Structure/Topologicalsorting.htm>
Below is the C# adaptation:
```
class Class1
{
public static void Run()
{
doTopologicalTest();
}
private static void doTopologicalTest()... |
546,588 | <p>I know the basic principles about memory management (retain count, autorelease pools etc) in Cocoa, but once you go past simple retain/release, it's getting a bit more confusing. I couldn't find decent answers for those, as most tutorials cover simple scenarios. I would like to ask about best practices in how to wri... | [
{
"answer_id": 546622,
"author": "epatel",
"author_id": 842,
"author_profile": "https://Stackoverflow.com/users/842",
"pm_score": 1,
"selected": false,
"text": "<p>@1st question</p>\n\n<p>You only get a reference to the object in the objectArray. It is still in the objectArray which also... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57157/"
] | I know the basic principles about memory management (retain count, autorelease pools etc) in Cocoa, but once you go past simple retain/release, it's getting a bit more confusing. I couldn't find decent answers for those, as most tutorials cover simple scenarios. I would like to ask about best practices in how to write ... | 1st question - iterations and temporary assigments
==================================================
You should NOT be releasing the objects here since you are not an owner. You should only ever release an object if you are an owner of it. See the [Memory Management Guide for Cocoa](http://developer.apple.com/documen... |
546,590 | <p>I've a problem!</p>
<p>I've a </p>
<pre><code>List <List<Class>> L = new List<List<Class>>();
</code></pre>
<p>where Class contains</p>
<pre><code>IDLinea
Posizione
</code></pre>
<p>And so on...</p>
<p>I want to have a Distinct <code>List<List<Class>></code> Where there are ... | [
{
"answer_id": 546628,
"author": "Bogdan Gavril MSFT",
"author_id": 21634,
"author_profile": "https://Stackoverflow.com/users/21634",
"pm_score": 0,
"selected": false,
"text": "<ol>\n<li>Use a List</li>\n<li>Have your class ovveride Equals. </li>\n<li>Use the Contains method of the list... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61589/"
] | I've a problem!
I've a
```
List <List<Class>> L = new List<List<Class>>();
```
where Class contains
```
IDLinea
Posizione
```
And so on...
I want to have a Distinct `List<List<Class>>` Where there are no objects with same lines.
For example:
```
List <List<Class>> L = new List<List<Class>>();
var A = new Li... | Edited based on your further explanation
```
enum LineComparisonMode
{
///<summary>the order of the line numbers matters, default</summary>
Ordered = 0,
///<summary>the order of the line numbers doesn't matter
/// Has a higher cost to the default.
///</summary>
Unordered = 1,
}
class ListLineComp... |
546,596 | <p>... and thanks for reading...</p>
<p>I'm still learning the ropes so please be forgiving... ;-) </p>
<p>I am writing a function that meshes a solid in space. The mesh is done by using objects of a "Node" class and each node is represented by:</p>
<pre><code>int id
double p
double r
</code></pre>
<p>Initially I t... | [
{
"answer_id": 546619,
"author": "ShuggyCoUk",
"author_id": 12748,
"author_profile": "https://Stackoverflow.com/users/12748",
"pm_score": 3,
"selected": false,
"text": "<p>As with any \"what should I use to represent this structure\" question it does really depend on <strong>how you want... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ... and thanks for reading...
I'm still learning the ropes so please be forgiving... ;-)
I am writing a function that meshes a solid in space. The mesh is done by using objects of a "Node" class and each node is represented by:
```
int id
double p
double r
```
Initially I thought that a map would be the way to go... | A map<> won't work. C++ associative containers work on the basis of key equality, and comparing floating-point numbers for equality doesn't work at all well.
It sounds like you need to find a node, given x and y. The best way will depend on what you're trying to accomplish. Are you trying to find the nearest node, giv... |
546,608 | <p>In a database I use throughout several projects, there is a field that should actually be a boolean but is for reasons nobody can explain to me a field duplicated over two tables where one time it is a char ('Y'/'N') and one time an int (1/0).
When I generate a datacontext with LinqToSql the fields off course gets t... | [
{
"answer_id": 546625,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 0,
"selected": false,
"text": "<p>Just create a property to translate the char value into a boolean, you can use this to get and set the char value based ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | In a database I use throughout several projects, there is a field that should actually be a boolean but is for reasons nobody can explain to me a field duplicated over two tables where one time it is a char ('Y'/'N') and one time an int (1/0).
When I generate a datacontext with LinqToSql the fields off course gets thes... | Right-clicking and selecting "Properties" of the property in the LINQ-To-Sql designer will allow you to alter the visibility. Next, you can provide an implementation with your desired logic in your partial class. |
546,616 | <p>Consider the following SQL Server 2005/2008 query:</p>
<pre><code>Select [UID], [DESC] From SomeTable Order By [Desc];
</code></pre>
<p>If Desc is a fairly long field (Varchar(125) with many entries > 70 chars) and you don't need a strict sorting, would it would be more efficient to do this:</p>
<pre><code>Select... | [
{
"answer_id": 546630,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think so. Calling the function will cause the most damage to the performance in this case. And yes, functi... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15592/"
] | Consider the following SQL Server 2005/2008 query:
```
Select [UID], [DESC] From SomeTable Order By [Desc];
```
If Desc is a fairly long field (Varchar(125) with many entries > 70 chars) and you don't need a strict sorting, would it would be more efficient to do this:
```
Select [UID], [DESC] From SomeTable Order B... | Use of a `non-clustered index` implies an implicit `JOIN`.
The index itself does not contain the non-indexed values, it contains only references to the `TABLE`'s blocks.
To get the non-indexed values, you need to scan over the index and read from these blocks in a nested loop.
As a rule of thumb, `INDEX SCAN WITH TA... |
546,624 | <p>If I have to create a domain model object in C# I might do something like this:</p>
<pre><code>public class Person
{
Public string Name { get; set; }
Public string Gender { get; set; }
Public int Age { get; set; }
}
</code></pre>
<p>In Javascript, what is the convention for defining such objects? I'm t... | [
{
"answer_id": 546714,
"author": "Allen Rice",
"author_id": 49885,
"author_profile": "https://Stackoverflow.com/users/49885",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there is much of a \"convention\" but you can declare \"private\" variables and Crockford shows you ho... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18170/"
] | If I have to create a domain model object in C# I might do something like this:
```
public class Person
{
Public string Name { get; set; }
Public string Gender { get; set; }
Public int Age { get; set; }
}
```
In Javascript, what is the convention for defining such objects? I'm thinking something like thi... | Yeah, spot on basically. The only thing to add is that you should **prototype methods** on. How you proto can be situational to the design, I generally prefer to do this internally to the class, but flagged so it only runs when required, and only the once.
```
NAMESPACE.Person = function() {
this.name = "";
th... |
546,634 | <p>Bit stuck about how to go about this one. Given the current month, I need to to return the date of the fourth saturday of each month.</p>
<p>e.g. This month would be Feb 20th, next would be March 27th. </p>
<p>Thanks</p>
| [
{
"answer_id": 546654,
"author": "Devin Jeanpierre",
"author_id": 18515,
"author_profile": "https://Stackoverflow.com/users/18515",
"pm_score": 2,
"selected": false,
"text": "<p>Find the first Saturday of the month, and then add three weeks to that.</p>\n\n<p>If you don't know when the f... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45350/"
] | Bit stuck about how to go about this one. Given the current month, I need to to return the date of the fourth saturday of each month.
e.g. This month would be Feb 20th, next would be March 27th.
Thanks | I'm not a PHP coder, however, it seems strtotime is what you're after.
You can use strtotime("fourth Saturday") and it will return the 4th saturday.
Check out the [`strtotime`](http://php.net/strtotime) docs.
EDIT:
Just to make the answer complete, thanks to Tom and Paul Dixon
```
date('dS F',strtotime('Fourth Sat... |
546,655 | <p>How can I find (iterate over) ALL the cycles in a directed graph from/to a given node?</p>
<p>For example, I want something like this:</p>
<pre><code>A->B->A
A->B->C->A
</code></pre>
<p>but not:
B->C->B</p>
| [
{
"answer_id": 546694,
"author": "Brian",
"author_id": 18192,
"author_profile": "https://Stackoverflow.com/users/18192",
"pm_score": 1,
"selected": false,
"text": "<p>Start at node X and check for all child nodes (parent and child nodes are equivalent if undirected). Mark those child no... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7305/"
] | How can I find (iterate over) ALL the cycles in a directed graph from/to a given node?
For example, I want something like this:
```
A->B->A
A->B->C->A
```
but not:
B->C->B | I found this page in my search and since cycles are not same as strongly connected components, I kept on searching and finally, I found an efficient algorithm which lists all (elementary) cycles of a directed graph. It is from Donald B. Johnson and the paper can be found in the following link:
<http://www.cs.tufts.edu... |
546,660 | <p>I have a DropDownList populated from a LINQ query. As per the design requirements of this project, I need to append 4 " " to the DDL's ListItem.Text.</p>
<p>It works when I add the ListItems manually like so:</p>
<pre><code><asp:ListItem Value="NULL">&nsbp;&nsbp;&nsbp;&nsbp;Select One&l... | [
{
"answer_id": 546842,
"author": "James",
"author_id": 56753,
"author_profile": "https://Stackoverflow.com/users/56753",
"pm_score": 1,
"selected": true,
"text": "<p>The only thing that I can think to do is sub-class the dropdownlist control and override the render method and see if you ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48943/"
] | I have a DropDownList populated from a LINQ query. As per the design requirements of this project, I need to append 4 " " to the DDL's ListItem.Text.
It works when I add the ListItems manually like so:
```
<asp:ListItem Value="NULL">&nsbp;&nsbp;&nsbp;&nsbp;Select One</asp:ListItem>
```
but not when I DataBind() and... | The only thing that I can think to do is sub-class the dropdownlist control and override the render method and see if you can't circumvent the trimming that the base dropdownlist control is doing on its items collection.
If sub-classing is too much work, then use some client side Javascript code to update those items... |
546,701 | <p>I am debugging some Linux C code in a signal handler for floating point exceptions. The goal is to check the floating point registers, print some information, and then abort. I get a segmentation fault when attempting to printf the result of <code>(char)('0' + phyreg)</code>.</p>
<pre><code>struct ucontext * uc... | [
{
"answer_id": 546711,
"author": "Antti Huima",
"author_id": 64376,
"author_profile": "https://Stackoverflow.com/users/64376",
"pm_score": 4,
"selected": true,
"text": "<p>You are printing with %s. Should be \" FP %c: Mantissa = %s\".</p>\n"
},
{
"answer_id": 546720,
"author... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6688/"
] | I am debugging some Linux C code in a signal handler for floating point exceptions. The goal is to check the floating point registers, print some information, and then abort. I get a segmentation fault when attempting to printf the result of `(char)('0' + phyreg)`.
```
struct ucontext * uc = (struct ucontext *) data... | You are printing with %s. Should be " FP %c: Mantissa = %s". |
546,702 | <p>Sorry if this is the most seen question on the web, but this is my turn. I am trying to publish my asp.net mvc app on IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I get the following classical error:</p>
<blockquote>
<p>A network-related or instance-specific
error occurred whil... | [
{
"answer_id": 546715,
"author": "Robert C. Barth",
"author_id": 9209,
"author_profile": "https://Stackoverflow.com/users/9209",
"pm_score": 2,
"selected": false,
"text": "<p>Make sure you have TCP/IP set up as a transport in your SQL Server configuration tool.</p>\n"
},
{
"answe... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29244/"
] | Sorry if this is the most seen question on the web, but this is my turn. I am trying to publish my asp.net mvc app on IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I get the following classical error:
>
> A network-related or instance-specific
> error occurred while establishing a
> ... | Thanks guys for the try. I found the solution and it is related to an info that I forgot to give. I hope it can help someone as new as me on these things.
I use NHibernate, and the connection string is actually in the nhibernate.cfg.xml file. The one in the web.config file is actually used by my various providers (use... |
546,754 | <p>I've got a layout bug that shows up in IE6, and <strong>I'm trying to come up with a way to give some clues to this content in our content area so that it won't drop down below the navigation menu.</strong> Sadly, while this would probably be relatively easy to fix if I could redesign the whole page, I can't do that... | [
{
"answer_id": 546807,
"author": "montrealist",
"author_id": 65232,
"author_profile": "https://Stackoverflow.com/users/65232",
"pm_score": 1,
"selected": false,
"text": "<p>I'd say it's hopeless if you can't get to the 565px div, because that's what's not positioning itself inline with t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57120/"
] | I've got a layout bug that shows up in IE6, and **I'm trying to come up with a way to give some clues to this content in our content area so that it won't drop down below the navigation menu.** Sadly, while this would probably be relatively easy to fix if I could redesign the whole page, I can't do that...it's a live s... | I can't see any way of correcting this using only CSS. IE6's wrapping calculation is going to be preformed in such a way that unless the main content area is expanded, the content will be moved under the menu. I don't know if this will work within your constraints, but a bit of code like this will correct it visually.
... |
546,774 | <p>I am trying to get a build going for a client that pulls from VSS 2005 (yes, I have no choice). I am pretty sure I have all my configuration correct, but I keep getting this error:</p>
<blockquote>
<p>Source control operation failed: $/Utilities/Orbital Gateway/Solution Architecture/Release Construction/Payment S... | [
{
"answer_id": 547388,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": 1,
"selected": false,
"text": "<p>The ss.exe is the SourceSafe executable on the build server since it will do a checkout before building the... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to get a build going for a client that pulls from VSS 2005 (yes, I have no choice). I am pretty sure I have all my configuration correct, but I keep getting this error:
>
> Source control operation failed: $/Utilities/Orbital Gateway/Solution Architecture/Release Construction/Payment Subsystem/Services/Pa... | The ss.exe is the SourceSafe executable on the build server since it will do a checkout before building the sources. The docs state that you can omit this if VSS is running on the same machine as the build server.
>
> The location of SS.EXE. If VSS is installed on the integration server, the location of VSS will be r... |
546,791 | <p>The html documentation generated by doxygen for enums lists the enum to the left and the documentation to the right. However I need quite detailed documentation for each value and some of the names are very long thus making the right column with the documentation appear far out to the right and it looks very bad. Is... | [
{
"answer_id": 581362,
"author": "mouviciel",
"author_id": 45249,
"author_profile": "https://Stackoverflow.com/users/45249",
"pm_score": 0,
"selected": false,
"text": "<p>With doxygen 1.5.5, I didn't succeed in reproducing the behaviour you describes. I get an enum documentation similar ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11722/"
] | The html documentation generated by doxygen for enums lists the enum to the left and the documentation to the right. However I need quite detailed documentation for each value and some of the names are very long thus making the right column with the documentation appear far out to the right and it looks very bad. Is th... | I'm using Doxygen 1.7.5.1. I had a similar situation... I had a enumeration of about 1000 or so members that I was generating from a spreadsheet. I wanted the integer value to be off to the right, with the Doxygen bit above the member.
All I did was use the triple slash above the member name. For multi-line comments, ... |
546,792 | <p>In PHP is it better to convert a value to an integer using the syntax</p>
<pre><code>(int)$value
</code></pre>
<p>or</p>
<pre><code>intval($value)
</code></pre>
<p>the question is also be relevant to string, bool, float</p>
| [
{
"answer_id": 581362,
"author": "mouviciel",
"author_id": 45249,
"author_profile": "https://Stackoverflow.com/users/45249",
"pm_score": 0,
"selected": false,
"text": "<p>With doxygen 1.5.5, I didn't succeed in reproducing the behaviour you describes. I get an enum documentation similar ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In PHP is it better to convert a value to an integer using the syntax
```
(int)$value
```
or
```
intval($value)
```
the question is also be relevant to string, bool, float | I'm using Doxygen 1.7.5.1. I had a similar situation... I had a enumeration of about 1000 or so members that I was generating from a spreadsheet. I wanted the integer value to be off to the right, with the Doxygen bit above the member.
All I did was use the triple slash above the member name. For multi-line comments, ... |
546,804 | <p>I have 5 columns corresponding to answers in a trivia game database - right, wrong1, wrong2, wrong3, wrong4</p>
<p>I want to return all possible answers without duplicates. I was hoping to accomplish this without using a temp table. Is it possible to use something similar to this?:</p>
<pre><code>select c1, c2, ... | [
{
"answer_id": 546821,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 1,
"selected": false,
"text": "<p>Is this what you wanted?</p>\n\n<p><code>select distinct c1 from t</code></p>\n"
},
{
"answer_id": 546822,
... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55124/"
] | I have 5 columns corresponding to answers in a trivia game database - right, wrong1, wrong2, wrong3, wrong4
I want to return all possible answers without duplicates. I was hoping to accomplish this without using a temp table. Is it possible to use something similar to this?:
```
select c1, c2, count(*)
from t
group b... | This should give you all distinct values from the table. I presume you'd want to add where clauses to select only for a particular question. However, this solution requires 5 subqueries and can be slow if your table is huge.
```
SELECT DISTINCT(ans) FROM (
SELECT right AS ans FROM answers
UNION
SELECT wron... |
546,817 | <p>I have two lists of equal length, with no spaces in the individual items:</p>
<pre><code>list1="a b c"
list2="1 2 3"
</code></pre>
<p>I want to iterate over these two lists in parallel, pairing a with 1, b with 2, etc.:</p>
<pre><code>a 1
b 2
c 3
</code></pre>
<p>I'm attempting to support modern portable Bourne ... | [
{
"answer_id": 546972,
"author": "jj33",
"author_id": 430,
"author_profile": "https://Stackoverflow.com/users/430",
"pm_score": 1,
"selected": false,
"text": "<p>NEVERMIND, SAW \"BOURNE\" and thought \"BOURNE AGAIN\". Leaving this here because it might be useful for someone, but clearly... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12089/"
] | I have two lists of equal length, with no spaces in the individual items:
```
list1="a b c"
list2="1 2 3"
```
I want to iterate over these two lists in parallel, pairing a with 1, b with 2, etc.:
```
a 1
b 2
c 3
```
I'm attempting to support modern portable Bourne shell, so Bash/ksh arrays aren't available. Shell... | This is a bit hacky but does the job:
```
#!/bin/sh
list1="1 2 3"
list2="a b c"
while [ -n "$list1" ]
do
head1=`echo "$list1" | cut -d ' ' -f 1`
list1=`echo "$list1" | sed 's/[^ ]* *\(.*\)$/\1/'`
head2=`echo "$list2" | cut -d ' ' -f 1`
list2=`echo "$list2" | sed 's/[^ ]* *\(.*\)$/\1/'`
echo $head1 ... |
546,818 | <p>I want to allow my users to toggle the current user theme between <a href="https://en.wikipedia.org/wiki/Windows_Aero" rel="noreferrer">Aero</a> and Windows Classic(1). Is there a way that I can do this programatically?</p>
<p>I don't want to pop up the "Display properties", and I'm dubious about just changing the ... | [
{
"answer_id": 546873,
"author": "Factor Mystic",
"author_id": 1569,
"author_profile": "https://Stackoverflow.com/users/1569",
"pm_score": 1,
"selected": false,
"text": "<p>I believe the best you can do is open your target .msstyles file (in <code>c:\\windows\\resources\\themes</code>), ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726/"
] | I want to allow my users to toggle the current user theme between [Aero](https://en.wikipedia.org/wiki/Windows_Aero) and Windows Classic(1). Is there a way that I can do this programatically?
I don't want to pop up the "Display properties", and I'm dubious about just changing the registry. (This requires a log out and... | You can set it using the following command:
```
rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:"C:\Windows\Resources\Themes\aero.theme"
```
Caveat is that this will show the theme selector dialog. You could kill that dialog straight a... |
546,829 | <p>I have a MySQL indexing question for you guys.</p>
<p>I've got a very large table (~100Million Records) in MySQL that contains information about files. Most of the Queries I do on it involve substring operations on the file path column. </p>
<p>Here's the table ddl:</p>
<pre><code>CREATE TABLE `filesystem_data`.`... | [
{
"answer_id": 546852,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 3,
"selected": true,
"text": "<p>You cannot use indices with your current table design.</p>\n\n<p>You may add a column called <code>USERNAME</code>, fil... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17785/"
] | I have a MySQL indexing question for you guys.
I've got a very large table (~100Million Records) in MySQL that contains information about files. Most of the Queries I do on it involve substring operations on the file path column.
Here's the table ddl:
```
CREATE TABLE `filesystem_data`.`$tablename` (
... | You cannot use indices with your current table design.
You may add a column called `USERNAME`, fill it in the `INSERT/UPDATE` trigger with the expression you use in `SELECT`, and search on this column.
**P. S.** Just curious, you really have `100 mln+` files on your server? |
546,847 | <pre><code>-(id)init {
if (self = [super init]) {
self.name = [[NSString alloc] init];
self.type = [[NSString alloc] init];
self.phoneNumber = [[NSString alloc]init];
self.webAddress = [[NSString alloc] init];
NSMutableArray *pricesArray = [[NSMutableArray alloc] init];
... | [
{
"answer_id": 546883,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 1,
"selected": false,
"text": "<p>How are your properties declared? If they are not declared with <code>retain</code> then most of your objects will ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51420/"
] | ```
-(id)init {
if (self = [super init]) {
self.name = [[NSString alloc] init];
self.type = [[NSString alloc] init];
self.phoneNumber = [[NSString alloc]init];
self.webAddress = [[NSString alloc] init];
NSMutableArray *pricesArray = [[NSMutableArray alloc] init];
N... | You're leaking objects with each allocation for the string properties. Other than that, I don't notice anything wrong. How are the AddressXKeys defined? |
546,854 | <p>Can someone explain this OOP javascript structure?</p>
<p>I realize it is how you create 'objects' in javascript, just need some explanation on the notation and what it means:</p>
<pre><code> var vote = function(){
return {
P1: function() {
alert('P1');
},
... | [
{
"answer_id": 546888,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 5,
"selected": true,
"text": "<pre><code>var vote = function(){\n var privateMember = 3; // lets define a private member, this will only be avail... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | Can someone explain this OOP javascript structure?
I realize it is how you create 'objects' in javascript, just need some explanation on the notation and what it means:
```
var vote = function(){
return {
P1: function() {
alert('P1');
},
P2: function() {
... | ```
var vote = function(){
var privateMember = 3; // lets define a private member, this will only be available inside the function scope, so we can't do "vote.privateMember" because we're not returning it below
// It's returning an object, {}
// these are considered public because they are returned by the ... |
546,860 | <p>Given the following code:</p>
<pre><code>void
foo( int* array )
{
// ...
}
void
bar( int** matrix )
{
// ...
}
int
main( void ) {
int array[ 10 ];
int matrix[ 10 ][ 10 ];
foo( array );
bar( matrix );
return 0;
}
</code></pre>
<p>I don't understand why I get this warning:</p>
<blo... | [
{
"answer_id": 546872,
"author": "kmkaplan",
"author_id": 50902,
"author_profile": "https://Stackoverflow.com/users/50902",
"pm_score": 2,
"selected": false,
"text": "<p>You should define bar as:</p>\n\n<pre><code>bar( int* matrix )\n</code></pre>\n\n<p>In C all arrays should be passed a... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1679/"
] | Given the following code:
```
void
foo( int* array )
{
// ...
}
void
bar( int** matrix )
{
// ...
}
int
main( void ) {
int array[ 10 ];
int matrix[ 10 ][ 10 ];
foo( array );
bar( matrix );
return 0;
}
```
I don't understand why I get this warning:
>
> warning: passing argument 1 o... | Well, it's certainly not well understood by the C community as can be seen by glancing over SO. The magic is, **all of the following are totally, 100%, equivalent**:
```
void foo(int (*array)[10]);
void foo(int array[][10]);
void foo(int array[10][10]);
void foo(int array[42][10]);
```
It is *very* important to draw... |
546,861 | <p>I have create a Membership provider and changed my web.config to </p>
<pre><code><membership defaultProvider="MyMembershipProvider">
<providers>
<clear/>
<add name="MyMembershipProvider"
type="Khafan.Providers.SqlMembershipProvider"
connectionStringName="KhafanC... | [
{
"answer_id": 546894,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 5,
"selected": true,
"text": "<p>This is because you are hashing passwords but haven't set specific keys in your web.config. There's a \"key gener... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34623/"
] | I have create a Membership provider and changed my web.config to
```
<membership defaultProvider="MyMembershipProvider">
<providers>
<clear/>
<add name="MyMembershipProvider"
type="Khafan.Providers.SqlMembershipProvider"
connectionStringName="KhafanConnectionString"
maxInv... | This is because you are hashing passwords but haven't set specific keys in your web.config. There's a "key generator" snippet in this [MSDN article](http://msdn.microsoft.com/en-us/library/ms998288.aspx), run it twice and shove them in your web.config as:
```
<system.web>
<machineKey
validationKey="<blah>" ... |
546,863 | <p>I'm trying to create a function which will add an overlay to a thumbnail image when you hover over it and remove the overlay when you leave it. Here is my HTML...</p>
<pre><code><div class="thumb"><img src="i/testThumb.gif" /></div>
</code></pre>
<p>And here is my jQuery...</p>
<pre><code>$('.th... | [
{
"answer_id": 546889,
"author": "Rich",
"author_id": 53501,
"author_profile": "https://Stackoverflow.com/users/53501",
"pm_score": 0,
"selected": false,
"text": "<p>This might sound a little hacky, but you can use a variable (in the case of a dom element, I'd use a css class) to know if... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56007/"
] | I'm trying to create a function which will add an overlay to a thumbnail image when you hover over it and remove the overlay when you leave it. Here is my HTML...
```
<div class="thumb"><img src="i/testThumb.gif" /></div>
```
And here is my jQuery...
```
$('.thumb').live('mouseover', function(event){
if($(this)... | I you put one more div into the mix, I think you may find what you are looking for.
```
<style>
.hover { display:none;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".image").hover(
function(over)... |
546,869 | <p>in a c++ class declaration, you can label a group of members as private or public, e.g.</p>
<pre><code>private:
int x;
double y;
</code></pre>
<p>seems like there's no way to do this in c#. am I wrong?</p>
| [
{
"answer_id": 546880,
"author": "mrtaikandi",
"author_id": 34623,
"author_profile": "https://Stackoverflow.com/users/34623",
"pm_score": 1,
"selected": false,
"text": "<p>No you're not wrong. If you don't write any modifiers it will be assumed as private.</p>\n"
},
{
"answer_id"... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | in a c++ class declaration, you can label a group of members as private or public, e.g.
```
private:
int x;
double y;
```
seems like there's no way to do this in c#. am I wrong? | No, you can't not do this in C#.
At best, you can use the default visibility for members, which is private, and not use private, but for public, you have to indicate it for all members. |
546,879 | <p>Is there a way to update multiple rows with different values for each row using a single SQL query? I have to update one colum in many rows with different data. Using individual update queries for each row seems excessive so if it's possible I would like to consolidate this process into a single SQL statement or at ... | [
{
"answer_id": 546914,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": true,
"text": "<p>Create a temporary table and fill it with:</p>\n\n<pre><code>CREATE TEMPORARY TABLE temptable (id INTEGER, VALUE VARCHA... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63371/"
] | Is there a way to update multiple rows with different values for each row using a single SQL query? I have to update one colum in many rows with different data. Using individual update queries for each row seems excessive so if it's possible I would like to consolidate this process into a single SQL statement or at lea... | Create a temporary table and fill it with:
```
CREATE TEMPORARY TABLE temptable (id INTEGER, VALUE VARCHAR(200))
INSERT
INTO temptable
VALUES
('1', 'val1'),
('2', 'val2'),
('3', 'val3'),
('4', 'val4')
```
Then issue:
```
UPDATE
mytable m, temptable t
SET m.value = t.value
WHERE m.id = t.id
``` |
546,899 | <p>I would like to have my error handling code behave differently if it is running under the debugger. Specifically, if I am running on a handset, not attached to a debugger and fail an assertion I want to send the error to my server. When I am under gdb, I want to break into the debugger.</p>
<p>Although I can imagin... | [
{
"answer_id": 546915,
"author": "sfossen",
"author_id": 64657,
"author_profile": "https://Stackoverflow.com/users/64657",
"pm_score": 1,
"selected": false,
"text": "<p>Why not redefine assert to do what you want, when not compiled for debug?</p>\n\n<p>Another option, is to create your o... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9827379/"
] | I would like to have my error handling code behave differently if it is running under the debugger. Specifically, if I am running on a handset, not attached to a debugger and fail an assertion I want to send the error to my server. When I am under gdb, I want to break into the debugger.
Although I can imagine how Appl... | The method described [here](http://lists.apple.com/archives/Xcode-users/2004/Feb/msg00241.html) worked fine for me
I tested by placing it in `-(void)viewDidLoad`
```
- (void)viewDidLoad {
[super viewDidLoad];
int mib[4];
size_t bufSize = 0;
int local_error = 0;
struct kinfo_proc kp;
mib[0] =... |
546,905 | <p>It seems that the only way to add an <code>onPaste</code> event to an input element is to use HTML:</p>
<pre><code><textarea id="text_area" onpaste="on_paste" />
</code></pre>
<p>rather than being able to attach the event handler using JavaScript:</p>
<pre><code>document.getElementById('tex... | [
{
"answer_id": 546915,
"author": "sfossen",
"author_id": 64657,
"author_profile": "https://Stackoverflow.com/users/64657",
"pm_score": 1,
"selected": false,
"text": "<p>Why not redefine assert to do what you want, when not compiled for debug?</p>\n\n<p>Another option, is to create your o... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1349865/"
] | It seems that the only way to add an `onPaste` event to an input element is to use HTML:
```
<textarea id="text_area" onpaste="on_paste" />
```
rather than being able to attach the event handler using JavaScript:
```
document.getElementById('text_area').onPaste = function() { alert('I iz in ur textbox, pasting some... | The method described [here](http://lists.apple.com/archives/Xcode-users/2004/Feb/msg00241.html) worked fine for me
I tested by placing it in `-(void)viewDidLoad`
```
- (void)viewDidLoad {
[super viewDidLoad];
int mib[4];
size_t bufSize = 0;
int local_error = 0;
struct kinfo_proc kp;
mib[0] =... |
546,921 | <p>For some reason, my SQL installation isn't working :)</p>
<pre><code>SELECT DATEADD(s,1234567890, '19700101')
</code></pre>
<p>Maybe <a href="http://coolepochcountdown.com/" rel="nofollow noreferrer">this site</a> would help (link from <a href="https://stackoverflow.com/users/19032/moose">Moose</a>).</p>
| [
{
"answer_id": 546928,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 2,
"selected": false,
"text": "<p>I get this:</p>\n\n<pre><code>2009-02-13 23:31:30.000\n</code></pre>\n"
},
{
"answer_id": 546945,
"author... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] | For some reason, my SQL installation isn't working :)
```
SELECT DATEADD(s,1234567890, '19700101')
```
Maybe [this site](http://coolepochcountdown.com/) would help (link from [Moose](https://stackoverflow.com/users/19032/moose)). | Total awesomeness! |
546,936 | <p>just adding a zero like below</p>
<pre><code>[assembly: AssemblyVersion("2.03.406.2")]
</code></pre>
<p>results in 2.3.406.2</p>
<p>which is not what I want.</p>
<p>So this may not be possible?</p>
| [
{
"answer_id": 546956,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 1,
"selected": false,
"text": "<p>Each number represents a specific <strong>numerical</strong> value, Major, Minor, Build and Revision.</p>\n\n<p>I... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66169/"
] | just adding a zero like below
```
[assembly: AssemblyVersion("2.03.406.2")]
```
results in 2.3.406.2
which is not what I want.
So this may not be possible? | Each portion of the assembly version is stored as a 16-bit integer, so no, it's not possible. |
546,946 | <p>I am trying to put a link in a <code><th></code> element and have the <code><a></code> element fill the entire space of the <code><th></code>. While I can get it to fille horizontally with width:100%, getting it to fill vertically is proving to be troublesome. height:100% seems to have no effect.</... | [
{
"answer_id": 546986,
"author": "bsberry",
"author_id": 28001,
"author_profile": "https://Stackoverflow.com/users/28001",
"pm_score": 0,
"selected": false,
"text": "<p>You need to give the <code><th></code> a height, so that your style block will end up something like</p>\n\n<pre>... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62084/"
] | I am trying to put a link in a `<th>` element and have the `<a>` element fill the entire space of the `<th>`. While I can get it to fille horizontally with width:100%, getting it to fill vertically is proving to be troublesome. height:100% seems to have no effect.
I want to do this so that the user can click anywhere ... | just change th style to this
```
th {
font-size: 50%;
width: 20em;
height: 100%;
line-height: 100%;
}
```
cheers |
546,962 | <p>I have a little project, and I want to have 2 compiled versions of that project:</p>
<ul>
<li>one that is targetting the .NET 2.0 framework</li>
<li>one that is targetting the .NET 3.5 framework</li>
</ul>
<p>All is going well; I've put my project under continuous integration (using CC.NET), and I've created 2 CC.... | [
{
"answer_id": 552867,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 2,
"selected": true,
"text": "<p>I've been able to solve this problem by making sure that I do not reference assemblies from the GAC.\nInstead,... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55774/"
] | I have a little project, and I want to have 2 compiled versions of that project:
* one that is targetting the .NET 2.0 framework
* one that is targetting the .NET 3.5 framework
All is going well; I've put my project under continuous integration (using CC.NET), and I've created 2 CC.NET 'projects'. One project for eac... | I've been able to solve this problem by making sure that I do not reference assemblies from the GAC.
Instead, I've created a 'lib' directory in my project that contains the 3rd party assemblies.
In my solution, I reference the 3rd party assemblies from there, and set copy local==True.
Next to that, you must also make ... |
546,967 | <p>I have a form with some select elements that have <code>onChange</code> events attached to them. I would like the event to fire even when someone clicks the form reset button.</p>
<p>My question is: does resetting a form fire a select elements <code>onChange</code> event?</p>
<p>Here is a simple example in jQuery<... | [
{
"answer_id": 592323,
"author": "Jack M.",
"author_id": 3421,
"author_profile": "https://Stackoverflow.com/users/3421",
"pm_score": 2,
"selected": false,
"text": "<p>There is an onReset tag for forms, so you could do something like:</p>\n\n<pre><code><script type=\"text/javascript\"&... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22730/"
] | I have a form with some select elements that have `onChange` events attached to them. I would like the event to fire even when someone clicks the form reset button.
My question is: does resetting a form fire a select elements `onChange` event?
Here is a simple example in jQuery
```
<script type="text/javascript">
... | There is an onReset tag for forms, so you could do something like:
```
<script type="text/javascript">
var changeFunc = function() {
// do something on change.
};
$('.myselect').change(changeFunc);
</script>
<form onReset="changeFunc()" action="/" method="post">
<select class="myselect" name="... |
546,968 | <p>I was reading a text describing Ruby and it said the following:</p>
<blockquote>
<p>Ruby is considered a “reflective”
language because it’s possible for a
Ruby program to analyze itself (in
terms of its make-up), make
adjustments to the way it works, and
even overwrite its own code with other
code.</p... | [
{
"answer_id": 547004,
"author": "Bryan Oakley",
"author_id": 7432,
"author_profile": "https://Stackoverflow.com/users/7432",
"pm_score": 2,
"selected": false,
"text": "<p>No, it means that you can issue a ruby command to get information about, well, just about anything. For example, you... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was reading a text describing Ruby and it said the following:
>
> Ruby is considered a “reflective”
> language because it’s possible for a
> Ruby program to analyze itself (in
> terms of its make-up), make
> adjustments to the way it works, and
> even overwrite its own code with other
> code.
>
>
>
I'm co... | Class reopening is a good example of this. Here's a simple example:
```
class Integer
def moxy
if self.zero?
self - 2
elsif self.nonzero?
self + 2
end
end
end
puts 10.moxy
```
By reopening a standard Ruby class - Integer - and defining a new ... |
546,979 | <p>I need to convert a project started as a Web Application to a Class Libray, is this possible?</p>
<p>Thanks</p>
| [
{
"answer_id": 547161,
"author": "David Basarab",
"author_id": 2469,
"author_profile": "https://Stackoverflow.com/users/2469",
"pm_score": 1,
"selected": false,
"text": "<p>No. Your best bet is to create a Class.Library and copy the .cs files into your new project.</p>\n\n<p>A Class Lib... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26754/"
] | I need to convert a project started as a Web Application to a Class Libray, is this possible?
Thanks | The correct answer is yes. Just edit the csproj (msbuild) file and change the ProjectGuid and remove the ProjectTypeGuids:
```
<ProjectGuid>{9845066A-3C9E-4F51-8F5F-8F513E8D03C1}</ProjectGuid>
```
It really is that simple. |
546,988 | <p>anyone ever see the visual monitoring tools factories and plants have? they show components of the manufacturing system in something reminiscent of a flowchart or visio diagram, but instead of a static image, each component has some interactive element (e.g. showing system stats or messages)</p>
<p>I want to build ... | [
{
"answer_id": 547161,
"author": "David Basarab",
"author_id": 2469,
"author_profile": "https://Stackoverflow.com/users/2469",
"pm_score": 1,
"selected": false,
"text": "<p>No. Your best bet is to create a Class.Library and copy the .cs files into your new project.</p>\n\n<p>A Class Lib... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | anyone ever see the visual monitoring tools factories and plants have? they show components of the manufacturing system in something reminiscent of a flowchart or visio diagram, but instead of a static image, each component has some interactive element (e.g. showing system stats or messages)
I want to build something ... | The correct answer is yes. Just edit the csproj (msbuild) file and change the ProjectGuid and remove the ProjectTypeGuids:
```
<ProjectGuid>{9845066A-3C9E-4F51-8F5F-8F513E8D03C1}</ProjectGuid>
```
It really is that simple. |
546,990 | <p>Is there a way to get an automatic feedback if an error (even syntax errors) occurs when running a JavaScript on the client side?</p>
<p>I was thinking of something like this:</p>
<pre><code><script src="debugger.js"></script>
<script>
// some script with an error in it
</script>
</code... | [
{
"answer_id": 547025,
"author": "Andrew Ensley",
"author_id": 20801,
"author_profile": "https://Stackoverflow.com/users/20801",
"pm_score": 5,
"selected": true,
"text": "<p>EDIT: I misunderstood your question initially, this should work:</p>\n\n<p>Also note, this needs to go BEFORE any... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53114/"
] | Is there a way to get an automatic feedback if an error (even syntax errors) occurs when running a JavaScript on the client side?
I was thinking of something like this:
```
<script src="debugger.js"></script>
<script>
// some script with an error in it
</script>
```
And every time the debugger notices an error ... | EDIT: I misunderstood your question initially, this should work:
Also note, this needs to go BEFORE any javascript that might cause errors.
```
window.onerror = function(msg,u,l)
{
txt ="Error: " + msg + "\n";
txt+="URL: " + u + "\n";
txt+="Line: " + l + "\n\n";
//Insert AJAX call that passes data (tx... |
546,993 | <p>Are there any language lawyers in the house?</p>
<p>Should the following code compile?</p>
<pre><code>include <set>
bool fn( const std::set<int>& rSet )
{
if ( rSet.find( 42 ) != rSet.end() ) return true;
return false;
}
</code></pre>
<p>On one of the platforms (Sun Workshop) this does not co... | [
{
"answer_id": 547034,
"author": "zweiterlinde",
"author_id": 6592,
"author_profile": "https://Stackoverflow.com/users/6592",
"pm_score": 2,
"selected": false,
"text": "<p>I can't duplicate this exact behavior on my platform, but I have run into similar problems in the past with STL maps... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7743/"
] | Are there any language lawyers in the house?
Should the following code compile?
```
include <set>
bool fn( const std::set<int>& rSet )
{
if ( rSet.find( 42 ) != rSet.end() ) return true;
return false;
}
```
On one of the platforms (Sun Workshop) this does not compile. It reports that the find function returned... | It should compile. Set includes 2 find() functions and 2 end() functions (const and non-const versions). It sort of sounds like Sun's STL is broken somehow. Since you are passing in a const reference, the compiler should be able to select the correct find() and end() functions. |
546,994 | <p>i want to send the xml of an <code>XmlDocument</code> object to the HTTP client, but i'm concerned that the <a href="https://stackoverflow.com/questions/543319/how-to-return-xml-in-asp-net/543431#543431">suggested soltuion</a> might not honor the encoding that the <code>Response</code> has been set to use:</p>
<pre... | [
{
"answer_id": 547013,
"author": "Alex Reitbort",
"author_id": 11525,
"author_profile": "https://Stackoverflow.com/users/11525",
"pm_score": -1,
"selected": false,
"text": "<p>First 2 links from google</p>\n\n<p>How to: Select an Encoding for ASP.NET Web Page Globalization:\n<a href=\"ht... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | i want to send the xml of an `XmlDocument` object to the HTTP client, but i'm concerned that the [suggested soltuion](https://stackoverflow.com/questions/543319/how-to-return-xml-in-asp-net/543431#543431) might not honor the encoding that the `Response` has been set to use:
```
public void ProcessRequest(HttpContext c... | i found it.
The answer is no: The XmlDocument will not honor the ContentEncoding of the response stream it's writing to.
---
**Update: the proper way to do it**
1. Use `Response.Output`, and **NOT** `Response.OutputStream`.
Both are streams, but `Output` is a `TextWriter`.
When an `XmlDocument` saves itself to a ... |
546,997 | <p>Is it possible to do something like this</p>
<pre><code>#ifdef SOMETHING
#define foo //
#else
#define foo MyFunction
#endif
</code></pre>
<p>The idea is that if SOMETHING is defined, then calls to foo(...) become comments (or something that doesn't get evaluated or compiled), otherwise it becomes a call to MyFunct... | [
{
"answer_id": 547007,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 6,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>#ifdef SOMETHING\n#define foo(x)\n#else\n#define foo(x) MyFunction(x)\n#endif\n</code></pre>\... | 2009/02/13 | [
"https://Stackoverflow.com/questions/546997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62055/"
] | Is it possible to do something like this
```
#ifdef SOMETHING
#define foo //
#else
#define foo MyFunction
#endif
```
The idea is that if SOMETHING is defined, then calls to foo(...) become comments (or something that doesn't get evaluated or compiled), otherwise it becomes a call to MyFunction.
I've seen \_\_noop u... | Try this:
```
#ifdef SOMETHING
#define foo(x)
#else
#define foo(x) MyFunction(x)
#endif
```
If your function has several arguments, then:
```
#ifdef SOMETHING
#define foo(x,y,z)
#else
#define foo(x,y,z) MyFunction(x,y,z)
#endif
```
If your function has a variable number of arguments, then your compiler may suppor... |
547,005 | <p>I can download remote files using PHP but how do you download from a link that pushes headers out? I mean, you can click on some links and it will force a download and present you with dialog box to save the file. How can I <strong>download and save</strong> this sort of thing using PHP?</p>
<p>Any examples or link... | [
{
"answer_id": 547027,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 1,
"selected": false,
"text": "<p>You can do it the same way as you download your remote files. Those “force download” header values just tell user agents ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51649/"
] | I can download remote files using PHP but how do you download from a link that pushes headers out? I mean, you can click on some links and it will force a download and present you with dialog box to save the file. How can I **download and save** this sort of thing using PHP?
Any examples or links to tutorials would be... | Just tried to reproduce situation. Gubmo is right, this download method works for me with *Content-Type: application/octet-stream* and *Content-type: application/force-download* headers.
As explained [here](http://www.checkupdown.com/status/E410.html), HTTP 410 means that *URL requested by the client is no longer ava... |
547,014 | <p>Could someone explain to me what is going on here and how to solve this problem?</p>
<p>Suppose relation R(A,B) has the tuples:</p>
<pre>
A B
1 2
3 4
5 6
</pre>
<p>and the relation S(B,C,D) has tuples:</p>
<pre>
B C D
2 4 6
4 6 8
4 7 9
</pre>
<p>Compute the natural join of R and S. Then, identify which of the f... | [
{
"answer_id": 547053,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 5,
"selected": true,
"text": "<p>A natural join is joining (\"sticking together\") elements from two relations where there is a match. In this exampl... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36545/"
] | Could someone explain to me what is going on here and how to solve this problem?
Suppose relation R(A,B) has the tuples:
```
A B
1 2
3 4
5 6
```
and the relation S(B,C,D) has tuples:
```
B C D
2 4 6
4 6 8
4 7 9
```
Compute the natural join of R and S. Then, identify which of the following tuples is in the
natu... | A natural join is joining ("sticking together") elements from two relations where there is a match. In this example
* (1, **2**) matches (**2**, 4, 6) so you get (1, 2, 4, 6)
* (3, **4**) matches (**4**, 6, 8) so you get (3, 4, 6, 8)
* (3, **4**) matches (**4**, 7, 9) so you get (3, 4, 7, 9)
So the natural join is {(... |
547,022 | <p>I have an app which has tasks in it and you can reorder them. Now I was woundering how to best store them. Should I have a colomn for the ordernumber and recalculate all of them everytime I change one? Please tell me a version which doesn't require me to update all order numbers since that is very time consuming (fr... | [
{
"answer_id": 547059,
"author": "mmattax",
"author_id": 1638,
"author_profile": "https://Stackoverflow.com/users/1638",
"pm_score": 0,
"selected": false,
"text": "<p>I'd recommend having an order column in the database. When an object is reordered, swap the order value in the database b... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19929/"
] | I have an app which has tasks in it and you can reorder them. Now I was woundering how to best store them. Should I have a colomn for the ordernumber and recalculate all of them everytime I change one? Please tell me a version which doesn't require me to update all order numbers since that is very time consuming (from ... | You may keep orders as literals, and use lexical sort:
```
1. A
2. Z
```
Add a task:
```
1. A
3. L
2. Z
```
Add more:
```
1. A
4. B
3. L
2. Z
```
Move 2 between 1 and 4:
```
1. A
2. AL
4. B
3. L
```
etc.
You update only one record at a time: just take an average letter between the first ones that differ: i... |
547,024 | <p>I need to write a small regex which should match the occurrences of literal character * when it appears with any other special character. For example, I need to catch all of these occurrences <code>!* )* (* ** *.*</code> . The exception to this is <code>*=</code> and <code>=*</code>, which I want to allow. I tried w... | [
{
"answer_id": 547083,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 1,
"selected": false,
"text": "<p>That one matches all your <em>bad</em> samples:</p>\n\n<pre><code>(\\!\\*|\\)\\*|\\(\\*|\\*\\*|\\*\\.\\*)\n</cod... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55176/"
] | I need to write a small regex which should match the occurrences of literal character \* when it appears with any other special character. For example, I need to catch all of these occurrences `!* )* (* ** *.*` . The exception to this is `*=` and `=*`, which I want to allow. I tried writing the regex as
```
\W&&[^=]\... | ```
(\*[^\w=]|[^\w=]\*)
```
That matches a asterisk followed by any non-word character (other than an equals sign), or a non-word character followed by an asterisk/ |
547,042 | <p>I'm looking for an elegant way to denote undefined values in situations where formatted numbers usually render. I'll work up a small example. For starters, you of course can't use this:</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
for my $s (1, 1.2, undef, 1.3) {
printf "%5.2f\n", $s;
}
</code></pre... | [
{
"answer_id": 547050,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 2,
"selected": false,
"text": "<p>This actually already exists, it's called <a href=\"http://www.xfree86.org/current/xmag.1.html\" rel=\"nofollow norefer... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66184/"
] | I'm looking for an elegant way to denote undefined values in situations where formatted numbers usually render. I'll work up a small example. For starters, you of course can't use this:
```
#!/usr/bin/perl
use strict;
use warnings;
for my $s (1, 1.2, undef, 1.3) {
printf "%5.2f\n", $s;
}
```
...because the 'use ... | This actually already exists, it's called [Xmag](http://www.xfree86.org/current/xmag.1.html) (do a Google search for additional info). You might want to check out the source code for it if you want to know how it works.
*EDIT*: looks like I misread your question a little bit... if you want a magnified square to follow... |
547,063 | <p>I'm trying to use a stored procedure in the entity framework. I had the model created initially without the stored proc. I then went into Update Model from Database and selected the stored procedure I wanted and then added it through the function import.
Now I can see the function in the model browser under Functio... | [
{
"answer_id": 547274,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 0,
"selected": false,
"text": "<p>Open your Entity Data Model in XML view and check to see if you have any </p>\n\n<p><!--Errors Found During Generat... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2137/"
] | I'm trying to use a stored procedure in the entity framework. I had the model created initially without the stored proc. I then went into Update Model from Database and selected the stored procedure I wanted and then added it through the function import.
Now I can see the function in the model browser under Function I... | Visual Studio generates the function code in the model's code-behind if and only if you specify the return to be an entity type. Scalar and null return types do not work.
Looks like a bug to me. Here is the full story: [Function Imports in Entity Model with a non-Entity Return Type](https://stackoverflow.com/questions/... |
547,071 | <p>For some reason, my installation of gcc seems to be printing an "a with a carat" character in place of all %s's in its error messages, e.g.,</p>
<pre><code>test.c:4: error: expected â, â, â, â or â before â token
</code></pre>
<p>Has anyone else seen this before? (Needless to say, it's difficult to Google for.)</p... | [
{
"answer_id": 547088,
"author": "theomega",
"author_id": 61855,
"author_profile": "https://Stackoverflow.com/users/61855",
"pm_score": 3,
"selected": false,
"text": "<p><strong>What is your LANG-Settings (call \"export\" on a bash in a terminal)?</strong> Try setting the Lang to a corre... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91385/"
] | For some reason, my installation of gcc seems to be printing an "a with a carat" character in place of all %s's in its error messages, e.g.,
```
test.c:4: error: expected â, â, â, â or â before â token
```
Has anyone else seen this before? (Needless to say, it's difficult to Google for.)
(This is on Ubuntu 8.10)
E... | Aha! The problem was that I have LANG=en\_US.UTF-8 and was using xterm. Apparently, that's no good. By setting LANG=C or LANG=en\_US, everything's great now. |
547,074 | <p>I need to add a constraint to an existing SQL server table but only if it does not already exist.</p>
<p>I am creating the constraint using the following SQL.</p>
<pre><code>ALTER TABLE [Foo] ADD CONSTRAINT [FK_Foo_Bar] FOREIGN KEY ([BarId]) REFERENCES [Bar] ([BarId]) ON UPDATE CASCADE ON DELETE CASCADE
</code></p... | [
{
"answer_id": 547090,
"author": "Kristen",
"author_id": 65703,
"author_profile": "https://Stackoverflow.com/users/65703",
"pm_score": 6,
"selected": true,
"text": "<p>Personally I would drop the existing constraint, and recreate it - in case the one that is already there is in some way ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2768/"
] | I need to add a constraint to an existing SQL server table but only if it does not already exist.
I am creating the constraint using the following SQL.
```
ALTER TABLE [Foo] ADD CONSTRAINT [FK_Foo_Bar] FOREIGN KEY ([BarId]) REFERENCES [Bar] ([BarId]) ON UPDATE CASCADE ON DELETE CASCADE
```
I'm hoping I can add some... | Personally I would drop the existing constraint, and recreate it - in case the one that is already there is in some way different
```
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[MyFKName]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE dbo.MyTableName DROP CONSTRAINT MyFKName
G... |
547,118 | <p>This is the best way I could come up with to convert a MySQL GUID/UUID generated by UUID() to a binary(16):</p>
<pre><code>UNHEX(REPLACE(UUID(),'-',''))
</code></pre>
<p>And then storing it in a BINARY(16)</p>
<p>Are there any implications of doing it this way that I should know of?</p>
| [
{
"answer_id": 547141,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": true,
"text": "<p>Not many implications. It will slow down the queries a little, but you will hardly notice it.</p>\n\n<p><code>UNIQUEIDE... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/452521/"
] | This is the best way I could come up with to convert a MySQL GUID/UUID generated by UUID() to a binary(16):
```
UNHEX(REPLACE(UUID(),'-',''))
```
And then storing it in a BINARY(16)
Are there any implications of doing it this way that I should know of? | Not many implications. It will slow down the queries a little, but you will hardly notice it.
`UNIQUEIDENTIFIER` is stored as `16-byte binary` internally anyway.
If you are going to load the binary into a client and parse it there, note the `bit order`, it may have other string representation than the initial `NEWID(... |
547,127 | <p>In Ruby, I have:</p>
<pre><code>require 'uri'
foo = "et tu, brutus?"
bar = URI.encode(foo) # => "et%20tu,%20brutus?"
</code></pre>
<p>I'm trying to get bar to equal "et%20tu,%20brutus%3f" ("?" replaced with "%3F") When I try to add this:</p>
<pre><code>bar[&... | [
{
"answer_id": 547133,
"author": "Geo",
"author_id": 31610,
"author_profile": "https://Stackoverflow.com/users/31610",
"pm_score": 2,
"selected": false,
"text": "<p>Here's a sample irb session:</p>\n<pre><code>irb(main):001:0> x = "geo?"\n\n=> "geo?"\n\nirb(main... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34820/"
] | In Ruby, I have:
```
require 'uri'
foo = "et tu, brutus?"
bar = URI.encode(foo) # => "et%20tu,%20brutus?"
```
I'm trying to get bar to equal "et%20tu,%20brutus%3f" ("?" replaced with "%3F") When I try to add this:
```
bar["?"] = "%3f"
```
the "?" matches everything, and I get
```
=> "%3f"
```
I've tried
... | `require 'cgi'` and call `CGI.escape` |
547,134 | <p>I'm working on a simple hello world TCP/IP client server app in C# and am unable to get my client to connect. Can anyone offer any additional troubleshooting steps? I'm starting to run out of ideas...</p>
<p>Here are the relevant sections of code:</p>
<p>server:</p>
<pre><code>Console.Out.WriteLine("About to bi... | [
{
"answer_id": 547139,
"author": "Nick Fortescue",
"author_id": 5346,
"author_profile": "https://Stackoverflow.com/users/5346",
"pm_score": 2,
"selected": false,
"text": "<p>try <code>netstat -al</code> on your machine (the exact command line varies between Windows and unix) and see if t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2170994/"
] | I'm working on a simple hello world TCP/IP client server app in C# and am unable to get my client to connect. Can anyone offer any additional troubleshooting steps? I'm starting to run out of ideas...
Here are the relevant sections of code:
server:
```
Console.Out.WriteLine("About to bind address");
IPAddress ipAd =... | The code above is listening to request coming from the loopback address. This will effectively only listen to connection on that network, and that network only includes your machine.
Have you tried listening to the address bound to the network from which the connection should be coming? On a local network it should be... |
547,137 | <p>Most of my programming experience is in a language where there is one collection data structure -- an array. Now that I'm working primarily in .NET, I've come to appreciate the vast number of tools available to me, but I also find it difficult to determine which tools is best suited for each problem. I find this t... | [
{
"answer_id": 547158,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 5,
"selected": true,
"text": "<p>You didn't say what language you used before, but I feel pretty confident in saying that if you believe that array w... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] | Most of my programming experience is in a language where there is one collection data structure -- an array. Now that I'm working primarily in .NET, I've come to appreciate the vast number of tools available to me, but I also find it difficult to determine which tools is best suited for each problem. I find this to be ... | You didn't say what language you used before, but I feel pretty confident in saying that if you believe that array was the only thing available, then you were probably mistaken.
C++ for example only supports array "collections" natively ("collections" used very loosely here), but with the addition of pointers you can... |
547,148 | <p>I've created a custom Amazon AMI (Fedora) runs a few scripts and then shuts down. </p>
<p>The problem with AMI's is that if my code changes there has to be a way for the AMI instance to get the latest scripts before it executes them. </p>
<p>I wrote a shell script & put it in <code>/etc/init.d/nt_startup</code... | [
{
"answer_id": 547170,
"author": "kmkaplan",
"author_id": 50902,
"author_profile": "https://Stackoverflow.com/users/50902",
"pm_score": 0,
"selected": false,
"text": "<p>You have to put a startup link in /etc/rc?.d. You can use chkconfig(8) or ntsysv(8) to help you administer these dire... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36249/"
] | I've created a custom Amazon AMI (Fedora) runs a few scripts and then shuts down.
The problem with AMI's is that if my code changes there has to be a way for the AMI instance to get the latest scripts before it executes them.
I wrote a shell script & put it in `/etc/init.d/nt_startup`
To keep the code up to date, ... | OK, I finally figured it out. After scouring the EC2 output I found this line:
"Starting ntstartup: sudo: sorry, you must have a tty to run sudo"
Apparently Fedora locks out non tty sudo commands.
A quick search led to the solution:
1. As root run "visudo."
2. Find the line with "Default requiretty" and comment it ... |
547,169 | <p>I have a shutdown hook in my application (created using <code>Runtime.getRuntime().addShutdownHook</code>). However if I launch the application from within Eclipse, when it is shut-down the shutdown hook doesn't execute. </p>
<p>I think this is because Eclipse sends the equivalent of a force-kill signal to the proc... | [
{
"answer_id": 547239,
"author": "Javamann",
"author_id": 10166,
"author_profile": "https://Stackoverflow.com/users/10166",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not sure how to fix this but IntelliJ added a separate button to their 'Run' dialog which will shutdown the VM in ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a shutdown hook in my application (created using `Runtime.getRuntime().addShutdownHook`). However if I launch the application from within Eclipse, when it is shut-down the shutdown hook doesn't execute.
I think this is because Eclipse sends the equivalent of a force-kill signal to the process, which doesn't ca... | I used the following hack at the end of my main method to get around the problem:
```
if (Boolean.parseBoolean(System.getenv("RUNNING_IN_ECLIPSE"))) {
System.out.println("You're using Eclipse; click in this console and " +
"press ENTER to call System.exit() and run the shutdown routine.");
try {
... |
547,172 | <p>Environment: .NET Framework 2.0, VS 2008.</p>
<p>I am trying to create a subclass of certain .NET controls (label, panel) that will pass through certain mouse events (<code>MouseDown</code>, <code>MouseMove</code>, <code>MouseUp</code>) to its parent control (or alternatively to the top-level form). I can do this b... | [
{
"answer_id": 547185,
"author": "Sandeep Datta",
"author_id": 39648,
"author_profile": "https://Stackoverflow.com/users/39648",
"pm_score": 2,
"selected": false,
"text": "<p>You need to write a public/protected method in your base class which will raise the event for you. Then call this... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66189/"
] | Environment: .NET Framework 2.0, VS 2008.
I am trying to create a subclass of certain .NET controls (label, panel) that will pass through certain mouse events (`MouseDown`, `MouseMove`, `MouseUp`) to its parent control (or alternatively to the top-level form). I can do this by creating handlers for these events in ins... | Yes. After a lot of searching, I found the article ["Floating Controls, tooltip-style"](http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Floating_Controls/article.asp), which uses `WndProc` to change the message from `WM_NCHITTEST` to `HTTRANSPARENT`, making the `Control` transparent to mouse events.
... |
547,175 | <p>I am currently working on creating a web page using .NET 2008. We are getting information from a database and when displaying it I cannot get it to wrap underneath. For example:</p>
<pre class="lang-none prettyprint-override"><code> 2231 Question 1
2232 Mechanical Engineering Technologists and Technicians
2233 I... | [
{
"answer_id": 547182,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 1,
"selected": false,
"text": "<p>Well, there's a better way, but this can be done cheaply and quickly with tables.</p>\n\n<pre><code><table>\n<... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am currently working on creating a web page using .NET 2008. We are getting information from a database and when displaying it I cannot get it to wrap underneath. For example:
```none
2231 Question 1
2232 Mechanical Engineering Technologists and Technicians
2233 Industrial Engineering and Manufacturing Technolog... | I would structure your HTML in the following manner:
```
<div class="qNumber">2231</div>
<div class="qContent">Question 1</div>
<div class="clear"></div>
<div class="qNumber">2232</div>
<div class="qContent">Mechanical Engineering Technologists and Technicians</div>
<div class="clear"></div>
<div class="qNumber">223... |
547,178 | <p>I use to be on a shared host and I could use there standard tools to look at bandwidth graph.</p>
<p>I now have my sites running on a dedicated server and I have no idea whats going on :P <em>sigh</em></p>
<p>I have installed webmin on my Fedora core 10 machine and I would like to monitor bandwidth. I was about to... | [
{
"answer_id": 547186,
"author": "moonshadow",
"author_id": 11834,
"author_profile": "https://Stackoverflow.com/users/11834",
"pm_score": 4,
"selected": true,
"text": "<p><a href=\"http://humdi.net/vnstat/\" rel=\"noreferrer\">vnStat</a> is about as lightweight as they come. (There's ple... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51649/"
] | I use to be on a shared host and I could use there standard tools to look at bandwidth graph.
I now have my sites running on a dedicated server and I have no idea whats going on :P *sigh*
I have installed webmin on my Fedora core 10 machine and I would like to monitor bandwidth. I was about to setup the bandwidth mod... | [vnStat](http://humdi.net/vnstat/) is about as lightweight as they come. (There's plenty of front ends around if the graphs the command line tool gives aren't pretty enough.) |
547,180 | <p>So why does the first search example below return no results? And any ideas on how to modify the below code to make number searches possible would be much appreciated.</p>
<h1>Create the index</h1>
<pre><code>$index = new Zend_Search_Lucene('/myindex', true);
$doc->addField(Zend_Search_Lucene_Field::Text('ssn',... | [
{
"answer_id": 547953,
"author": "Zoredache",
"author_id": 20267,
"author_profile": "https://Stackoverflow.com/users/20267",
"pm_score": 2,
"selected": false,
"text": "<p>This is an effect of which Analyzer you have chosen.</p>\n\n<p>I believe the <a href=\"http://framework.zend.com/manu... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | So why does the first search example below return no results? And any ideas on how to modify the below code to make number searches possible would be much appreciated.
Create the index
================
```
$index = new Zend_Search_Lucene('/myindex', true);
$doc->addField(Zend_Search_Lucene_Field::Text('ssn', '123-12-... | This is an effect of which Analyzer you have chosen.
I believe the [default Analyzer](http://framework.zend.com/manual/en/zend.search.lucene.charset.html#zend.search.lucene.charset.default_analyzer) will only index terms that match /[a-zA-Z]+/. This means that your SSN isn't being added to the index as a term.
Even i... |
547,187 | <p>The table <code>Arc(x,y)</code> currently has the
following tuples (note there are
duplicates): </p>
<pre><code>(1,2),
(1,2),
(2,3),
(3,4),
(3,4),
(4,1),
(4,1),
(4,1),
(4,2)
</code></pre>
<p>Compute the result of the query:</p>
<pre><code>SELECT a1.x, a2.y, COUNT(*)
FROM Arc a1, Arc a2
WHERE a1.y = a2.x
GROUP BY ... | [
{
"answer_id": 547196,
"author": "GregD",
"author_id": 38317,
"author_profile": "https://Stackoverflow.com/users/38317",
"pm_score": 4,
"selected": true,
"text": "<p>a1 and a2 are just aliases for the Arc table which is being joined to itself. You could also say,</p>\n\n<pre><code>Arc A... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36545/"
] | The table `Arc(x,y)` currently has the
following tuples (note there are
duplicates):
```
(1,2),
(1,2),
(2,3),
(3,4),
(3,4),
(4,1),
(4,1),
(4,1),
(4,2)
```
Compute the result of the query:
```
SELECT a1.x, a2.y, COUNT(*)
FROM Arc a1, Arc a2
WHERE a1.y = a2.x
GROUP BY a1.x, a2.y;
```
What are `a1` and `a2` referri... | a1 and a2 are just aliases for the Arc table which is being joined to itself. You could also say,
```
Arc As a1, Arc As a2
```
Is that what you're asking? |
547,214 | <p>I am trying to implement a function called "inet_pton" which will convert a string representation of an IPv4 or IPv6 (like "66.102.1.147" [google]) into binary network-byte ordered form. Here is the relevant part of my code:</p>
<pre><code>#if defined WIN32
int inet_pton (int af, const char *src, void *dst)
{
... | [
{
"answer_id": 547257,
"author": "Jon Tackabury",
"author_id": 343,
"author_profile": "https://Stackoverflow.com/users/343",
"pm_score": 2,
"selected": false,
"text": "<p>MSDN has an excellent article on using getaddrinfo:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/ms738... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1812999/"
] | I am trying to implement a function called "inet\_pton" which will convert a string representation of an IPv4 or IPv6 (like "66.102.1.147" [google]) into binary network-byte ordered form. Here is the relevant part of my code:
```
#if defined WIN32
int inet_pton (int af, const char *src, void *dst)
{
const void *d... | Well, for a start you're asking for a stream socket with UDP as a protocol and that just isn't going to happen.
Try with:
```
hints.ai_family = af;
hints.ai_socktype = 0;
hints.ai_protocol = 0;
hints.ai_flags = AI_NUMERICHOST;
```
and memset it to zero first as it has extra members that you're not setting...
... |
547,224 | <p>WAMP installed fine, no problems, BUT...</p>
<p>When going to phpMyAdmin, I get the error from phpMyAdmin as follows:</p>
<pre><code>Cannot load mysqli extension. Please check your PHP configuration
</code></pre>
<p>Also, phpMyAdmin documentation explains this error message as follows:</p>
<blockquote>
<p>To c... | [
{
"answer_id": 1129375,
"author": "Vicer",
"author_id": 111757,
"author_profile": "https://Stackoverflow.com/users/111757",
"pm_score": 1,
"selected": false,
"text": "<p>I had the same problem. I had WAMP server installed. All was working fine. Then one day I restarted my computer and it... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65122/"
] | WAMP installed fine, no problems, BUT...
When going to phpMyAdmin, I get the error from phpMyAdmin as follows:
```
Cannot load mysqli extension. Please check your PHP configuration
```
Also, phpMyAdmin documentation explains this error message as follows:
>
> To connect to a MySQL server, PHP needs a set of MySQL... | I deleted the PHP in program files ad everything started working , the problem that there two installations of pHp |
547,235 | <p>I am using <code>oracleclient</code> provider. I was wondering how do I use a parameter in the query.</p>
<pre><code>select * from table A where A.a in ( parameter).
</code></pre>
<p>The parameter should be a <code>multivalue</code> parameter.</p>
<p>how do I create a data set?</p>
| [
{
"answer_id": 547248,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you can use a parameter in such a situation.\n(Unless oracle and the language you're using supp... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using `oracleclient` provider. I was wondering how do I use a parameter in the query.
```
select * from table A where A.a in ( parameter).
```
The parameter should be a `multivalue` parameter.
how do I create a data set? | Simple. Add the parameter to the report and make sure to check it off as multi-valued. Then in the data tab and go in and edit the query click the "..." button to edit the dataset. Under the parameters tab create a mapping parameter so it looks something like this (obviously you will have different names for your param... |
547,242 | <p>I am using JBOSS 4.2.2 server to deploy multiple web applications. Each application uses Hibernate and for each application there are separate log files and separate appenders. Now for Hibernate logging statements of one application should go in log file of that particular application. Does anybody know how to confi... | [
{
"answer_id": 636519,
"author": "Karl",
"author_id": 44313,
"author_profile": "https://Stackoverflow.com/users/44313",
"pm_score": 0,
"selected": false,
"text": "<p>If you have multiple applications each running hibernate just create an appender for hibernate in the application log4j.xm... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using JBOSS 4.2.2 server to deploy multiple web applications. Each application uses Hibernate and for each application there are separate log files and separate appenders. Now for Hibernate logging statements of one application should go in log file of that particular application. Does anybody know how to configur... | In JBoss you can use the TCL filter as described [here](http://community.jboss.org/wiki/SeparatingApplicationLogs). Just add the filter to the part of the configuration you want to manipulate.
Example (slightly adapted from above source, look at section *Deploy Application As .war File*):
```
<appender name="App1Log"... |
547,249 | <p>I've been trying to optimize my code to make it a little more concise and readable and was hoping I wasn't causing poorer performance from doing it. I think my changes might have slowed down my application, but it might just be in my head. Is there any performance difference between:</p>
<pre><code>Command.Parame... | [
{
"answer_id": 547266,
"author": "PhilChuang",
"author_id": 14392,
"author_profile": "https://Stackoverflow.com/users/14392",
"pm_score": 7,
"selected": true,
"text": "<p>IMHO, optimize for readability and understanding - any run-time performance gains will likely be minimal compared to ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47895/"
] | I've been trying to optimize my code to make it a little more concise and readable and was hoping I wasn't causing poorer performance from doing it. I think my changes might have slowed down my application, but it might just be in my head. Is there any performance difference between:
```
Command.Parameters["@EMAIL"].V... | IMHO, optimize for readability and understanding - any run-time performance gains will likely be minimal compared to the time it takes you in the real-world when you come back to this code in a couple months and try to understand what the heck you were doing in the first place. |
547,276 | <p>I'm trying to default a value in a field to the current date, but my code:</p>
<pre><code><?php
echo '<input type="text" name="makeupassignment" size="50" value="'.date("m/d/y").'">';
?>
</code></pre>
<p>is only printing this:<br></p>
';
?>
| [
{
"answer_id": 547477,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 3,
"selected": false,
"text": "<p>The TSVN plugin API is COM-based. I'd start by learning how to implement a COM object in Delphi. There's <a href=... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42229/"
] | I'm trying to default a value in a field to the current date, but my code:
```
<?php
echo '<input type="text" name="makeupassignment" size="50" value="'.date("m/d/y").'">';
?>
```
is only printing this:
';
?> | The TSVN plugin API is COM-based. I'd start by learning how to implement a COM object in Delphi. There's [this book](https://rads.stackoverflow.com/amzn/click/com/1578702216). I also found [this](http://delphi.about.com/od/beginners/l/aa113004a.htm).
If you already know how to implement COM objects in Delphi, then I a... |
547,278 | <p>This will apply mostly for an asp.net application where the data is not accessed via soa. Meaning that you get access to the objects loaded from the framework, not Transfer Objects, although some recommendation still apply. </p>
<p>This is a community post, so please add to it as you see fit.</p>
<p><strong>Applie... | [
{
"answer_id": 2521530,
"author": "user48545",
"author_id": 48545,
"author_profile": "https://Stackoverflow.com/users/48545",
"pm_score": 1,
"selected": false,
"text": "<p>While informative I think it may be more helpful to share how all this fits into a complete solution architecture. E... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3610/"
] | This will apply mostly for an asp.net application where the data is not accessed via soa. Meaning that you get access to the objects loaded from the framework, not Transfer Objects, although some recommendation still apply.
This is a community post, so please add to it as you see fit.
**Applies to**: Entity Framewor... | Please do not use all of the above info such as "Singleton access". You absolutely 100% should not be storing this context to be reused as it is not thread safe. |
547,290 | <p>Consider these types:</p>
<pre><code> struct A {};
struct B : A { int i; };
</code></pre>
<p><code>sizeof(A) > 0</code> as required by the standard.</p>
<p><code>sizeof(B)</code> should be 4 due to the empty base optimization. Yet on GCC 4.1.1 it's 5 (I'm using a pack of 1 in this area). And inconsistently ... | [
{
"answer_id": 547389,
"author": "Michael Kristofik",
"author_id": 46821,
"author_profile": "https://Stackoverflow.com/users/46821",
"pm_score": 0,
"selected": false,
"text": "<p>Well, it's not a complete answer, but the <a href=\"http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/C_002b_002b-D... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14582/"
] | Consider these types:
```
struct A {};
struct B : A { int i; };
```
`sizeof(A) > 0` as required by the standard.
`sizeof(B)` should be 4 due to the empty base optimization. Yet on GCC 4.1.1 it's 5 (I'm using a pack of 1 in this area). And inconsistently - some of my files are getting it, some are not. Can't be ... | This always happens. I post immediately before I figure it out. Maybe the act of posting gets me thinking in a different way..
So in my question the sample was a little bit over-simplified. It's actually more like this:
```
struct Base {};
struct C1 : Base { int i; }
struct C2 : Base { C1 c; int i; }
```
sizeof(C1)... |
547,308 | <p>I have been trying to use Server Side Includes on my website to save time writing code and be able to change site wide elements quickly and easily.</p>
<p>However i cannot seem to get them to work, either locally or on the Server.</p>
<p>I have set them up as .html files (with only the code needed and no html or b... | [
{
"answer_id": 547323,
"author": "James",
"author_id": 56753,
"author_profile": "https://Stackoverflow.com/users/56753",
"pm_score": 0,
"selected": false,
"text": "<p>It's possibly a path problem. Have you tried it without the leading \"/\" in front of \"ssi\"?</p>\n"
},
{
"answe... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66200/"
] | I have been trying to use Server Side Includes on my website to save time writing code and be able to change site wide elements quickly and easily.
However i cannot seem to get them to work, either locally or on the Server.
I have set them up as .html files (with only the code needed and no html or body tags) in a "s... | Is it Apache? Perhaps includes are not even enabled.
<http://httpd.apache.org/docs/2.2/howto/ssi.html>
>
> To permit SSI on your server, you must have the following directive either in your httpd.conf file, or in a .htaccess file:
>
>
> `Options +Includes`
>
>
> |
547,326 | <p>I need to shrink some large PDFs to print on an 8.5x11 inch (standard letter) page. Can ImageMagick/Ghostscript handle this sort of thing, or am I having so much trouble because I'm using the wrong tool for the job?</p>
<p>Just relying on the 'shrink to page' option in client-side print dialogs is not an option, as ... | [
{
"answer_id": 547441,
"author": "danieltalsky",
"author_id": 22452,
"author_profile": "https://Stackoverflow.com/users/22452",
"pm_score": 3,
"selected": false,
"text": "<p>ImageMagick's mogrify/convert commands will indeed do the job. Stephen Page had just about the right idea, but yo... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1902010/"
] | I need to shrink some large PDFs to print on an 8.5x11 inch (standard letter) page. Can ImageMagick/Ghostscript handle this sort of thing, or am I having so much trouble because I'm using the wrong tool for the job?
Just relying on the 'shrink to page' option in client-side print dialogs is not an option, as we'd like... | The problem with using ImageMagick is that you are converting to a raster image format, increasing file size and decreasing quality for any vector elements on your pages.
[Multivalent](https://rg.to/file/c6bd7f31bf8885bcaa69b50ffab7e355/Multivalent20060102.jar.html) will retain the vector information of the PDF.
Try:
... |
547,327 | <p>I'm trying to do something that many people seem to have been able to do but which I am unable to implement any solution. The <a href="http://tinymce.moxiecode.com/" rel="noreferrer">TinyMCE</a> control works pretty well in an asp.net form until you enclose it with an UpdatePanel, which then breaks after postback. I... | [
{
"answer_id": 547407,
"author": "Nirav",
"author_id": 55742,
"author_profile": "https://Stackoverflow.com/users/55742",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure if you've looked at these. </p>\n\n<p><a href=\"http://joakimk.blogspot.com/2007/07/tinymce-inside-of-aspnet-aja... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47109/"
] | I'm trying to do something that many people seem to have been able to do but which I am unable to implement any solution. The [TinyMCE](http://tinymce.moxiecode.com/) control works pretty well in an asp.net form until you enclose it with an UpdatePanel, which then breaks after postback. I have tried some fixes like the... | To execute the `init` everytime the `UpdatePanel` changes you need to register the script using `ScriptManager`:
```
// control is your UpdatePanel
ScriptManager.RegisterStartupScript(control, control.GetType(), control.UniqueID, "your_tinymce_initfunc();", true);
```
**NOTE:** You cannot use `exact` mode on your in... |
547,335 | <p>I am trying to create an IM bot and I haven't been able to find the necessary resources.</p>
<hr>
<p><strong>UPDATE</strong></p>
<p>There was an issue with Imified making gtalk bots not appear online (and not responding), it works now so I'm closing this.</p>
<p>This <a href="http://www.labnol.org/internet/tutor... | [
{
"answer_id": 547645,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 2,
"selected": false,
"text": "<p>Google Talk uses jabber, where the protocol is called <a href=\"http://en.wikipedia.org/wiki/Xmpp\" rel=\"nofollow n... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810/"
] | I am trying to create an IM bot and I haven't been able to find the necessary resources.
---
**UPDATE**
There was an issue with Imified making gtalk bots not appear online (and not responding), it works now so I'm closing this.
This [tutorial](http://www.labnol.org/internet/tutorial-create-bot-for-gtalk-yahoo-messe... | Taken from the tutorial in case it ever disappears:
>
> **Step 1**: Go to [imified.com](http://imified.com/) and request an invite. You should
> also give your bot a decent name because you can have just one bot per
> email address.
>
>
> **Step 2**: An email with a secret key should arrive in your Inbox the
> n... |
547,347 | <p>How do you do a Remote HTTP Post (request) in C#? </p>
| [
{
"answer_id": 547366,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 2,
"selected": false,
"text": "<p>You can use WCF or create a WebRequest</p>\n\n<pre><code>var httpRequest = (HttpWebRequest)WebRequest.Create(\"http://... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65122/"
] | How do you do a Remote HTTP Post (request) in C#? | This is code from a small app I wrote once to post a form with values to a URL. It should be pretty robust.
\_formValues is a Dictionary<string,string> containing the variables to post and their values.
```
// encode form data
StringBuilder postString = new StringBuilder();
bool first=true;
foreach (KeyValuePair pai... |
547,384 | <p>There are a few ways to include jQuery and jQuery UI and I'm wondering what people are using?</p>
<ul>
<li>Google JSAPI</li>
<li>jQuery's site</li>
<li>your own site/server</li>
<li>another CDN</li>
</ul>
<p>I have recently been using Google JSAPI, but have found that it takes a long time to setup an SSL connectio... | [
{
"answer_id": 547401,
"author": "Mark Hurd",
"author_id": 65714,
"author_profile": "https://Stackoverflow.com/users/65714",
"pm_score": 4,
"selected": false,
"text": "<p>jQuery 1.3.1 min is only 18k in size. I don't think that's too much of a hit to ask on the initial page load. It'll b... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | There are a few ways to include jQuery and jQuery UI and I'm wondering what people are using?
* Google JSAPI
* jQuery's site
* your own site/server
* another CDN
I have recently been using Google JSAPI, but have found that it takes a long time to setup an SSL connection or even only to resolve google.com. I have been... | Without a doubt I choose to have JQuery served by Google API servers. I didn't go with the jsapi method since I don't leverage any other Google API's, however if that ever changed then I would consider it...
**First:** The Google api servers are distributed across the world instead of my single server location: Closer... |
547,391 | <p>In ASP.NET, if I override a page lifecycle event, should I call its base method before or after doing my work? Does it even matter?</p>
<pre><code>protected override void OnPreRender(EventArgs e)
{
// My code goes here
base.OnPreRender(e);
// Or here
}
</code></pre>
| [
{
"answer_id": 547412,
"author": "BC.",
"author_id": 54838,
"author_profile": "https://Stackoverflow.com/users/54838",
"pm_score": 2,
"selected": false,
"text": "<p>The \"OnEvent\" methods in the asp.net event model merely wrap the actual event calls (in this case, the \"PreRender\" even... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] | In ASP.NET, if I override a page lifecycle event, should I call its base method before or after doing my work? Does it even matter?
```
protected override void OnPreRender(EventArgs e)
{
// My code goes here
base.OnPreRender(e);
// Or here
}
``` | Yes you should care. Let's say for a moment that you need to insert a new base class in all of those pages. To me it's easier to just go ahead and call the base methods than have to do a lot of refactoring later.
Then again, maybe you don't need to do that.
**EDIT**
Based on the edit to the question here's some m... |
547,392 | <p>I've been struggling with this for far too long, and I don't see any error. </p>
<p>I've got a table that holds a bunch of locations. When I'm adding a location via my php script, I get an error of 'Wrong parameter count for mysql_query()'. </p>
<p>When I echo the mysql query, everything looks fine,and I can copy ... | [
{
"answer_id": 547396,
"author": "Jeremy DeGroot",
"author_id": 20820,
"author_profile": "https://Stackoverflow.com/users/20820",
"pm_score": 1,
"selected": false,
"text": "<p>That's a PHP error, not a MySQL error. Check your PHP code, and post it if you need more help.</p>\n\n<p>Edited... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48067/"
] | I've been struggling with this for far too long, and I don't see any error.
I've got a table that holds a bunch of locations. When I'm adding a location via my php script, I get an error of 'Wrong parameter count for mysql\_query()'.
When I echo the mysql query, everything looks fine,and I can copy and and paste it... | Try replacing the third line with
```
mysql_query($insertLoc)or die(mysql_error());
```
(Note that I've replaced the second `mysql_query()` with `mysql_error()`.) |
547,408 | <p>I have an swf file which behaves strangely on IE. The thing is that a certain rectangle doesn't get drawn when viewing the page after the first load. It only appears in IE and a quick fix is to make the path to the swf unique on every request so it doesn't get cached. The rest of my objects gets drawn every time.</p... | [
{
"answer_id": 549090,
"author": "grapefrukt",
"author_id": 914,
"author_profile": "https://Stackoverflow.com/users/914",
"pm_score": 0,
"selected": false,
"text": "<p>IE does something strange with cached swf's that makes the stageWidth wrong for the first few frames. The solution is to... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11709/"
] | I have an swf file which behaves strangely on IE. The thing is that a certain rectangle doesn't get drawn when viewing the page after the first load. It only appears in IE and a quick fix is to make the path to the swf unique on every request so it doesn't get cached. The rest of my objects gets drawn every time.
The ... | Don't call drawStage from the constructor. Set up a listener for the ADDED\_TO\_STAGE event in the constructor, and call drawStage from the handler for this event. Additionally, you might find that your Stage dimensions change when the user uses the browser zoom function, so listen out for the RESIZE event and act acco... |
547,422 | <p>I posted a similar question and I got a very useful reply.
Now the question is a little different, so I post it.
I specify it is an XPath 1 related question.
This is the content of my XML file:</p>
<pre><code><?xml version="1.0" encoding="ISO-8859-1"?>
<mainNode>
<subNode>
<h hm="08... | [
{
"answer_id": 547463,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 1,
"selected": false,
"text": "<p>I'll just repeat the last part of my answer to you in that last <a href=\"https://stackoverflow.com/questions/475... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I posted a similar question and I got a very useful reply.
Now the question is a little different, so I post it.
I specify it is an XPath 1 related question.
This is the content of my XML file:
```
<?xml version="1.0" encoding="ISO-8859-1"?>
<mainNode>
<subNode>
<h hm="08:45">
<store id="1563">... | Here is how such an XPatch expression can be constructed:
The following XPath expression selects the wanted result
```
($vOpen[not(count(following-sibling::h[1] | $vOpen)
=
count($vOpen))
][1]/@hm
|
$vOpen[last()]/@hm
)
[1]
```
where `$vOpen`
is defined as:
```
$vge1240[store... |
547,430 | <pre><code>// Reads NetworkStream into a byte buffer.
NetworkStream ns;
System.Net.Sockets.TcpClient client = new TcpClient();
byte[] receiveBytes = new byte[client.ReceiveBufferSize];
ns.Read(receiveBytes, 0, (int)client.ReceiveBufferSize);
String returndata = Encoding.UTF8.GetString(receiveBytes);
</code></pre>
<p... | [
{
"answer_id": 547435,
"author": "jhunter",
"author_id": 51709,
"author_profile": "https://Stackoverflow.com/users/51709",
"pm_score": 3,
"selected": false,
"text": "<p>Are you assigning it to a string or back to itself?</p>\n\n<pre><code>returndata = string.Concat(returndata, \"test\");... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66222/"
] | ```
// Reads NetworkStream into a byte buffer.
NetworkStream ns;
System.Net.Sockets.TcpClient client = new TcpClient();
byte[] receiveBytes = new byte[client.ReceiveBufferSize];
ns.Read(receiveBytes, 0, (int)client.ReceiveBufferSize);
String returndata = Encoding.UTF8.GetString(receiveBytes);
```
I am successfully ... | I believe the problem is related to not keeping track of the total number of bytes read. Your byte buffer, set to ReceiveBufferSize, is more than likely larger than the actual number of bytes read. By taking into account the actual bytes read, and then passing it to the Encoding.UTF8.GetString() method, you should get ... |
547,436 | <p>What's the difference between <code>eq</code>, <code>eql</code>, <code>equal</code> and <code>equalp</code>, in Common Lisp? I understand that some of them check types, some of them check across types an all that, but which is which? When is one better to use than the others?</p>
| [
{
"answer_id": 547451,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 8,
"selected": true,
"text": "<p>From <a href=\"http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html\" rel=\"noreferrer\">Common Lisp: Equalit... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1256/"
] | What's the difference between `eq`, `eql`, `equal` and `equalp`, in Common Lisp? I understand that some of them check types, some of them check across types an all that, but which is which? When is one better to use than the others? | From [Common Lisp: Equality Predicates](http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html)
>
> `(eq x y)` is true if and only if `x` and `y` are the same identical object.
>
>
> The `eql` predicate is true if its arguments are `eq`, or if they are numbers of the same type with the same value, or if they are... |
547,450 | <p>Hi I wonder how you can send info over to a module </p>
<p>An Example
main.py Looks like this</p>
<pre><code>from module import *
print helloworld()
</code></pre>
<p>module.py looks like this</p>
<pre><code>def helloworld():
print "Hello world!"
</code></pre>
<p>Anyway i want to send over info from main... | [
{
"answer_id": 547813,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you have any control over that. And I think you should file a bug report with Apple over that. It sh... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65122/"
] | Hi I wonder how you can send info over to a module
An Example
main.py Looks like this
```
from module import *
print helloworld()
```
module.py looks like this
```
def helloworld():
print "Hello world!"
```
Anyway i want to send over info from main.py to module.py is it possible? | I just did a quick test in here and it's working fine.
I tested with firmware 2.2.1, in the simulator and using a device.
This is what I did to test it:
1- Created a new View-Based project
2- edited the nib in the Interface Builder, added a UITextView, setting the text to white and the background to gray, leaving eve... |
547,457 | <p>Inherited an app with a page that has a link that calls the javascript function addValueClick(), when I do this a dialog box pops up, I type in some text, and then the text gets put in the select box. Every time a new option is added to the select it gets about 5 pixels narrower. I can't figure out why this is happ... | [
{
"answer_id": 547813,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you have any control over that. And I think you should file a bug report with Apple over that. It sh... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51709/"
] | Inherited an app with a page that has a link that calls the javascript function addValueClick(), when I do this a dialog box pops up, I type in some text, and then the text gets put in the select box. Every time a new option is added to the select it gets about 5 pixels narrower. I can't figure out why this is happenin... | I just did a quick test in here and it's working fine.
I tested with firmware 2.2.1, in the simulator and using a device.
This is what I did to test it:
1- Created a new View-Based project
2- edited the nib in the Interface Builder, added a UITextView, setting the text to white and the background to gray, leaving eve... |
547,467 | <p><strong>BACKGROUND:**I am running **MS2005</strong>. I have a MASTER table (ID, MDESC) and a DETAIL table (MID, DID, DDESC) with data as follows</p>
<pre><code>1 MASTER_1
2 MASTER_2
1 L1 DETAIL_M1_L1
1 L2 DETAIL_M1_L2
1 L3 DETAIL_M1_L3
2 L1 DETAIL_M2_L1
2 L2 DETAIL_M2_L2
</code></pre>
<p>If I join the tables with... | [
{
"answer_id": 547473,
"author": "user53794",
"author_id": 53794,
"author_profile": "https://Stackoverflow.com/users/53794",
"pm_score": 1,
"selected": false,
"text": "<p>coalesce is your friend.</p>\n\n<pre><code>declare @CSL vachar(max)\n\nset @CSL = NULL\nselect @CSL = coalesce(@CSL +... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12113/"
] | **BACKGROUND:\*\*I am running \*\*MS2005**. I have a MASTER table (ID, MDESC) and a DETAIL table (MID, DID, DDESC) with data as follows
```
1 MASTER_1
2 MASTER_2
1 L1 DETAIL_M1_L1
1 L2 DETAIL_M1_L2
1 L3 DETAIL_M1_L3
2 L1 DETAIL_M2_L1
2 L2 DETAIL_M2_L2
```
If I join the tables with
```
SELECT M.*, D.DID FROM MASTER... | Thanks to the concept in the link from Bill Karwin, it's the **CROSS APPLY** that makes it work
```
SELECT ID, DES, LEFT(DIDS, LEN(DIDS)-1) AS DIDS
FROM MASTER M1 INNER JOIN DETAIL D on M1.ID = D.MID
CROSS APPLY (
SELECT DID + ', '
FROM MASTER M2 INNER JOIN DETAIL D on M2.ID = D.MID
WHERE M1.ID = M2.I... |
547,472 | <p>I have a very large column-delimited file coming out of a database report in something like this:</p>
<pre><code>field1,field2,field3,metricA,value1
field1,field2,field3,metricB,value2
</code></pre>
<p>I want the new file to have combine lines like this so it would look something like this:</p>
<pre><code>field1,... | [
{
"answer_id": 547491,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 2,
"selected": false,
"text": "<p>Would it not be better to make another export directly from the database into your new file instead of reworking t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59929/"
] | I have a very large column-delimited file coming out of a database report in something like this:
```
field1,field2,field3,metricA,value1
field1,field2,field3,metricB,value2
```
I want the new file to have combine lines like this so it would look something like this:
```
field1,field2,field3,value1,value2
```
I'm... | If your rows are sorted on the key, or for some other reason equal values of field1,field2,field3 are adjacent, then a state machine will be much faster. Just read over the lines and if the fields are the same as the previous line, emit both values.
Otherwise, at least, you can take advantage of the fact that you hav... |
547,480 | <pre><code><SCRIPT LANGUAGE="JavaScript">
DynamicImage1(xx) DynamicImage2(yy) DynamicImage3(zz)
</SCRIPT>
</code></pre>
<p>This snippet of JS is in my HTML sheet.
(Each function will display a different value based on the input parameter.)</p>
<p>How do I set the spacing between these images? I would... | [
{
"answer_id": 547491,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 2,
"selected": false,
"text": "<p>Would it not be better to make another export directly from the database into your new file instead of reworking t... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52256/"
] | ```
<SCRIPT LANGUAGE="JavaScript">
DynamicImage1(xx) DynamicImage2(yy) DynamicImage3(zz)
</SCRIPT>
```
This snippet of JS is in my HTML sheet.
(Each function will display a different value based on the input parameter.)
How do I set the spacing between these images? I would like them all on the same row (as the... | If your rows are sorted on the key, or for some other reason equal values of field1,field2,field3 are adjacent, then a state machine will be much faster. Just read over the lines and if the fields are the same as the previous line, emit both values.
Otherwise, at least, you can take advantage of the fact that you hav... |
547,486 | <p>I just had a similar (but not exact) question answered. Now I need help with the question mentioned below.</p>
<p>I want to write a regex which matches a character if its a non word, non digit and non star (*) character. So, the characters <code>[0-9][a-z][A-Z] *</code> should not match and the others should.</p>
... | [
{
"answer_id": 547498,
"author": "Zach Scrivena",
"author_id": 20029,
"author_profile": "https://Stackoverflow.com/users/20029",
"pm_score": 5,
"selected": true,
"text": "<p>Try this instead:</p>\n\n<pre><code>[^\\w\\*]\n</code></pre>\n"
},
{
"answer_id": 547504,
"author": "T... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55176/"
] | I just had a similar (but not exact) question answered. Now I need help with the question mentioned below.
I want to write a regex which matches a character if its a non word, non digit and non star (\*) character. So, the characters `[0-9][a-z][A-Z] *` should not match and the others should.
I tried writing `[\W[^*]... | Try this instead:
```
[^\w\*]
``` |
547,495 | <p>I have the following code:</p>
<pre><code><div id="banner">
<a href="http://www.kiubbo.com"><img src="/Logot.png" border=0></a>
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxx";
/* 468x60, creado 13/02/09 */
google_ad_slot = "7830464... | [
{
"answer_id": 547533,
"author": "Bryan A",
"author_id": 29707,
"author_profile": "https://Stackoverflow.com/users/29707",
"pm_score": 3,
"selected": true,
"text": "<p>Try:</p>\n\n<pre><code><style type=\"text/css\">\n #banner a {\n float: left;\n }\n #banner iframe {\n ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2170954/"
] | I have the following code:
```
<div id="banner">
<a href="http://www.kiubbo.com"><img src="/Logot.png" border=0></a>
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxx";
/* 468x60, creado 13/02/09 */
google_ad_slot = "7830464607";
google_ad_width = 468;
go... | Try:
```
<style type="text/css">
#banner a {
float: left;
}
#banner iframe {
float: left;
}
.clear { clear: both; }
</style>
```
And put this after the last script tag inside the banner div:
```
<div class="clear"></div>
``` |
547,501 | <p>I've got an ASP.NET application that is trying to delete a file on a network share. The ASP.NET application's worker process is running under a domain account (confirmed this by looking in TaskManager and by using ShowContexts2.aspx¹). </p>
<p>I've been assured by the network admins that the process account is a m... | [
{
"answer_id": 547533,
"author": "Bryan A",
"author_id": 29707,
"author_profile": "https://Stackoverflow.com/users/29707",
"pm_score": 3,
"selected": true,
"text": "<p>Try:</p>\n\n<pre><code><style type=\"text/css\">\n #banner a {\n float: left;\n }\n #banner iframe {\n ... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've got an ASP.NET application that is trying to delete a file on a network share. The ASP.NET application's worker process is running under a domain account (confirmed this by looking in TaskManager and by using ShowContexts2.aspx¹).
I've been assured by the network admins that the process account is a member of a ... | Try:
```
<style type="text/css">
#banner a {
float: left;
}
#banner iframe {
float: left;
}
.clear { clear: both; }
</style>
```
And put this after the last script tag inside the banner div:
```
<div class="clear"></div>
``` |
547,503 | <p>I want url's like index.php?showuser=512, index.php?shownews=317 for pages i get content from db... and for regular pages index.php?page=about and so on WITHOUT mod-rewrite.</p>
<p>Invision Power Board has urls like this. I have looked through their code but I can't figure out how they do it.</p>
<p>I could do it ... | [
{
"answer_id": 547561,
"author": "Henrik Paul",
"author_id": 2238,
"author_profile": "https://Stackoverflow.com/users/2238",
"pm_score": 3,
"selected": true,
"text": "<p>I don't know how IPB does this, let's get that out of the way. But, this is how <em>I</em> would approach this problem... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want url's like index.php?showuser=512, index.php?shownews=317 for pages i get content from db... and for regular pages index.php?page=about and so on WITHOUT mod-rewrite.
Invision Power Board has urls like this. I have looked through their code but I can't figure out how they do it.
I could do it like this:
```
i... | I don't know how IPB does this, let's get that out of the way. But, this is how *I* would approach this problem:
First, I recognize that there are two kinds of GET parameters: page/identifier, and just page. These would get tested separately.
Second, I recognize that all all get parameters match their filenames sans ... |
547,512 | <p>Using SQL Server 2005 I have a field that contains a datetime value.</p>
<p>What I am trying to do is create 2 queries:</p>
<ol>
<li>Compare to see if stored datetime is of the same month+year as current date</li>
<li>Compare to see if stored datetime is of the same year as current date</li>
</ol>
<p>There is pro... | [
{
"answer_id": 547521,
"author": "Ryan Emerle",
"author_id": 62195,
"author_profile": "https://Stackoverflow.com/users/62195",
"pm_score": 4,
"selected": true,
"text": "<p>Compare the parts of the date:</p>\n\n<pre><code>WHERE YEAR( columnName ) = YEAR( getDate() )\n</code></pre>\n"
},... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Using SQL Server 2005 I have a field that contains a datetime value.
What I am trying to do is create 2 queries:
1. Compare to see if stored datetime is of the same month+year as current date
2. Compare to see if stored datetime is of the same year as current date
There is probably a simple solution but I keep hitti... | Compare the parts of the date:
```
WHERE YEAR( columnName ) = YEAR( getDate() )
``` |
547,539 | <p>My most used mini pattern is:</p>
<pre><code>VideoLookup = new ArrayList { new ArrayList { buttonVideo1, "Video01.flv" },
new ArrayList { buttonVideo2, "Video02.flv" },
new ArrayList { buttonVideo3, "Video03.flv" },
new A... | [
{
"answer_id": 547560,
"author": "BobbyShaftoe",
"author_id": 38426,
"author_profile": "https://Stackoverflow.com/users/38426",
"pm_score": 3,
"selected": true,
"text": "<p>You could just create a struct or object that has a button reference and a string representing the file name and th... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4500/"
] | My most used mini pattern is:
```
VideoLookup = new ArrayList { new ArrayList { buttonVideo1, "Video01.flv" },
new ArrayList { buttonVideo2, "Video02.flv" },
new ArrayList { buttonVideo3, "Video03.flv" },
new ArrayList { but... | You could just create a struct or object that has a button reference and a string representing the file name and then a List of these things. Or, you could just use a Dictionary and make it even easier on yourself. Lots of ways to improve. :) |
547,542 | <p>Suppose I have two columns, keywords and content. I have a fulltext index across both. I want a row with foo in the keywords to have more relevance than a row with foo in the content. What do I need to do to cause MySQL to weight the matches in keywords higher than those in content? </p>
<p>I'm using the "match aga... | [
{
"answer_id": 547567,
"author": "adamJLev",
"author_id": 26192,
"author_profile": "https://Stackoverflow.com/users/26192",
"pm_score": -1,
"selected": false,
"text": "<p>As far as I know, this isn't supported with MySQL fulltext search, but you can achieve the effect by somehow repeatin... | 2009/02/13 | [
"https://Stackoverflow.com/questions/547542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13113/"
] | Suppose I have two columns, keywords and content. I have a fulltext index across both. I want a row with foo in the keywords to have more relevance than a row with foo in the content. What do I need to do to cause MySQL to weight the matches in keywords higher than those in content?
I'm using the "match against" synt... | Actually, using a case statement to make a pair of flags might be a better solution:
```
select
...
, case when keyword like '%' + @input + '%' then 1 else 0 end as keywordmatch
, case when content like '%' + @input + '%' then 1 else 0 end as contentmatch
-- or whatever check you use for the matching
from
...
... |