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 |
|---|---|---|---|---|---|---|
228,268 | <p><a href="http://blogs.msdn.com/drnick/archive/2007/03/23/preventing-anonymous-access.aspx" rel="noreferrer">http://blogs.msdn.com/drnick/archive/2007/03/23/preventing-anonymous-access.aspx</a> </p>
<p>Can someone clarify whether it is possible to use wsHttpBinding in WCF and disable anonymous access in IIS without ... | [
{
"answer_id": 232142,
"author": "Keith Patton",
"author_id": 25255,
"author_profile": "https://Stackoverflow.com/users/25255",
"pm_score": 0,
"selected": false,
"text": "<p>we want to use windows integrated security. If you disable anonymous access in IIS and allow just windows, you can... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25255/"
] | <http://blogs.msdn.com/drnick/archive/2007/03/23/preventing-anonymous-access.aspx>
Can someone clarify whether it is possible to use wsHttpBinding in WCF and disable anonymous access in IIS without transport (ssl) or message security being required? | you are right, afaik in the scenario you describe wsHttpBinding requires us to use the internal WCF security stack. So what you would typically do is
* leave anonymous access enabled
* create a serviceBehavior with <serviceAuthorization principalPermissionMode="UseWindowsGroups" />
* annotate every concrete implementa... |
228,274 | <p>I have a block of code intended to pull text descriptions from a database table and save them to a text file. It looks like this (C# .NET):</p>
<pre><code> OdbcCommand getItemsCommand = new OdbcCommand("SELECT ID FROM ITEMS", databaseConnection);
OdbcDataReader getItemsReader = getItemsCommand.Execut... | [
{
"answer_id": 228365,
"author": "mmcdole",
"author_id": 2635,
"author_profile": "https://Stackoverflow.com/users/2635",
"pm_score": 5,
"selected": true,
"text": "<p>As I understand, the first time you run D* it finds the same path as A* with nearly the same runtime. However, when a nod... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8409/"
] | I have a block of code intended to pull text descriptions from a database table and save them to a text file. It looks like this (C# .NET):
```
OdbcCommand getItemsCommand = new OdbcCommand("SELECT ID FROM ITEMS", databaseConnection);
OdbcDataReader getItemsReader = getItemsCommand.ExecuteReader();
... | As I understand, the first time you run D\* it finds the same path as A\* with nearly the same runtime. However, when a node changes it's edge value or nodes are added A\* recomputes ALL of the path while D\* simply recomputes the inconsistent nodes the second time around rather than the whole thing.
Anthony Stentz's ... |
228,319 | <p>I am using a navigation controller, and I have the style set to :</p>
<pre><code>navController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
</code></pre>
<p>But when I run my program, the navigation controller looks like it is on top of a white background, not my background. When I push a controller, left ... | [
{
"answer_id": 228349,
"author": "Marco",
"author_id": 30480,
"author_profile": "https://Stackoverflow.com/users/30480",
"pm_score": 4,
"selected": true,
"text": "<p>I believe the UINavigationController assumes that your controller view frames don't include the area beneath the navigatio... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29642/"
] | I am using a navigation controller, and I have the style set to :
```
navController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
```
But when I run my program, the navigation controller looks like it is on top of a white background, not my background. When I push a controller, left or right, all my view, the... | I believe the UINavigationController assumes that your controller view frames don't include the area beneath the navigation bar.
UIBarStyleBlackTranslucent is more often used for UIToolbar, so Apple probably didn't make it easy to use it nicely with UINavigationBar. You'll probably need to abandon the UINavigationCont... |
228,321 | <p>On an embedded target I use far pointers to access some parts of the memory map. </p>
<p>near pointer (without explicitely specifying __near):</p>
<pre>unsigned int *VariableOnePtr;</pre>
<p>Pointer to near pointer: <pre>unsigned int **VariableOnePtrPtr;</pre></p>
<p>far pointer: <pre>unsigned int *__far Variabl... | [
{
"answer_id": 228331,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": true,
"text": "<p>I believe you would do this:</p>\n\n<pre><code>unsigned int * __far *VariableThreePtrPtr;\n</code></pre>\n\n<p>A far po... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2386/"
] | On an embedded target I use far pointers to access some parts of the memory map.
near pointer (without explicitely specifying \_\_near):
```
unsigned int *VariableOnePtr;
```
Pointer to near pointer:
```
unsigned int **VariableOnePtrPtr;
```
far pointer:
```
unsigned int *__far VariableTwoPtr;
```
What is the c... | I believe you would do this:
```
unsigned int * __far *VariableThreePtrPtr;
```
A far pointer to a far pointer would be:
```
unsigned int * __far * __far VariableFourPtrPtr;
``` |
228,353 | <p>A lambda expression which takes a function (of one argument) and a number, and applies the function to twice the number.</p>
| [
{
"answer_id": 228361,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<p>Applying the function to twice the number:</p>\n\n<pre><code>(lambda (f x) (f (* 2 x)))\n</code></pre>\n\n<p>Applying ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30622/"
] | A lambda expression which takes a function (of one argument) and a number, and applies the function to twice the number. | Applying the function to twice the number:
```
(lambda (f x) (f (* 2 x)))
```
Applying the function to the number twice (which is what you may have intended to ask):
```
(lambda (f x) (f (f x)))
``` |
228,377 | <p>I want to run a psychological study for which participants have to look at large images.</p>
<p>The experiment is done on the web and therefore in a browser window. Is it possible to tell the browser to go into fullscreen, for example on button press?</p>
<p>I know there is the possibility to open a fixed-size pop... | [
{
"answer_id": 228383,
"author": "Scottie T",
"author_id": 6688,
"author_profile": "https://Stackoverflow.com/users/6688",
"pm_score": 0,
"selected": false,
"text": "<p>F11 takes IE and Firefox into fullscreen mode. I'm sure it's possible to go fullscreen, since YouTube and other video ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21974/"
] | I want to run a psychological study for which participants have to look at large images.
The experiment is done on the web and therefore in a browser window. Is it possible to tell the browser to go into fullscreen, for example on button press?
I know there is the possibility to open a fixed-size popup window. Do you... | I have found some code after searching.
```
function fullscreen() {
var element = document.getElementById("content");
if (element.requestFullScreen) {
if (!document.fullScreen) {
element.requestFullscreen();
$(".fullscreen").attr('src',"img/icons/panel_resize_actual.png");
... |
228,382 | <p>I need to parse a large amount of text that uses HTML font tags for formatting,</p>
<p>For example:</p>
<pre><code><font face="fontname" ...>Some text</font>
</code></pre>
<p>Specifically, I need to determine which characters would be rendered using each font used in the text. I need to be able to han... | [
{
"answer_id": 228391,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 2,
"selected": false,
"text": "<p>I have not used it, but I have seen the <a href=\"http://www.codeplex.com/htmlagilitypack\" rel=\"nofollow noreferre... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18494/"
] | I need to parse a large amount of text that uses HTML font tags for formatting,
For example:
```
<font face="fontname" ...>Some text</font>
```
Specifically, I need to determine which characters would be rendered using each font used in the text. I need to be able to handle stuff like font tags inside another font ... | I have not used it, but I have seen the [HTML Agility Pack](http://www.codeplex.com/htmlagilitypack) frequently mentioned for this type of thing. |
228,412 | <p>If you could help me with ANY part of this question, I would appreciate it. Thanks.</p>
<pre><code>2^0 = 1
2^N = 2^(N-1) + 2^(N-1)
</code></pre>
<ol>
<li><p>Convert this definition into an exactly equivalent tree-recursive function called two-to-the-power-of. Describe its asymptotic time complexity and explain why... | [
{
"answer_id": 228415,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 4,
"selected": true,
"text": "<p>The hues of magenta, yellow, and cyan are primary for subtractive combination (e.g. paints or inks) rather than addit... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30622/"
] | If you could help me with ANY part of this question, I would appreciate it. Thanks.
```
2^0 = 1
2^N = 2^(N-1) + 2^(N-1)
```
1. Convert this definition into an exactly equivalent tree-recursive function called two-to-the-power-of. Describe its asymptotic time complexity and explain why it has this time complexity.
2.... | The hues of magenta, yellow, and cyan are primary for subtractive combination (e.g. paints or inks) rather than additive combination such as light where red, green, and blue are primary.
[Wikipedia has more detail on the whys and wherefores](http://en.wikipedia.org/wiki/Primary_colors). |
228,424 | <p>I have the following query:</p>
<pre><code>SELECT c.*
FROM companies AS c
JOIN users AS u USING(companyid)
JOIN jobs AS j USING(userid)
JOIN useraccounts AS us USING(userid)
WHERE j.jobid = 123;
</code></pre>
<p>I have the following questions:</p>
<ol>
<li>Is the USING syntax synonymous with ON syntax?</li>
<li>A... | [
{
"answer_id": 228466,
"author": "micahwittman",
"author_id": 11181,
"author_profile": "https://Stackoverflow.com/users/11181",
"pm_score": 0,
"selected": false,
"text": "<p>SEE <a href=\"http://dev.mysql.com/doc/refman/5.0/en/join.html\" rel=\"nofollow noreferrer\">http://dev.mysql.com/... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2056/"
] | I have the following query:
```
SELECT c.*
FROM companies AS c
JOIN users AS u USING(companyid)
JOIN jobs AS j USING(userid)
JOIN useraccounts AS us USING(userid)
WHERE j.jobid = 123;
```
I have the following questions:
1. Is the USING syntax synonymous with ON syntax?
2. Are these joins evaluated left to right? In... | 1. USING (fieldname) is a shorthand way of saying ON table1.fieldname = table2.fieldname.
2. SQL doesn't define the 'order' in which JOINS are done because it is not the nature of the language. Obviously an order has to be specified in the statement, but an INNER JOIN can be considered commutative: you can list them in... |
228,441 | <p>I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call <code>logger.error $!</code> to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exceptio... | [
{
"answer_id": 228467,
"author": "Redbeard",
"author_id": 14977,
"author_profile": "https://Stackoverflow.com/users/14977",
"pm_score": 3,
"selected": false,
"text": "<p><code>logger.error caller.join(\"\\n\")</code> should do the trick.</p>\n"
},
{
"answer_id": 236350,
"auth... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5004/"
] | I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call `logger.error $!` to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exception using the defau... | ```
logger.error $!.backtrace
```
Also, don't forget you can
```
rescue ErrorType => error_name
```
to give your error a variable name other than the default `$!`. |
228,476 | <p>Taking over some code from my predecessor and I found a query that uses the Like operator:</p>
<pre><code>SELECT * FROM suppliers
WHERE supplier_name like '%'+name+%';
</code></pre>
<p>Trying to avoid SQL Injection problem and parameterize this but I am not quite sure how this would be accomplished. Any suggestions ... | [
{
"answer_id": 228488,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 3,
"selected": false,
"text": "<p>Simply parameterize your query:</p>\n\n<pre><code>SELECT * FROM suppliers WHERE supplier_name like '%' + @name + '%'\... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10676/"
] | Taking over some code from my predecessor and I found a query that uses the Like operator:
```
SELECT * FROM suppliers
WHERE supplier_name like '%'+name+%';
```
Trying to avoid SQL Injection problem and parameterize this but I am not quite sure how this would be accomplished. Any suggestions ?
note, I need a soluti... | try this:
```
var query = "select * from foo where name like @searchterm";
using (var command = new SqlCommand(query, connection))
{
command.Parameters.AddWithValue("@searchterm", String.Format("%{0}%", searchTerm));
var result = command.ExecuteReader();
}
```
the framework will automatically deal with the quot... |
228,477 | <p>I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on a Windows or Unix platform). What is the safest way to do this with 100% reliability?</p>
| [
{
"answer_id": 228481,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 10,
"selected": true,
"text": "<p>You can use:</p>\n\n<pre><code>System.getProperty(\"os.name\")\n</code></pre>\n\n<p>P.S. You may find this code useful:</... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/318/"
] | I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on a Windows or Unix platform). What is the safest way to do this with 100% reliability? | You can use:
```
System.getProperty("os.name")
```
P.S. You may find this code useful:
```
class ShowProperties {
public static void main(String[] args) {
System.getProperties().list(System.out);
}
}
```
All it does is print out all the properties provided by your Java implementations. It'll give ... |
228,518 | <p>The goal: Any language. The smallest function which will return whether a string is a palindrome. Here is mine in <b>Python</b>:</p>
<pre><code>R=lambda s:all(a==b for a,b in zip(s,reversed(s)))
</code></pre>
<p>50 characters.</p>
<p>The accepted answer will be the current smallest one - this will change as small... | [
{
"answer_id": 228526,
"author": "Menkboy",
"author_id": 29539,
"author_profile": "https://Stackoverflow.com/users/29539",
"pm_score": 5,
"selected": false,
"text": "<p>Here's mine; it's written in a domain-specific language I invented, called 'palindrome'.</p>\n\n<pre><code>p\n</code></... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | The goal: Any language. The smallest function which will return whether a string is a palindrome. Here is mine in **Python**:
```
R=lambda s:all(a==b for a,b in zip(s,reversed(s)))
```
50 characters.
The accepted answer will be the current smallest one - this will change as smaller ones are found. Please specify th... | 7 characters in J: Not sure if this is the best way, I'm somewhat new to J :)
```
p=:-:|.
```
explanation: |. reverses the input. -: compares. the operands are implicit.
```
p 'radar'
1
p 'moose'
0
``` |
228,523 | <p>Following on from <a href="https://stackoverflow.com/questions/223832/check-a-string-to-see-if-all-characters-are-hexadecimal-values">this question</a> what would be the best way to write a Char.IsHex() function in C#. So far I've got this but don't like it:</p>
<pre><code>bool CharIsHex(char c) {
c = Char.ToLo... | [
{
"answer_id": 228531,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 5,
"selected": true,
"text": "<p>From <a href=\"https://stackoverflow.com/questions/223832/check-a-string-to-see-if-all-characters-are-hexadecimal-values... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | Following on from [this question](https://stackoverflow.com/questions/223832/check-a-string-to-see-if-all-characters-are-hexadecimal-values) what would be the best way to write a Char.IsHex() function in C#. So far I've got this but don't like it:
```
bool CharIsHex(char c) {
c = Char.ToLower(c);
return (Char.... | From [my answer](https://stackoverflow.com/questions/223832/check-a-string-to-see-if-all-characters-are-hexadecimal-values#223854) to the question you linked to:
```
bool is_hex_char = (c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F');
``` |
228,532 | <p>What's the difference between <code>Char.IsDigit()</code> and <code>Char.IsNumber()</code> in C#?</p>
| [
{
"answer_id": 228538,
"author": "Guy",
"author_id": 1463,
"author_profile": "https://Stackoverflow.com/users/1463",
"pm_score": 6,
"selected": false,
"text": "<p>I found the answer:</p>\n\n<blockquote>\n <p>Char.IsNumber() determines if a Char\n is of any numeric Unicode category.\n ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | What's the difference between `Char.IsDigit()` and `Char.IsNumber()` in C#? | `Char.IsDigit()` is a subset of `Char.IsNumber()`.
Some of the characters that are 'numeric' but not digits include 0x00b2 and 0x00b3 which are superscripted 2 and 3 ('²' and '³') and the glyphs that are fractions such as '¼', '½', and '¾'.
Note that there are quite a few characters that `IsDigit()` returns `true` fo... |
228,544 | <p>If I want to check for the null string I would do</p>
<pre><code>[ -z $mystr ]
</code></pre>
<p>but what if I want to check whether the variable has been defined at all? Or is there no distinction in Bash scripting?</p>
| [
{
"answer_id": 228552,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 5,
"selected": false,
"text": "<pre><code>~> if [ -z $FOO ]; then echo \"EMPTY\"; fi\nEMPTY\n~> FOO=\"\"\n~> if [ -z $FOO ]; then echo \"E... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30636/"
] | If I want to check for the null string I would do
```
[ -z $mystr ]
```
but what if I want to check whether the variable has been defined at all? Or is there no distinction in Bash scripting? | I think the answer you are after is implied (if not stated) by [Vinko](https://stackoverflow.com/users/5190/vinko-vrsalovic)'s [answer](https://stackoverflow.com/a/228552/15168), though it is not spelled out simply. To distinguish whether VAR is set but empty or not set, you can use:
```
if [ -z "${VAR+xxx}" ]; then e... |
228,545 | <p>A legacy backend requires the email body with a .tif document, no tif and it fails. So i need to generate a blank .tif, is there a fast way to do this with ghostscript? </p>
<hr>
<p>edit: make once in project installation use when i need it.</p>
| [
{
"answer_id": 228579,
"author": "fryguybob",
"author_id": 4592,
"author_profile": "https://Stackoverflow.com/users/4592",
"pm_score": 0,
"selected": false,
"text": "<p>Couldn't you make your blank .tif file once and then attach the same file every time it is needed?</p>\n"
},
{
... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21537/"
] | A legacy backend requires the email body with a .tif document, no tif and it fails. So i need to generate a blank .tif, is there a fast way to do this with ghostscript?
---
edit: make once in project installation use when i need it. | The following line will produce a 1 pixel Tiff file (340 bytes). That's the smallest Tiff file I could get.
```
gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffpack -g1x1 -sOutputFile=small.tif -c newpath 0 0 moveto 1 1 lineto closepath stroke showpage quit
```
Actually, you can even reduce the command to:
```
gswin32c.exe ... |
228,549 | <p>I have GridView which I can select a row. I then have a button above the grid called Edit which the user can click to popup a window and edit the selected row. So the button will have Javascript code behind it along the lines of</p>
<pre><code>function editRecord()
{
var gridView = document.getElementById("<%=... | [
{
"answer_id": 228556,
"author": "Dave K",
"author_id": 19864,
"author_profile": "https://Stackoverflow.com/users/19864",
"pm_score": 1,
"selected": false,
"text": "<p>1) change your javascript function to use a parameter</p>\n\n<pre><code>function editRecord(clientId)\n{ ....\n</code></... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27294/"
] | I have GridView which I can select a row. I then have a button above the grid called Edit which the user can click to popup a window and edit the selected row. So the button will have Javascript code behind it along the lines of
```
function editRecord()
{
var gridView = document.getElementById("<%= GridView.ClientI... | I worked it out based on JasonS response. What I did was create a hidden field in the Grid View like this:
```
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:HiddenField ID="hdID" runat="server" Value='<%# Eval("JobID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="F... |
228,559 | <p>currently i obtain the below result from the following C# line of code when in es-MX Culture</p>
<pre><code> Thread.CurrentThread.CurrentCulture =
Thread.CurrentThread.CurrentUICulture = new
CultureInfo("es-mx");
<span><%=DateTime.Now.ToLongDateString()%></span>
</code><... | [
{
"answer_id": 228582,
"author": "jfs",
"author_id": 718,
"author_profile": "https://Stackoverflow.com/users/718",
"pm_score": 1,
"selected": false,
"text": "<p>The pattern of LongDate for Spanish (Mexico) is</p>\n\n<blockquote>\n <p><code>dddd, dd' de 'MMMM' de 'yyyy</code></p>\n</bloc... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14440/"
] | currently i obtain the below result from the following C# line of code when in es-MX Culture
```
Thread.CurrentThread.CurrentCulture =
Thread.CurrentThread.CurrentUICulture = new
CultureInfo("es-mx");
<span><%=DateTime.Now.ToLongDateString()%></span>
```
miércoles, 22 de octubre de 2008
==... | You don't need to build your own culture. You only need to change the property DateTimeFormat.DayNames and DateTimeFormat.MonthNames in the current culture.
i.e.
```
string[] newNames = { "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado", "Domingo" };
Thread.CurrentThread.CurrentCulture.Da... |
228,567 | <p>I have a section of makefile that has this sort of structure:</p>
<pre><code>
bob:
ifdef DEBUG
@echo running
endif
@echo chug chug chug
ifdef DEBUG
@echo done
endif
bobit:
@echo "before"
@make bob
@echo "after"
</code></pre>
<p>I'm simplifying greatly here, all the echo's are actually ... | [
{
"answer_id": 233014,
"author": "Gordon Wrigley",
"author_id": 10471,
"author_profile": "https://Stackoverflow.com/users/10471",
"pm_score": 3,
"selected": true,
"text": "<p>The way I have fixed this is to use bash conditionals instead, which actually makes a certain amount of sense sin... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10471/"
] | I have a section of makefile that has this sort of structure:
```
bob:
ifdef DEBUG
@echo running
endif
@echo chug chug chug
ifdef DEBUG
@echo done
endif
bobit:
@echo "before"
@make bob
@echo "after"
```
I'm simplifying greatly here, all the echo's are actually non trivial blocks of comm... | The way I have fixed this is to use bash conditionals instead, which actually makes a certain amount of sense since we are playing with commands and not make rules.
So my ideal solution from above becomes something like
```
define BOB_BODY
@if [[ -n "$(DEBUG)" ]]; then \
echo running; \
fi;
@echo... |
228,590 | <p>A couple of the options are:</p>
<pre><code>$connection = {my db connection/object};
function PassedIn($connection) { ... }
function PassedByReference(&$connection) { ... }
function UsingGlobal() {
global $connection;
...
}
</code></pre>
<p>So, passed in, passed by reference, or using global. I'm th... | [
{
"answer_id": 228596,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 0,
"selected": false,
"text": "<p>None of the above.</p>\n\n<p>All the <code>mysql</code> functions take the database connection argument <em>optionally<... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | A couple of the options are:
```
$connection = {my db connection/object};
function PassedIn($connection) { ... }
function PassedByReference(&$connection) { ... }
function UsingGlobal() {
global $connection;
...
}
```
So, passed in, passed by reference, or using global. I'm thinking in functions that are o... | I use a Singleton ResourceManager class to handle stuff like DB connections and config settings through a whole app:
```
class ResourceManager {
private static $DB;
private static $Config;
public static function get($resource, $options = false) {
if (property_exists('ResourceManager', $resource)) ... |
228,595 | <p>I have an ADO.Net Data Service that I am using to do a data import. There are a number of entities that are linked to by most entities. To do that during import I create those entities first, save them and then use .SetLink(EntityImport, "NavigationProperty", CreatedEntity). Now the first issue that I ran into wa... | [
{
"answer_id": 228800,
"author": "Davy Landman",
"author_id": 11098,
"author_profile": "https://Stackoverflow.com/users/11098",
"pm_score": 3,
"selected": false,
"text": "<p>I think you should look at the <a href=\"http://msdn.microsoft.com/en-us/library/system.data.entitystate.aspx\" re... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25719/"
] | I have an ADO.Net Data Service that I am using to do a data import. There are a number of entities that are linked to by most entities. To do that during import I create those entities first, save them and then use .SetLink(EntityImport, "NavigationProperty", CreatedEntity). Now the first issue that I ran into was that... | I think you should look at the [EntityState](http://msdn.microsoft.com/en-us/library/system.data.entitystate.aspx) property of your entity.
Only if it is of the value EntityState.Detached than you have to add it to your context.
Do not forget the following remark:
>
> This enumeration has a FlagsAttribute
> attrib... |
228,614 | <p>This is a bit of a lazyweb question but you get the rep so :-)</p>
<p>I have a Java class that returns instances of itself to allow chaining
(e.g. ClassObject.doStuff().doStuff())</p>
<p>For instance:</p>
<pre><code>public class Chainer
{
public Chainer doStuff()
{
/* Do stuff ... */
return... | [
{
"answer_id": 228632,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 1,
"selected": false,
"text": "<p>Could you just post a complete example leading to the error message you see ?</p>\n\n<p>I just compiled and execute the foll... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364/"
] | This is a bit of a lazyweb question but you get the rep so :-)
I have a Java class that returns instances of itself to allow chaining
(e.g. ClassObject.doStuff().doStuff())
For instance:
```
public class Chainer
{
public Chainer doStuff()
{
/* Do stuff ... */
return this;
}
}
```
I would... | Have you tried the straight-forward
```
public class Chainer
{
public Chainer doStuff()
{
/* Do stuff ... */
return this;
}
}
public class ChainerExtender extends Chainer
{
@Override
public ChainerExtender doStuff()
{
/* Do stuff ... */
super.doStuff();
retur... |
228,623 | <p>This may be a simple fix - but I'm trying to sum together all the nodes (Size property from the Node class) on the binary search tree. Below in my BST class I have the following so far, but it returns 0:</p>
<pre><code> private long sum(Node<T> thisNode)
{
if (thisNode.Left == null && t... | [
{
"answer_id": 228631,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe you meant </p>\n\n<pre><code> if (thisNode.Left == null && thisNode.Right == null)\n retu... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30649/"
] | This may be a simple fix - but I'm trying to sum together all the nodes (Size property from the Node class) on the binary search tree. Below in my BST class I have the following so far, but it returns 0:
```
private long sum(Node<T> thisNode)
{
if (thisNode.Left == null && thisNode.Right == null)
... | It's because you're returning zero when you reach a leaf node. You should be returning the size stored in that leaf node.
In addition, if your non-leaf nodes also have a size, you'll need to process them as well thus:
```
private long sum(Node<T> thisNode)
{
if (thisNode.Left == null && thisNode.Right == null)
... |
228,642 | <p>Python is quite cool, but unfortunately, its debugger is not as good as perl -d. </p>
<p>One thing that I do very commonly when experimenting with code is to call a function from within the debugger, and step into that function, like so:</p>
<pre><code># NOTE THAT THIS PROGRAM EXITS IMMEDIATELY WITHOUT CALLING FO... | [
{
"answer_id": 228653,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 6,
"selected": false,
"text": "<p>And I've answered my own question! It's the \"debug\" command in pydb:</p>\n\n<pre><code>~> cat -n /tmp/test_python.py\... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Python is quite cool, but unfortunately, its debugger is not as good as perl -d.
One thing that I do very commonly when experimenting with code is to call a function from within the debugger, and step into that function, like so:
```
# NOTE THAT THIS PROGRAM EXITS IMMEDIATELY WITHOUT CALLING FOO()
~> cat -n /tmp/sho... | And I've answered my own question! It's the "debug" command in pydb:
```
~> cat -n /tmp/test_python.py
1 #!/usr/local/bin/python
2
3 def foo():
4 print "hi"
5 print "bye"
6
7 exit(0)
8
~> pydb /tmp/test_python.py
(/tmp/test_python.py:7): <module>
7 exit(0)
(Pydb)... |
228,648 | <p>I'm new to ruby and I'm playing around with the IRB.</p>
<p>I found that I can list methods of an object using the ".methods" method, and that self.methods sort of give me what I want (similar to Python's dir(<strong>builtins</strong>)?), but how can I find the methods of a library/module I've loaded via include an... | [
{
"answer_id": 228903,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You can pass the .methods messages to the library/module even before loading it, to see all the available methods. Doing <c... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24718/"
] | I'm new to ruby and I'm playing around with the IRB.
I found that I can list methods of an object using the ".methods" method, and that self.methods sort of give me what I want (similar to Python's dir(**builtins**)?), but how can I find the methods of a library/module I've loaded via include and require?
```
irb(mai... | [ObjectSpace.each\_object](http://www.ruby-doc.org/core-1.8.7/classes/ObjectSpace.html#M000928) could be what you are looking for.
To get a list of included modules you could use [Module.included\_modules](http://www.ruby-doc.org/core/classes/Module.html#M001697).
You can also check if an object responds to a method ... |
228,680 | <p>How does one import CSV files via Excel VBA in a set, in groups or in multiple individual files, rather than one at a time?</p>
| [
{
"answer_id": 228717,
"author": "jdecuyper",
"author_id": 296,
"author_profile": "https://Stackoverflow.com/users/296",
"pm_score": 0,
"selected": false,
"text": "<p>You could write a simple console application to parse a batch of csv files and save them to excel files.<br />\nNot the e... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How does one import CSV files via Excel VBA in a set, in groups or in multiple individual files, rather than one at a time? | I am a bit puzzled in that most versions of Excel will open .csv files with out any problems.
```
strPath = "C:\Docs\"
strFile = Dir(strPath & "*.csv")
Do While strFile <> ""
Workbooks.Open Filename:=strPath & strFile
ActiveWorkbook.SaveAs Filename:=strPath & Mid(strFile, 1, InStr(strFile, ".") - 1) _
... |
228,684 | <p>If I have a source.c file with a struct:</p>
<pre><code>struct a {
int i;
struct b {
int j;
}
};
</code></pre>
<p>How can this struct be used in another file (i.e. <code>func.c</code>)?</p>
<p>Should I create a new header file, declare the struct there and include that header in <code>func.c<... | [
{
"answer_id": 228689,
"author": "fmsf",
"author_id": 26004,
"author_profile": "https://Stackoverflow.com/users/26004",
"pm_score": 3,
"selected": false,
"text": "<p>a.h:</p>\n\n<pre><code>#ifndef A_H\n#define A_H\n\nstruct a { \n int i;\n struct b {\n int j;\n }\n};\n\n#... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If I have a source.c file with a struct:
```
struct a {
int i;
struct b {
int j;
}
};
```
How can this struct be used in another file (i.e. `func.c`)?
Should I create a new header file, declare the struct there and include that header in `func.c`?
Or should I define the whole struct in a heade... | ### if this structure is to be used by some other file func.c how to do it?
When a type is used in a file (i.e. func.c file), it must be visible. The very worst way to do it is copy paste it in each source file needed it.
The right way is putting it in an header file, and include this header file whenever needed.
##... |
228,702 | <p>Say I have the classic 4-byte signed integer, and I want something like</p>
<pre><code>print hex(-1)
</code></pre>
<p>to give me something like</p>
<blockquote>
<p>0xffffffff</p>
</blockquote>
<p>In reality, the above gives me <code>-0x1</code>. I'm dawdling about in some lower level language, and python commandline... | [
{
"answer_id": 228708,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 6,
"selected": true,
"text": "<p>This will do the trick:</p>\n<pre><code>>>> print(hex (-1 & 0xffffffff))\n0xffffffff\n</code></pre>\n<p>o... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23648/"
] | Say I have the classic 4-byte signed integer, and I want something like
```
print hex(-1)
```
to give me something like
>
> 0xffffffff
>
>
>
In reality, the above gives me `-0x1`. I'm dawdling about in some lower level language, and python commandline is quick n easy.
So.. is there a way to do it? | This will do the trick:
```
>>> print(hex (-1 & 0xffffffff))
0xffffffff
```
or, a variant that always returns fixed size (there may well be a better way to do this):
```
>>> def hex3(n):
... return "0x%s"%("00000000%s"%(hex(n&0xffffffff)[2:-1]))[-8:]
...
>>> print hex3(-1)
0xffffffff
>>> print hex3(17)
0x000000... |
228,705 | <p>I know I'm gonna get down votes, but I have to make sure if this is logical or not.</p>
<p>I have three tables A, B, C. B is a table used to make a many-many relationship between A and C. But the thing is that A and C are also related directly in a 1-many relationship</p>
<p>A customer added the following requirem... | [
{
"answer_id": 228739,
"author": "jdecuyper",
"author_id": 296,
"author_profile": "https://Stackoverflow.com/users/296",
"pm_score": 1,
"selected": false,
"text": "<p>It doesn't seem to make sense. A query like: </p>\n\n<pre><code>SELECT * FROM relAC RAC\n INNER JOIN tableA A ON A.id_cl... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23146/"
] | I know I'm gonna get down votes, but I have to make sure if this is logical or not.
I have three tables A, B, C. B is a table used to make a many-many relationship between A and C. But the thing is that A and C are also related directly in a 1-many relationship
A customer added the following requirement:
Obtain the ... | I'm supposing that s.id\_class indicates the student's current class, as opposed to classes she has taken in the past.
The solution shown by rcar works, but it repeats the c1.className on every row.
Here's an alternative that doesn't repeat information and it uses one fewer join. You can use an expression to compare... |
228,724 | <p>Im creating a report using crystal report in vb.net.</p>
<p>The report contained a crosstab which I have 3 data:
1. Dealer - row field
2. Month - column
3. Quantity Sales - summarize field</p>
<p>How can I arrange this by ascending order based on the
Quantity Sales - summarize field?</p>
<p>thanks</p>
| [
{
"answer_id": 234541,
"author": "thismat",
"author_id": 14045,
"author_profile": "https://Stackoverflow.com/users/14045",
"pm_score": 2,
"selected": false,
"text": "<p>Depending on how you're working with it, you can adjust the input to order the data ascending.</p>\n\n<blockquote>\n<pr... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Im creating a report using crystal report in vb.net.
The report contained a crosstab which I have 3 data:
1. Dealer - row field
2. Month - column
3. Quantity Sales - summarize field
How can I arrange this by ascending order based on the
Quantity Sales - summarize field?
thanks | Depending on how you're working with it, you can adjust the input to order the data ascending.
>
>
> ```
> SELECT customer, sum(amountdue) AS total FROM invoices
> GROUP BY customer
> ORDER BY total ASC
>
> ```
>
>
If you're doing in a way that you can't change that information, could you provide a little more ... |
228,726 | <p>The coding is done using VS2008
There are two divs in my page namely "dvLeftContent" and "dvRightContent".
I cannot statically set the height of the pages since "dvRightContent" have variable heights on various pages (Master Pages are used here)
Is there a client side function(javascript or jquery) that takes the he... | [
{
"answer_id": 234541,
"author": "thismat",
"author_id": 14045,
"author_profile": "https://Stackoverflow.com/users/14045",
"pm_score": 2,
"selected": false,
"text": "<p>Depending on how you're working with it, you can adjust the input to order the data ascending.</p>\n\n<blockquote>\n<pr... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17447/"
] | The coding is done using VS2008
There are two divs in my page namely "dvLeftContent" and "dvRightContent".
I cannot statically set the height of the pages since "dvRightContent" have variable heights on various pages (Master Pages are used here)
Is there a client side function(javascript or jquery) that takes the heigh... | Depending on how you're working with it, you can adjust the input to order the data ascending.
>
>
> ```
> SELECT customer, sum(amountdue) AS total FROM invoices
> GROUP BY customer
> ORDER BY total ASC
>
> ```
>
>
If you're doing in a way that you can't change that information, could you provide a little more ... |
228,730 | <p>As an example, lets say I wanted to list the frequency of each letter of the alphabet in a string. What would be the easiest way to do it?</p>
<p>This is an example of what I'm thinking of... the question is how to make allTheLetters equal to said letters without something like allTheLetters = "abcdefg...xyz". In m... | [
{
"answer_id": 228734,
"author": "Jacob Krall",
"author_id": 3140,
"author_profile": "https://Stackoverflow.com/users/3140",
"pm_score": 2,
"selected": false,
"text": "<p>Something like this?</p>\n\n<pre><code>for letter in range(ord('a'), ord('z') + 1):\n print chr(letter) + \":\", low... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1512/"
] | As an example, lets say I wanted to list the frequency of each letter of the alphabet in a string. What would be the easiest way to do it?
This is an example of what I'm thinking of... the question is how to make allTheLetters equal to said letters without something like allTheLetters = "abcdefg...xyz". In many other ... | The question you've asked (how to iterate through the alphabet) is not the same question as the problem you're trying to solve (how to count the frequency of letters in a string).
You can use string.lowercase, as other posters have suggested:
```
import string
allTheLetters = string.lowercase
```
To do things the w... |
228,775 | <p>I'm trying to do some async stuff in a webservice method. Let say I have the following API call: <a href="http://www.example.com/api.asmx" rel="nofollow noreferrer">http://www.example.com/api.asmx</a></p>
<p>and the method is called <em>GetProducts()</em>.</p>
<p>I this GetProducts methods, I do some stuff (eg. ge... | [
{
"answer_id": 228798,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "<p><code>BackgroundWorker</code> is useful when you need to synchronize back to (for example) a UI* thread, eg for aff... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30674/"
] | I'm trying to do some async stuff in a webservice method. Let say I have the following API call: <http://www.example.com/api.asmx>
and the method is called *GetProducts()*.
I this GetProducts methods, I do some stuff (eg. get data from database) then just before i return the result, I want to do some async stuff (eg.... | `BackgroundWorker` is useful when you need to synchronize back to (for example) a UI\* thread, eg for affinity reasons. In this case, it would seem that simply using `ThreadPool` would be more than adequate (and much simpler). If you have high volumes, then a producer/consumer queue may allow better throttling (so you ... |
228,782 | <p>How should I manage tables that refer to site 'events'. i.e. certain activities a user has done on a website that I use for tracking. I want to be able to do all kinds of datamining and correlation between different activities of users and what they have done.</p>
<p>Today alone I added 107,000 rows to my SiteEvent... | [
{
"answer_id": 228791,
"author": "xanadont",
"author_id": 1886,
"author_profile": "https://Stackoverflow.com/users/1886",
"pm_score": 0,
"selected": false,
"text": "<p>Re-thinking the problem might be just what the doctor ordered. Can 100k records per day really be that useful? Seems l... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24727/"
] | How should I manage tables that refer to site 'events'. i.e. certain activities a user has done on a website that I use for tracking. I want to be able to do all kinds of datamining and correlation between different activities of users and what they have done.
Today alone I added 107,000 rows to my SiteEvent table. I ... | You said two things that are in conflict with each other.
1. I want to be able to do all kinds of datamining and correlation between different activities of users and what they have done.
2. I want to ensure my db file doesnt keep growing.
I am also a big fan of data mining, but you need data to mine. In my mind, cre... |
228,795 | <p>If I have the following code (this was written in .NET)</p>
<pre><code>double i = 0.1 + 0.1 + 0.1;
</code></pre>
<p>Why doesn't <code>i</code> equal <code>0.3</code>?<br>
Any ideas?</p>
| [
{
"answer_id": 228799,
"author": "Andrew",
"author_id": 826,
"author_profile": "https://Stackoverflow.com/users/826",
"pm_score": 1,
"selected": false,
"text": "<p>The precision of floating point arithmetic cannot be guaranteed.</p>\n"
},
{
"answer_id": 228802,
"author": "pax... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If I have the following code (this was written in .NET)
```
double i = 0.1 + 0.1 + 0.1;
```
Why doesn't `i` equal `0.3`?
Any ideas? | You need to read up on floating point numbers. Many decimal numbers don't have an exact representation in binary so they won't be an exact match.
That's why in comparisons, you tend to see:
```
if (abs(a-b) < epsilon) { ...
```
where epsilon is a small value such as 0.00000001, depending on the accuracy required. |
228,796 | <p>I want to write a odometer-like method in a C#-style-language, but not just using 0-9 for characters, but any set of characters. It will act like a brute-force application, more or less.</p>
<p>If I pass in a char-array of characters from <strong>0</strong> to <strong>J</strong>, and set length to 5, I want results... | [
{
"answer_id": 228815,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 0,
"selected": false,
"text": "<p>Google for permutations.</p>\n\n<p>If however you are just dealing with that 'hex' range, just do the following:</p>\n\n... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2429/"
] | I want to write a odometer-like method in a C#-style-language, but not just using 0-9 for characters, but any set of characters. It will act like a brute-force application, more or less.
If I pass in a char-array of characters from **0** to **J**, and set length to 5, I want results like *00000, 00001, 00002... HJJJJ,... | This is one of the solutions I've found. I like the compactness and separation of it:
```
private static char[] characters =
new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J' };
// length: The length of the string created by bruteforce
public static vo... |
228,811 | <p>I'm interested in using Functional MetaPost on Mac OS X:</p>
<p><a href="http://cryp.to/funcmp/" rel="nofollow noreferrer">http://cryp.to/funcmp/</a></p>
<p>I'm looking for a tutorial like:</p>
<p><a href="http://haskell.org/haskellwiki/Haskell_in_5_steps" rel="nofollow noreferrer">http://haskell.org/haskellwiki/... | [
{
"answer_id": 238456,
"author": "ja.",
"author_id": 15467,
"author_profile": "https://Stackoverflow.com/users/15467",
"pm_score": 2,
"selected": false,
"text": "<p>the output of mpost is eps, which you can view in ghostview...</p>\n"
},
{
"answer_id": 238925,
"author": "Jare... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2543/"
] | I'm interested in using Functional MetaPost on Mac OS X:
<http://cryp.to/funcmp/>
I'm looking for a tutorial like:
<http://haskell.org/haskellwiki/Haskell_in_5_steps>
but for a trivial FuncMP example, i.e. using GHC, I can compile something simple such as:
```
import FMP
myPicture = text "blah"
main = generate... | @ja: This is true (EPS should be mpost's output) but there are a few problems here:
1. ghostview uses X11 and is ugly (especially on a Mac) to the point of being difficult to use.
2. I need smooth anti-aliased graphics, specifically PDF so I can import the graphics into Photoshop when I'm done---the on screen results ... |
228,835 | <p>what is the best practice for multilanguage website using DOM Manipulating with javascript? I build some dynamic parts of the website using javascript. My first thought was using an array with the text strings and the language code as index. Is this a good idea?</p>
| [
{
"answer_id": 228879,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 7,
"selected": true,
"text": "<p>When I've built multi-lingual sites before (not very large ones, so this might not scale too well), I keep a series of \"lan... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3214/"
] | what is the best practice for multilanguage website using DOM Manipulating with javascript? I build some dynamic parts of the website using javascript. My first thought was using an array with the text strings and the language code as index. Is this a good idea? | When I've built multi-lingual sites before (not very large ones, so this might not scale too well), I keep a series of "language" files:
* lang.en.js
* lang.it.js
* lang.fr.js
Each of the files declares an object which is basically just a map from key word to language phrase:
```
// lang.en.js
lang = {
greeting ... |
228,863 | <p>I am considering creating some JSP-tags that will always give the same output. For example:</p>
<pre><code><foo:bar>baz</foo:bar>
</code></pre>
<p>Will always output:</p>
<pre><code><div class="bar">baz</div>
</code></pre>
<p>Is there any way to get a JSP-tag to behave just like static ou... | [
{
"answer_id": 228872,
"author": "abahgat",
"author_id": 27565,
"author_profile": "https://Stackoverflow.com/users/27565",
"pm_score": 0,
"selected": false,
"text": "<p>I was wondering... why not use just a plain old <strong>include</strong>?</p>\n"
},
{
"answer_id": 228952,
... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28683/"
] | I am considering creating some JSP-tags that will always give the same output. For example:
```
<foo:bar>baz</foo:bar>
```
Will always output:
```
<div class="bar">baz</div>
```
Is there any way to get a JSP-tag to behave just like static output in the generated servlet?
For example:
```
out.write("<div class=\... | I made a performance-test. There is very little difference in performace, so that is no problem.
How I made the test
-------------------
I created 500 individual tags (programmatically) in one of our tag libraries. (So it is wrapped in a jar etc.)
They all look like this, with the number as the only difference:
```
... |
228,875 | <p>I have data coming from the database in the form of a <code>DataSet</code>. I then set it as the <code>DataSource</code> of a grid control before doing a <code>DataBind()</code>. I want to sort the <code>DataSet</code>/<code>DataTable</code> on one column. The column is to complex to sort in the database but I was h... | [
{
"answer_id": 228886,
"author": "jfs",
"author_id": 718,
"author_profile": "https://Stackoverflow.com/users/718",
"pm_score": 2,
"selected": false,
"text": "<p>I think <a href=\"http://msdn.microsoft.com/en-us/library/system.data.dataview.sort.aspx\" rel=\"nofollow noreferrer\">DataView... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18107/"
] | I have data coming from the database in the form of a `DataSet`. I then set it as the `DataSource` of a grid control before doing a `DataBind()`. I want to sort the `DataSet`/`DataTable` on one column. The column is to complex to sort in the database but I was hoping I could sort it like I would sort a generic list i.e... | Because of how DataTable (and DataView) sorting works, you can't use the delegate approach directly. One workaround is to add a column to the data-table that represents the order, and set the value (per row) based on the desired sequence. You can then add a Sort to the view on this new column. For example (using LINQ t... |
228,912 | <p>Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull the weight of an item from the database based on the item's name.</p>
<p>I tried using the "?" parameter substitution suggested to prevent SQL injections but it doesn't work. For example, when I use:</p>
<pre><code>for item in self.invent... | [
{
"answer_id": 228961,
"author": "Blauohr",
"author_id": 22176,
"author_profile": "https://Stackoverflow.com/users/22176",
"pm_score": 2,
"selected": false,
"text": "<p>have You tried this ? :</p>\n\n<pre><code>for item in self.inventory_names:\n t = (item,)\n self.cursor.execute(\... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18676/"
] | Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull the weight of an item from the database based on the item's name.
I tried using the "?" parameter substitution suggested to prevent SQL injections but it doesn't work. For example, when I use:
```
for item in self.inventory_names:
self.c... | The `Cursor.execute()` method expects a sequence as second parameter. You are supplying a string which happens to be 8 characters long.
Use the following form instead:
```
self.cursor.execute("SELECT weight FROM Equipment WHERE name = ?", [item])
```
Python library reference: sqlite3 [Cursor Objects](https://docs.p... |
228,926 | <p>How do you find out the local time of the user browsing your website in ASP.NET? </p>
| [
{
"answer_id": 228968,
"author": "Albert",
"author_id": 24065,
"author_profile": "https://Stackoverflow.com/users/24065",
"pm_score": 1,
"selected": false,
"text": "<p>You have to use JavaScript in the client side that will get the local time and pass that value to server side. You can p... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16628/"
] | How do you find out the local time of the user browsing your website in ASP.NET? | Create a hidden input control to get the value back at the server on the next page postback. It will need to be populated it in the onload event for the page with the value of a new Date object created in JavaScript. You will want to create a JavaScript function to do this and add that to the page using RegisterClientS... |
228,931 | <p>I'm using this code, to make a request to a given URL:</p>
<pre><code>private static string GetWebRequestContent(string url)
{
string sid = String.Empty;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.KeepAlive = false;
using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())... | [
{
"answer_id": 228954,
"author": "MartinHN",
"author_id": 2972,
"author_profile": "https://Stackoverflow.com/users/2972",
"pm_score": 4,
"selected": true,
"text": "<p>It works perfectly in my browser.</p>\n\n<p>I found the solution 1 minute after i posted the question:</p>\n\n<pre><code>... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972/"
] | I'm using this code, to make a request to a given URL:
```
private static string GetWebRequestContent(string url)
{
string sid = String.Empty;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.KeepAlive = false;
using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
{
using... | It works perfectly in my browser.
I found the solution 1 minute after i posted the question:
```
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
```
And that means the HttpWebRequest was using TLS 1.0 - I don't know, but I assume that is 40 bit DES or 56 bit DES, which is disabled in the WLB. |
228,945 | <p>I find System.Monitor very confusing, although I understand threading, locks, deadlocks, race conditions, dining philosophers and all that jazz. Normally I use a ManualResetEvent() to do inter-thread co-ordination, but I know that that's a heavyweight kernel object, and that System.Monitor (Enter/Pulse, etc.) is mu... | [
{
"answer_id": 228983,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>Here's a very simple example; the call to <code>Wait</code> releases the lock (allowing <code>Worker</code> to obta... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25462/"
] | I find System.Monitor very confusing, although I understand threading, locks, deadlocks, race conditions, dining philosophers and all that jazz. Normally I use a ManualResetEvent() to do inter-thread co-ordination, but I know that that's a heavyweight kernel object, and that System.Monitor (Enter/Pulse, etc.) is much m... | Here's a very simple example; the call to `Wait` releases the lock (allowing `Worker` to obtain it) and adds the `Main` thread to the lock-object's pending queue. `Worker` then obtains the lock, and calls `Pulse`: this moves the `Main` thread into the lock-object's ready queue. When `Worker` *releases* the lock, `Main`... |
228,969 | <p>I am getting the following error when I post back a page from the client-side. I have JavaScript code that modifies an asp:ListBox on the client side.</p>
<p>How do we fix this?</p>
<p>Error details below:</p>
<pre><code>Server Error in '/XXX' Application.
--------------------------------------------------------... | [
{
"answer_id": 229041,
"author": "Norbert B.",
"author_id": 2605840,
"author_profile": "https://Stackoverflow.com/users/2605840",
"pm_score": 8,
"selected": true,
"text": "<p>The problem is that ASP.NET does not get to know about this extra or removed listitem.\nYou got an number of opti... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13370/"
] | I am getting the following error when I post back a page from the client-side. I have JavaScript code that modifies an asp:ListBox on the client side.
How do we fix this?
Error details below:
```
Server Error in '/XXX' Application.
--------------------------------------------------------------------------------
Inv... | The problem is that ASP.NET does not get to know about this extra or removed listitem.
You got an number of options (listed below):
* Disable eventvalidation (bad idea, because you lose a little of security that come with very little cost).
* Use ASP.NET Ajax UpdatePanel. (Put the listbox in the Updatepanel and trigge... |
228,978 | <p>I have this Perl script with many defined constants of configuration files. For example:</p>
<pre><code>use constant {
LOG_DIR => "/var/log/",
LOG_FILENAME => "/var/log/file1.log",
LOG4PERL_CONF_FILE => "/etc/app1/log4perl.conf",
CONF_FIL... | [
{
"answer_id": 228991,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 2,
"selected": false,
"text": "<p>That's not going to work, sadly. The reason for this is that you are using functions ('constants') before they ar... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13523/"
] | I have this Perl script with many defined constants of configuration files. For example:
```
use constant {
LOG_DIR => "/var/log/",
LOG_FILENAME => "/var/log/file1.log",
LOG4PERL_CONF_FILE => "/etc/app1/log4perl.conf",
CONF_FILE1 ... | I'd probably write it like this:
```
use Readonly;
Readonly my $LOG_DIR => "/var/log";
Readonly my $LOG_FILENAME => "$LOG_DIR/file1.log";
Readonly my $ETC => '/etc/app1';
Readonly my $LOG4PERL_CONF_FILE => "$ETC/log4perl.con";
# hash because we don't have an index '0'
Readonly my %CON... |
228,985 | <p>I'm trying to get tags working in my rails application and want to use acts_as_taggable. Firstly I followed the instructions I found in Rails Recipies (a free sample bit online) that used the acts_as_taggable plugin. However, I then found <a href="http://taggable.rubyforge.org/" rel="nofollow noreferrer">this site</... | [
{
"answer_id": 229017,
"author": "glenatron",
"author_id": 15394,
"author_profile": "https://Stackoverflow.com/users/15394",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried running something like \"gem query -l -n <em>taggable</em>\" to check whether it has installed correct... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1912/"
] | I'm trying to get tags working in my rails application and want to use acts\_as\_taggable. Firstly I followed the instructions I found in Rails Recipies (a free sample bit online) that used the acts\_as\_taggable plugin. However, I then found [this site](http://taggable.rubyforge.org/) which seems to have a gem for act... | You could also try [acts\_as\_taggable\_on\_steroids](http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids):
>
> This plugin is based on acts\_as\_taggable by DHH but includes extras such as tests, smarter tag assignment, and tag cloud calculations.
>
>
>
I've used it recently. Aside from some perf... |
228,987 | <p>We try to convert from string to <code>Byte[]</code> using the following Java code:</p>
<pre><code>String source = "0123456789";
byte[] byteArray = source.getBytes("UTF-16");
</code></pre>
<p>We get a byte array of length 22 bytes, we are not sure where this padding comes from.
How do I get an array of length 20?<... | [
{
"answer_id": 228998,
"author": "Alexander",
"author_id": 16724,
"author_profile": "https://Stackoverflow.com/users/16724",
"pm_score": 5,
"selected": false,
"text": "<p>May be the first two bytes are the <a href=\"http://en.wikipedia.org/wiki/Byte_Order_Mark\" rel=\"nofollow noreferrer... | 2008/10/23 | [
"https://Stackoverflow.com/questions/228987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30704/"
] | We try to convert from string to `Byte[]` using the following Java code:
```
String source = "0123456789";
byte[] byteArray = source.getBytes("UTF-16");
```
We get a byte array of length 22 bytes, we are not sure where this padding comes from.
How do I get an array of length 20? | [Alexander's answer](https://stackoverflow.com/questions/228987/convert-string-to-byte-in-java#228998) explains why it's there, but not how to get rid of it. You simply need to specify the endianness you want in the encoding name:
```
String source = "0123456789";
byte[] byteArray = source.getBytes("UTF-16LE"); // Or ... |
229,007 | <p>I am running the free version of Helicon ISAPI Rewrite on IIS and have several sites running through the same set of rewrite rules. Up 'til now this has been fine as all the rules have applied to all the sites. I have recently added a new site which I don't want to run through all the rules. Is there any way to make... | [
{
"answer_id": 229026,
"author": "Zebra North",
"author_id": 17440,
"author_profile": "https://Stackoverflow.com/users/17440",
"pm_score": 2,
"selected": false,
"text": "<p>Rewrite it to itself?</p>\n\n<pre><code>RewriteCond Host: (?:www\\.)?mysite\\.com\nRewriteRule ^(.*)$ $1 [QSA,L]\... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2179408/"
] | I am running the free version of Helicon ISAPI Rewrite on IIS and have several sites running through the same set of rewrite rules. Up 'til now this has been fine as all the rules have applied to all the sites. I have recently added a new site which I don't want to run through all the rules. Is there any way to make re... | I've done something similar, to stop mod\_rewrite on a WebDAV folder:
```
# stop processing if we're in the webdav folder
RewriteCond %{REQUEST_URI} ^/webdav [NC]
RewriteRule .* - [L]
```
That should work for your purposes too. If not or if you are interested in additional references, see this previous question: [H... |
229,009 | <p>Is there a way I can access (for printout) a list of sub + module to arbitrary depth of sub-calls preceding a current position in a Perl script?</p>
<p>I need to make changes to some Perl modules (.pm's). The workflow is initiated from a web-page thru a cgi-script, passing input through several modules/objects end... | [
{
"answer_id": 229030,
"author": "Ovid",
"author_id": 8003,
"author_profile": "https://Stackoverflow.com/users/8003",
"pm_score": 7,
"selected": true,
"text": "<p>You can use <a href=\"http://search.cpan.org/dist/Devel-StackTrace/\" rel=\"noreferrer\">Devel::StackTrace</a>.</p>\n\n<pre><... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15161/"
] | Is there a way I can access (for printout) a list of sub + module to arbitrary depth of sub-calls preceding a current position in a Perl script?
I need to make changes to some Perl modules (.pm's). The workflow is initiated from a web-page thru a cgi-script, passing input through several modules/objects ending in the ... | You can use [Devel::StackTrace](http://search.cpan.org/dist/Devel-StackTrace/).
```
use Devel::StackTrace;
my $trace = Devel::StackTrace->new;
print $trace->as_string; # like carp
```
It behaves like Carp's trace, but you can get more control over the frames.
The one problem is that references are stringified and i... |
229,010 | <pre><code>$("#dvMyDIV").bind("resize", function(){
alert("Resized");
});
</code></pre>
<p>or</p>
<pre><code>$("#dvMyDIV").resize(function(){
alert("Resized");
});
</code></pre>
<p>The questions</p>
<ol>
<li>Why is this not working at FireFox, Chrome and Safari?</li>
<li>Can this be considered a jQuery bug ... | [
{
"answer_id": 229028,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 6,
"selected": true,
"text": "<p>I believe the JavaScript resize event only applies to frames or windows, not to DIVs.</p>\n\n<p>e.g. see <a href=\"http://de... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17447/"
] | ```
$("#dvMyDIV").bind("resize", function(){
alert("Resized");
});
```
or
```
$("#dvMyDIV").resize(function(){
alert("Resized");
});
```
The questions
1. Why is this not working at FireFox, Chrome and Safari?
2. Can this be considered a jQuery bug since the resize is not handled for other browsers?
3. Cou... | I believe the JavaScript resize event only applies to frames or windows, not to DIVs.
e.g. see [this page](http://devguru.com/technologies/javascript/10929.asp):
>
> The onResize even handler is use to execute specified code whenever a user or script resizes a window or frame. This allows you to query the size and p... |
229,012 | <p>How can I convert a relative path to an absolute path in C on Unix?
Is there a convenient system function for this?</p>
<p>On Windows there is a <code>GetFullPathName</code> function that does the job, but I didn't find something similar on Unix...</p>
| [
{
"answer_id": 229038,
"author": "xsl",
"author_id": 11387,
"author_profile": "https://Stackoverflow.com/users/11387",
"pm_score": 7,
"selected": true,
"text": "<p>Use <a href=\"http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html\" rel=\"noreferrer\">realpath()</a>.</p>... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9280/"
] | How can I convert a relative path to an absolute path in C on Unix?
Is there a convenient system function for this?
On Windows there is a `GetFullPathName` function that does the job, but I didn't find something similar on Unix... | Use [realpath()](http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html).
>
> The `realpath()` function shall derive,
> from the pathname pointed to by
> `file_name`, an absolute pathname that
> names the same file, whose resolution
> does not involve '`.`', '`..`', or
> symbolic links. The genera... |
229,021 | <p>We want to show a hint for a JList that the user can select multiple items with the platform dependent key for multiselect. </p>
<p>However I have not found any way to show the OS X COMMAND symbol in a JLabel, which means the symbol that's printed on the apple keyboard on the command key, also called apple key.</p>... | [
{
"answer_id": 232786,
"author": "Steve McLeod",
"author_id": 2959,
"author_profile": "https://Stackoverflow.com/users/2959",
"pm_score": 0,
"selected": false,
"text": "<p>Your solution looks perfect. I assume you intend to factor out the hint code so you reuse it.</p>\n\n<pre><code>add(... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16193/"
] | We want to show a hint for a JList that the user can select multiple items with the platform dependent key for multiselect.
However I have not found any way to show the OS X COMMAND symbol in a JLabel, which means the symbol that's printed on the apple keyboard on the command key, also called apple key.
Here's a pic... | The symbol in question is avaiable through Unicode, and the HTML character sets. All you need to do is make your JLabel display HTML by starting its text string with <html> and then include the character code.
```
JLabel label = new JLabel( "<html>⌘ is the Apple command symbol." );
```
This will work on a Mac,... |
229,031 | <p>I need to test a web form that takes a file upload.
The filesize in each upload will be about 10 MB.
I want to test if the server can handle over 100 simultaneous uploads, and still remain
responsive for the rest of the site.</p>
<p>Repeated form submissions from our office will be limited by our local DSL line.
Th... | [
{
"answer_id": 229051,
"author": "Henrik Paul",
"author_id": 2238,
"author_profile": "https://Stackoverflow.com/users/2238",
"pm_score": 0,
"selected": false,
"text": "<p>I would perhaps guide you towards using cURL and submitting just random stuff (like, read 10MB out of <code>/dev/uran... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18333/"
] | I need to test a web form that takes a file upload.
The filesize in each upload will be about 10 MB.
I want to test if the server can handle over 100 simultaneous uploads, and still remain
responsive for the rest of the site.
Repeated form submissions from our office will be limited by our local DSL line.
The server i... | Use the [ab (ApacheBench)](http://httpd.apache.org/docs/2.0/programs/ab.html) command-line tool that is bundled with Apache
(I have just discovered this great little tool). Unlike cURL or wget,
ApacheBench was designed for performing stress tests on web servers (any type of web server!).
It generates plenty statistics ... |
229,058 | <p>When using something like <code>object.methods.sort.to_yaml</code> I'd like to have irb interpret the \n characters rather than print them. </p>
<p>I currently get the following output:</p>
<pre><code>--- \n- "&"\n- "*"\n- +\n- "-"\n- "<<"\n- <=>\n ...
</code></pre>
<p>What I'd like is something s... | [
{
"answer_id": 229064,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 0,
"selected": false,
"text": "<p>That's just irb -- I don't think you can control the <code>return</code> formatting.</p>\n\n<p>You can still ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17453/"
] | When using something like `object.methods.sort.to_yaml` I'd like to have irb interpret the \n characters rather than print them.
I currently get the following output:
```
--- \n- "&"\n- "*"\n- +\n- "-"\n- "<<"\n- <=>\n ...
```
What I'd like is something similar to this:
```
---
- "&"
- "*"
- +
- "-"
- "<<"
... | Prefix your output with `puts`:
```
> puts object.methods.sort.to_yaml
---
- "&"
- "*"
- +
- "-"
- "<<"
- <=>
=> nil
``` |
229,071 | <p>how to show all values of a particular field in a text box ???
ie. for eg. when u run the SP, u'll be getting 3 rows. and i want to show the (eg.empname)
in a textbox each value separated by a comma.
(ram, john, sita). </p>
| [
{
"answer_id": 229282,
"author": "CaRDiaK",
"author_id": 15628,
"author_profile": "https://Stackoverflow.com/users/15628",
"pm_score": 1,
"selected": false,
"text": "<p>I had this problem the other day. If you are using SQL 2005 you can use the CROSS APPLY function.</p>\n\n<p>Here is a s... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29867/"
] | how to show all values of a particular field in a text box ???
ie. for eg. when u run the SP, u'll be getting 3 rows. and i want to show the (eg.empname)
in a textbox each value separated by a comma.
(ram, john, sita). | I had this problem the other day. If you are using SQL 2005 you can use the CROSS APPLY function.
Here is a sample;
```
Structure;
ID TYPE TEXT
1 1 Ram
2 1 Jon
3 2 Sita
4 2 Joe
Expecteed Output;
ID TYPE TEXT
1 1 Ram, Jon
2 2 Sita, Joe
Query;
SELECT t.TYPE,LEFT(tl.txtlist,LEN(tl.txtlist)-1)
FROM(SELECT DISTINCT T... |
229,078 | <p>The code below gives me this mysterious error, and i cannot fathom it. I am new to regular expressions and so am consequently stumped. The regular expression should be validating any international phone number.</p>
<p>Any help would be much appreciated.</p>
<pre><code>function validate_phone($phone)
{
$phonere... | [
{
"answer_id": 229089,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": true,
"text": "<p>If this is PHP, then the regex must be enclosed in quotes. <del>Furthermore, what's <code>preg</code>? Did you mean... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The code below gives me this mysterious error, and i cannot fathom it. I am new to regular expressions and so am consequently stumped. The regular expression should be validating any international phone number.
Any help would be much appreciated.
```
function validate_phone($phone)
{
$phoneregexp ="^(\+[1-9][0-9]... | If this is PHP, then the regex must be enclosed in quotes. ~~Furthermore, what's `preg`? Did you mean `preg_match`?~~
Another thing. PHP knows boolean values. The canonical solution would rather look like this:
```
return preg_match($regex, $phone) !== 0;
```
EDIT: Or, using `ereg`:
```
return ereg($regex, $phone)... |
229,080 | <p>Is there a best-practice or common way in JavaScript to have class members as event handlers?</p>
<p>Consider the following simple example:</p>
<pre><code><head>
<script language="javascript" type="text/javascript">
ClickCounter = function(buttonId) {
this._clickCount = 0;
... | [
{
"answer_id": 229110,
"author": "pawel",
"author_id": 4879,
"author_profile": "https://Stackoverflow.com/users/4879",
"pm_score": 6,
"selected": true,
"text": "<pre><code>ClickCounter = function(buttonId) {\n this._clickCount = 0;\n var that = this;\n document.getElementById(bu... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30056/"
] | Is there a best-practice or common way in JavaScript to have class members as event handlers?
Consider the following simple example:
```
<head>
<script language="javascript" type="text/javascript">
ClickCounter = function(buttonId) {
this._clickCount = 0;
document.getElementById(b... | ```
ClickCounter = function(buttonId) {
this._clickCount = 0;
var that = this;
document.getElementById(buttonId).onclick = function(){ that.buttonClicked() };
}
ClickCounter.prototype = {
buttonClicked: function() {
this._clickCount++;
alert('the button was clicked ' + this._clickCount ... |
229,117 | <p>I <em>sometimes</em> get the following exception for a custom control of mine:</p>
<p><code>XamlParseException occurred</code> <code>Unknown attribute Points in element SectionClickableArea [Line: 10 Position 16]</code></p>
<p>The stack trace:</p>
<pre><code>{System.Windows.Markup.XamlParseException: Unknown attr... | [
{
"answer_id": 232549,
"author": "Tim Stewart",
"author_id": 26002,
"author_profile": "https://Stackoverflow.com/users/26002",
"pm_score": 0,
"selected": false,
"text": "<p>I'm no XAML expert but are you missing a namespace on Points (e.g. l:Points)?</p>\n"
},
{
"answer_id": 4730... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23222/"
] | I *sometimes* get the following exception for a custom control of mine:
`XamlParseException occurred` `Unknown attribute Points in element SectionClickableArea [Line: 10 Position 16]`
The stack trace:
```
{System.Windows.Markup.XamlParseException: Unknown attribute Points on element SectionClickableArea. [Line: 10 P... | I've also came across this issue. I do not have a good explanation for that (seems to be XAML parse bug), but I've fixed it by adding following code to XAML:
```
<UserControl.Resources>
<customNamespace:InheritedControl x:Name="dummyInstance"/>
</UserControl.Resources>
``` |
229,143 | <p>How can i map a date from a java object to a database with Hibernate? I try different approaches, but i am not happy with them. Why? Let me explain my issue. I have the following class [1] including the main method i invoke and with the following mapping [2]. The issue about this approach you can see, when you look ... | [
{
"answer_id": 229240,
"author": "Vladimir Dyuzhev",
"author_id": 1163802,
"author_profile": "https://Stackoverflow.com/users/1163802",
"pm_score": 1,
"selected": false,
"text": "<p>Apparently, TIMESTAMP type on your target RDBMS (<em>what are you using, btw?</em>) doesn't store millisec... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1038/"
] | How can i map a date from a java object to a database with Hibernate? I try different approaches, but i am not happy with them. Why? Let me explain my issue. I have the following class [1] including the main method i invoke and with the following mapping [2]. The issue about this approach you can see, when you look at ... | MySql DateTime precision is only to the second. Java Date precision is to the millisecond.
That is why the last three digits are zeros after it has been put in the database.
Do this to your original Date:
date = date.setTime((date.getTime() / 1000) \* 1000);
This will set it to the last exact second, and all your co... |
229,153 | <pre><code><div>
<h1>Title</h1>
<table>
...
</table>
</div>
</code></pre>
<p>Now, the</p>
<pre><code><h1>
</code></pre>
<p>has a margin: 0;
so it is at the top of the div. The height of the div is 300px.</p>
<p>However I'd like the table to be placed at the bottom of the di... | [
{
"answer_id": 229184,
"author": "Darryl Hein",
"author_id": 5441,
"author_profile": "https://Stackoverflow.com/users/5441",
"pm_score": 0,
"selected": false,
"text": "<p>What about this:</p>\n\n<pre><code><style type=\"text/css\">\n#container { \n position: absolute; \n marg... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21559/"
] | ```
<div>
<h1>Title</h1>
<table>
...
</table>
</div>
```
Now, the
```
<h1>
```
has a margin: 0;
so it is at the top of the div. The height of the div is 300px.
However I'd like the table to be placed at the bottom of the div, eg. valign="bottom" but for the whole table. | Try this: <http://jsbin.com/emoce>
Though it's similar to Darryl's solution. Except I'm not using position:absolute on the wrapping div, but rather position: relative to make the table's position absolute to that. |
229,168 | <p>I find print_r in PHP extremely useful, but wonder if there is anything remotely equivalent in Perl?</p>
| [
{
"answer_id": 229175,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 6,
"selected": true,
"text": "<p>Note @tchrist recommends <a href=\"http://search.cpan.org/~gaas/Data-Dump-1.21/lib/Data/Dump.pm\" rel=\"noreferrer... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693/"
] | I find print\_r in PHP extremely useful, but wonder if there is anything remotely equivalent in Perl? | Note @tchrist recommends [Data::Dump](http://search.cpan.org/~gaas/Data-Dump-1.21/lib/Data/Dump.pm) over [Data::Dumper](http://search.cpan.org/~jhi/perl-5.8.0/ext/Data/Dumper/Dumper.pm). I wasn't aware of it, but from the looks of it, seems like it's both far easier to use and producing better looking and easier to int... |
229,185 | <p>I've been trying for a while now to write a unit test for a UserViewControl in ASP.NET MVC. I'd like to get to code that looks something like this:</p>
<pre><code>[TestMethod]
public void HaveControlToDisplayThings()
{
var listControl = new ControlUnderTest();
var viewData = new ViewDataDictionary<IList&... | [
{
"answer_id": 390363,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 2,
"selected": false,
"text": "<p>One option would be to run unit tests inside the browser. I've had success with <a href=\"http://seleniumhq.org/\... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4591/"
] | I've been trying for a while now to write a unit test for a UserViewControl in ASP.NET MVC. I'd like to get to code that looks something like this:
```
[TestMethod]
public void HaveControlToDisplayThings()
{
var listControl = new ControlUnderTest();
var viewData = new ViewDataDictionary<IList<string>>(this.rep... | Unfortunately, the ASP.NET viewengine uses the VirtualPathProvider in the ASP.NET hosting environment. To make matters worse, I traced some of the other code using Reflector and found that there is other dependencies to some hardcode references to VirtualPath utilities.
I hope they fix this in the release so we can tru... |
229,186 | <p>How do I limit <code>os.walk</code> to only return files in the directory I provide it?</p>
<pre><code>def _dir_list(self, dir_name, whitelist):
outputList = []
for root, dirs, files in os.walk(dir_name):
for f in files:
if os.path.splitext(f)[1] in whitelist:
outputList.... | [
{
"answer_id": 229192,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": false,
"text": "<p>You could use <a href=\"http://www.python.org/doc/2.5.2/lib/os-file-dir.html\" rel=\"noreferrer\"><code>os.listdir()</... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21537/"
] | How do I limit `os.walk` to only return files in the directory I provide it?
```
def _dir_list(self, dir_name, whitelist):
outputList = []
for root, dirs, files in os.walk(dir_name):
for f in files:
if os.path.splitext(f)[1] in whitelist:
outputList.append(os.path.join(root,... | Use the `walklevel` function.
```
import os
def walklevel(some_dir, level=1):
some_dir = some_dir.rstrip(os.path.sep)
assert os.path.isdir(some_dir)
num_sep = some_dir.count(os.path.sep)
for root, dirs, files in os.walk(some_dir):
yield root, dirs, files
num_sep_this = root.count(os.pa... |
229,196 | <p>I have the problem, that getting a ressource from my archive failed with a <code>MalformedURLException: unknown protocol: jndi</code></p>
<p>The archive is a war file and is deployed into Websphere successfully.</p>
<p>When I try to access some files inside the archive via</p>
<pre><code>jndi://server/context/fil... | [
{
"answer_id": 3836668,
"author": "Isaac",
"author_id": 443716,
"author_profile": "https://Stackoverflow.com/users/443716",
"pm_score": 0,
"selected": false,
"text": "<p>Unless you registered a custom URL handler, \"jndi\" is not a supported protocol.</p>\n\n<p>Are you trying to read the... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30724/"
] | I have the problem, that getting a ressource from my archive failed with a `MalformedURLException: unknown protocol: jndi`
The archive is a war file and is deployed into Websphere successfully.
When I try to access some files inside the archive via
```
jndi://server/context/filename
```
I get the `MalformedURLExce... | URLs with the "jndi" scheme are returned by the ServletContext#getResource method in Tomcat. However, this is non standard (i.e. the J2EE specs don't impose a URL scheme to be used in the return value of that method) and on other application servers it will be different. Always use the ServletContext#getResource method... |
229,206 | <p>I have some code which needs to ensure some data is in a mysql enum prior to insertion in the database. The cleanest way I've found of doing this is the following code:</p>
<pre><code>sub enum_values {
my ( $self, $schema, $table, $column ) = @_;
# don't eval to let the error bubble up
my $columns = $... | [
{
"answer_id": 229278,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 2,
"selected": false,
"text": "<p>I'd say using Text::CSV_XS may be an overkill, unless you have weird things like commas in enums (a bad idea anyw... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8003/"
] | I have some code which needs to ensure some data is in a mysql enum prior to insertion in the database. The cleanest way I've found of doing this is the following code:
```
sub enum_values {
my ( $self, $schema, $table, $column ) = @_;
# don't eval to let the error bubble up
my $columns = $schema->storage... | No need to be so heroic. Using a reasonably modern version of [DBD::mysql](http://search.cpan.org/dist/DBD-mysql/), the hash returned by [DBI](http://search.cpan.org/dist/DBI/)'s [column info](http://search.cpan.org/dist/DBI/DBI.pm#column_info) method contains a pre-split version of the valid enum values in the key `my... |
229,254 | <p>I have a server application that receives information over a network and processes it.
The server is multi-threaded and handles multiple sockets at time, and threads are created without my control through BeginInvoke and EndInvoke style methods, which are chained by corresponding callback functions.</p>
<p>I'm tryi... | [
{
"answer_id": 229287,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Using BeginInvoke or Invoke should work fine. Could you post a short but complete program which demonstrates the prob... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a server application that receives information over a network and processes it.
The server is multi-threaded and handles multiple sockets at time, and threads are created without my control through BeginInvoke and EndInvoke style methods, which are chained by corresponding callback functions.
I'm trying to crea... | You have to call Invoke (or BeginInvoke) on the ListBox control you are accessing in order for the delegate to be called on the thread that created that control.
```
ListBox listBox = c.Controls["listBox1"] as ListBox;
if(listBox != null)
{
listBox.Invoke(...);
}
``` |
229,272 | <pre><code><div style="width: 300px">
<div id="one" style="float: left">saved</div><input type="submit" id="two" style="float: right" value="Submit" />
</div>
</code></pre>
<p>I would like div#one to be centred in the space between the left edge of the parent div and the left edge of the ... | [
{
"answer_id": 229277,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 1,
"selected": false,
"text": "<p>There are a number of techniques listed <a href=\"http://css-discuss.incutio.com/?page=CenteringBlockElement\" rel=\"n... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21559/"
] | ```
<div style="width: 300px">
<div id="one" style="float: left">saved</div><input type="submit" id="two" style="float: right" value="Submit" />
</div>
```
I would like div#one to be centred in the space between the left edge of the parent div and the left edge of the submit button. | A few more ways to do it:
```
<div style="width: 300px">
<input type="submit" id="two" style="float: right" value="Submit" />
<div id="one" style="text-align:center;">saved</div>
</div>
```
It's hard to tell that the text `saved` isn't centered between the left edge of the container `div` and the left edge o... |
229,310 | <p>I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't:</p>
<pre><code>DocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance();
docfactory.setIgnoringElementContentWhitespace(true);
</code></pre>
<p>I see in Javadoc... | [
{
"answer_id": 229520,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 5,
"selected": true,
"text": "<p>‘IgnoringElementContentWhitespace’ is not about removing <em>all</em> pure-whitespace text nodes, only whitespace nodes ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518/"
] | I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't:
```
DocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance();
docfactory.setIgnoringElementContentWhitespace(true);
```
I see in Javadoc that setIgnoringElementCo... | ‘IgnoringElementContentWhitespace’ is not about removing *all* pure-whitespace text nodes, only whitespace nodes whose parents are described in the schema as having ELEMENT content — that is to say, they only contain other elements and never text.
If you don't have a schema (DTD or XSD) in use, element content default... |
229,346 | <p>I have a String which I would like to modify in some way. For example: reverse it or upcase it. </p>
<p>I have discovered that the fastest way to do this is by using a unsafe block and pointers. </p>
<p>For example: </p>
<pre><code> unsafe
{
fixed (char* str = text)
{
... | [
{
"answer_id": 229351,
"author": "Sam Saffron",
"author_id": 17174,
"author_profile": "https://Stackoverflow.com/users/17174",
"pm_score": 5,
"selected": true,
"text": "<p>The .Net framework requires strings to be immutable. Due to this requirement it is able to optimise all sorts of ope... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17174/"
] | I have a String which I would like to modify in some way. For example: reverse it or upcase it.
I have discovered that the fastest way to do this is by using a unsafe block and pointers.
For example:
```
unsafe
{
fixed (char* str = text)
{
*str = 'X';
... | The .Net framework requires strings to be immutable. Due to this requirement it is able to optimise all sorts of operations.
[String interning](http://en.wikipedia.org/wiki/String_intern_pool) is one great example of this requirement is leveraged heavily. To speed up some string comparisons (and reduce memory consump... |
229,352 | <p>I am using Python to extract the filename from a link using rfind like below:</p>
<pre><code>url = "http://www.google.com/test.php"
print url[url.rfind("/") +1 : ]
</code></pre>
<p>This works ok with links without a / at the end of them and returns "test.php". I have encountered links with / at the end like so "... | [
{
"answer_id": 229386,
"author": "Tim Pietzcker",
"author_id": 20670,
"author_profile": "https://Stackoverflow.com/users/20670",
"pm_score": -1,
"selected": false,
"text": "<p>You could use</p>\n\n<pre><code>print url[url.rstrip(\"/\").rfind(\"/\") +1 : ]\n</code></pre>\n"
},
{
"... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using Python to extract the filename from a link using rfind like below:
```
url = "http://www.google.com/test.php"
print url[url.rfind("/") +1 : ]
```
This works ok with links without a / at the end of them and returns "test.php". I have encountered links with / at the end like so "<http://www.google.com/test... | Just removing the slash at the end won't work, as you can probably have a URL that looks like this:
```
http://www.google.com/test.php?filepath=tests/hey.xml
```
...in which case you'll get back "hey.xml". Instead of manually checking for this, you can use **urlparse** to get rid of the parameters, then do the check... |
229,353 | <p>In my main page (call it <code>index.aspx</code>) I call </p>
<pre><code><%Html.RenderPartial("_PowerSearch", ViewData.Model);%>
</code></pre>
<p>Here the <code>viewdata.model != null</code>
When I arrive at my partial:</p>
<pre><code><%=ViewData.Model%>
</code></pre>
<p>Says <code>viewdata.model ==... | [
{
"answer_id": 229367,
"author": "Simon Steele",
"author_id": 4591,
"author_profile": "https://Stackoverflow.com/users/4591",
"pm_score": 2,
"selected": true,
"text": "<p>Have you tried just passing in ViewData instead of ViewData.Model? This is an abridged version what I use in my helpe... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | In my main page (call it `index.aspx`) I call
```
<%Html.RenderPartial("_PowerSearch", ViewData.Model);%>
```
Here the `viewdata.model != null`
When I arrive at my partial:
```
<%=ViewData.Model%>
```
Says `viewdata.model == null`
What gives?! | Have you tried just passing in ViewData instead of ViewData.Model? This is an abridged version what I use in my helpers (shamelessly stolen from the Storefront series):
```
/// <summary>
/// Renders a LoggingWeb user control.
/// </summary>
/// <param name="helper">Helper to extend.</param>
/// <pa... |
229,357 | <p>What is the best way in <strong>Perl</strong> to copy files to a yet-to-be-created destination directory tree?</p>
<p>Something like</p>
<pre><code>copy("test.txt","tardir/dest1/dest2/text.txt");
</code></pre>
<p>won't work since the directory <em>tardir/dest1/dest2</em> does not yet exist. What is the best way t... | [
{
"answer_id": 229382,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 3,
"selected": false,
"text": "<pre><code>use File::Basename qw/dirname/;\nuse File::Copy;\n\nsub mkdir_recursive {\n my $path = shift;\n mkd... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6511/"
] | What is the best way in **Perl** to copy files to a yet-to-be-created destination directory tree?
Something like
```
copy("test.txt","tardir/dest1/dest2/text.txt");
```
won't work since the directory *tardir/dest1/dest2* does not yet exist. What is the best way to copy with directory creation in Perl? | ```
use File::Path;
use File::Copy;
my $path = "tardir/dest1/dest2/";
my $file = "test.txt";
if (! -d $path)
{
my $dirs = eval { mkpath($path) };
die "Failed to create $path: $@\n" unless $dirs;
}
copy($file,$path) or die "Failed to copy $file: $!\n";
``` |
229,362 | <p>I am trying to call out to a legacy dll compiled from FORTRAN code. I am new to Interop, but I've read some articles on it and it seems like my case should be fairly straightforward. </p>
<p>The method I really want to call has a complex method signature, but I can't even call this simple GetVersion method withou... | [
{
"answer_id": 229507,
"author": "TK.",
"author_id": 1816,
"author_profile": "https://Stackoverflow.com/users/1816",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried using a StringBuilder?</p>\n\n<p>Create your String as a StringBuilder and pass that into the dll function. </... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4219/"
] | I am trying to call out to a legacy dll compiled from FORTRAN code. I am new to Interop, but I've read some articles on it and it seems like my case should be fairly straightforward.
The method I really want to call has a complex method signature, but I can't even call this simple GetVersion method without getting a ... | OK, I got it to work, the problem was passing by ref. I'm not sure why, but this works:
```
[DllImport("GeoConvert.dll",
EntryPoint="_get_version@4",
CallingConvention=CallingConvention.StdCall)]
public static extern void GetGeoConvertVersion([MarshalAs(UnmanagedType.LPArray)]
... |
229,385 | <p>Visual Studio gives many navigation hotkeys:
<kbd>F8</kbd> for next item in current panel (search results, errors ...),
<kbd>Control</kbd>+<kbd>K</kbd>, <kbd>N</kbd> for bookmarks,
<kbd>Alt</kbd>+<kbd>-</kbd> for going back and more.</p>
<p>There is one hotkey that I can't find, and I can't even find the menu-comma... | [
{
"answer_id": 229400,
"author": "jfs",
"author_id": 718,
"author_profile": "https://Stackoverflow.com/users/718",
"pm_score": -1,
"selected": false,
"text": "<p>Look in <strong>Tools->Options->Environment->Keyboard</strong>. Enter \"stack\" or \"frame\" and related menus will appear. It... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Visual Studio gives many navigation hotkeys:
`F8` for next item in current panel (search results, errors ...),
`Control`+`K`, `N` for bookmarks,
`Alt`+`-` for going back and more.
There is one hotkey that I can't find, and I can't even find the menu-command for it, so I can't create the hotkey myself.
I don't know if... | I wrote 2 macros to gain it: `PreviousStackFrame` and `NextStackFrame` and assigned shortcuts to
```
Function StackFrameIndex(ByRef aFrames As EnvDTE.StackFrames, ByRef aFrame As EnvDTE.StackFrame) As Long
For StackFrameIndex = 1 To aFrames.Count
If aFrames.Item(StackFrameIndex) Is aFrame Then Exit Functio... |
229,404 | <p>I am trying to extract a table of values from an excel (2003) spreadsheet using vb6, the result of which needs to be stored in a (adodb) recordset. The table looks like this:</p>
<pre>
Name Option.1 Option.2 Option.3 Option.4 Option.5 Option.6
--------------------------------------------------------... | [
{
"answer_id": 229477,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>The Excel ISAM driver by default looks into the first handful of your rows and guesses their data type. Should there be... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30757/"
] | I am trying to extract a table of values from an excel (2003) spreadsheet using vb6, the result of which needs to be stored in a (adodb) recordset. The table looks like this:
```
Name Option.1 Option.2 Option.3 Option.4 Option.5 Option.6
----------------------------------------------------------------... | You are correct: it is guessing the data type based on a number of rows. There are local machine registry keys you may be able to alter to influence the data type chosen. For more details, see [this answer](https://stackoverflow.com/a/10102515/15354). |
229,423 | <p>We have a need to take dozens of different protocols from systems such as security systems, fire alarms, camera systems etc.. and integrate them into a single common protocol.</p>
<p>I would like this to be a messaging server that many systems could subscribe to and or communicate through.</p>
<ul>
<li>polling and... | [
{
"answer_id": 229793,
"author": "James Strachan",
"author_id": 2068211,
"author_profile": "https://Stackoverflow.com/users/2068211",
"pm_score": 3,
"selected": true,
"text": "<p>If you don't mind working on the Java platform there's a lightweight protocol switcher and implementation of ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445087/"
] | We have a need to take dozens of different protocols from systems such as security systems, fire alarms, camera systems etc.. and integrate them into a single common protocol.
I would like this to be a messaging server that many systems could subscribe to and or communicate through.
* polling and non-polling "drivers... | If you don't mind working on the Java platform there's a lightweight protocol switcher and implementation of the [Enterprise Integration Patterns](http://activemq.apache.org/camel/enterprise-integration-patterns.html) in an open source project called [Apache Camel](http://activemq.apache.org/camel/).
Camel can already... |
229,425 | <p>I'm trying to populate a DataTable, to build a LocalReport, using the following:<br></p>
<pre><code>MySqlCommand cmd = new MySqlCommand();
cmd.Connection = new MySqlConnection(Properties.Settings.Default.dbConnectionString);
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT ... LEFT JOIN ... WHERE ...";... | [
{
"answer_id": 229458,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 1,
"selected": false,
"text": "<p>Can you grab the actual query that is running from SQL profiler and try running it? It may not be what you expected.... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26155/"
] | I'm trying to populate a DataTable, to build a LocalReport, using the following:
```
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = new MySqlConnection(Properties.Settings.Default.dbConnectionString);
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT ... LEFT JOIN ... WHERE ..."; /* query snippe... | I had same issue. I took hint from your blog and put up the ORDER BY clause in the query so that they could form together the unique key for all the records returned by query. It solved the problem. Kinda weird. |
229,446 | <p>On our site, we get a large amount of photos uploaded from various sources. </p>
<p>In order to keep the file sizes down, we strip all <a href="http://en.wikipedia.org/wiki/Exif" rel="noreferrer">exif data</a> from the source using <a href="http://www.imagemagick.org/www/mogrify.html" rel="noreferrer">mogrify</a>:<... | [
{
"answer_id": 229479,
"author": "Colin Pickard",
"author_id": 12744,
"author_profile": "https://Stackoverflow.com/users/12744",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"http://www.sno.phy.queensu.ca/~phil/exiftool/\" rel=\"noreferrer\">Exiftool</a> looks like it would be ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2287/"
] | On our site, we get a large amount of photos uploaded from various sources.
In order to keep the file sizes down, we strip all [exif data](http://en.wikipedia.org/wiki/Exif) from the source using [mogrify](http://www.imagemagick.org/www/mogrify.html):
```
mogrify -strip image.jpg
```
What we'd like to be able to d... | You can save a large amount of space, especially if you have a large number of images..
Add the following to text.txt (format of the IPTC tags taken from [here](http://www.narf.ssji.net/~shtrom/wiki/tips/imagemanipulation)):
```
2#110#Credit="My Company"
2#05#Object Name="THE_OBJECT_NAME"
2#55#Date Created="2011-02-0... |
229,447 | <p>How can I efficiently create a unique index on two fields in a table like this:
create table t (a integer, b integer);</p>
<p>where any unique combination of two different numbers cannot appear more than once on the same row in the table.</p>
<p>In order words if a row exists such that a=1 and b=2, another row can... | [
{
"answer_id": 229461,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 1,
"selected": false,
"text": "<p>See <a href=\"https://stackoverflow.com/questions/208666/two-foreign-keys-instead-of-primary\">Two foreign keys instead... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6475/"
] | How can I efficiently create a unique index on two fields in a table like this:
create table t (a integer, b integer);
where any unique combination of two different numbers cannot appear more than once on the same row in the table.
In order words if a row exists such that a=1 and b=2, another row cannot exist where a... | How about controlling what goes into the table so that you always store the smallest number into the first column and the largest one in the second? As long as it 'means' the same thing of course. It's probably less expensive to do it before it even gets to the database.
If this is impossible, you could save the field... |
229,468 | <p>I am new to programming, and am wondering if there is a correct way to order your control structure logic.</p>
<p>It seems more natural to check for the most likely case first, but I have the feeling that some control structures won't work unless they check everything that's false to arrive at something that's true... | [
{
"answer_id": 229475,
"author": "ZCHudson",
"author_id": 30610,
"author_profile": "https://Stackoverflow.com/users/30610",
"pm_score": 0,
"selected": false,
"text": "<p>Either / Or. I generally use the 'negative' approach though.</p>\n\n<p>if (!something)\n{</p>\n\n<p>}</p>\n"
},
{... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4196/"
] | I am new to programming, and am wondering if there is a correct way to order your control structure logic.
It seems more natural to check for the most likely case first, but I have the feeling that some control structures won't work unless they check everything that's false to arrive at something that's true (logical ... | In most situations, readability is more important than execution speed. I therefore try
to optimize for ease of understanding, by using the following approach:
All "assertion" checks are done up front. this guarantees that all erroneous cases are dealt with at the very start. this is especially important for null-poin... |
229,491 | <pre><code>foreach($arrayOne as $value){
do function
}
</code></pre>
<p>In the above example, I'd like to pass $arrayOne into a loop, have a function operate that removes some elements of $arrayOne and then have the loop pass over the reduced $arrayOne on the elements that are left until the loop returns false.</p... | [
{
"answer_id": 229499,
"author": "Aditya Mukherji",
"author_id": 25990,
"author_profile": "https://Stackoverflow.com/users/25990",
"pm_score": 1,
"selected": false,
"text": "<p>i would recommend having two arrays,\n<br>one with the data - dataarray, \n<br>the other initially empty - empt... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1149/"
] | ```
foreach($arrayOne as $value){
do function
}
```
In the above example, I'd like to pass $arrayOne into a loop, have a function operate that removes some elements of $arrayOne and then have the loop pass over the reduced $arrayOne on the elements that are left until the loop returns false.
Recommendations? | If you want to make modifications to the value of array items, use by reference. If you want to entirely remove array items, split out the key / value pairs.
```
$arrayOne = array('example', 'listing of', 'stuff');
foreach ($arrayOne as $key => &$value) {
$value .= ' alteration';
if ($value == 'listing of al... |
229,508 | <p>Can anyone tell me why this code behaves the way it does? See comments embedded in the code...</p>
<p>Am I missing something really obvious here?</p>
<pre><code>using System;
namespace ConsoleApplication3
{
public class Program
{
static void Main(string[] args)
{
var c = new MyC... | [
{
"answer_id": 229537,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>I don't have an answer yet, but I have what I believe to be a slightly clearer program to demonstrate the oddity:</p>... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24207/"
] | Can anyone tell me why this code behaves the way it does? See comments embedded in the code...
Am I missing something really obvious here?
```
using System;
namespace ConsoleApplication3
{
public class Program
{
static void Main(string[] args)
{
var c = new MyChild();
c... | I don't have an answer yet, but I have what I believe to be a slightly clearer program to demonstrate the oddity:
```
using System;
delegate void MyDelegate();
public class Program
{
static void Main(string[] args)
{
var c = new MyChild();
c.DisplayOddity();
Console.ReadLine();
}
... |
229,551 | <p>I have a string in Bash:</p>
<pre class="lang-sh prettyprint-override"><code>string="My string"
</code></pre>
<p>How can I test if it contains another string?</p>
<pre class="lang-sh prettyprint-override"><code>if [ $string ?? 'foo' ]; then
echo "It's there!"
fi
</code></pre>
<p>Where <code>??<... | [
{
"answer_id": 229585,
"author": "Marcus Griep",
"author_id": 28645,
"author_profile": "https://Stackoverflow.com/users/28645",
"pm_score": 9,
"selected": false,
"text": "<p>I am not sure about using an if statement, but you can get a similar effect with a case statement:</p>\n\n<pre><co... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30773/"
] | I have a string in Bash:
```sh
string="My string"
```
How can I test if it contains another string?
```sh
if [ $string ?? 'foo' ]; then
echo "It's there!"
fi
```
Where `??` is my unknown operator. Do I use `echo` and `grep`?
```sh
if echo "$string" | grep 'foo'; then
echo "It's there!"
fi
```
That looks a ... | You can use [Marcus's answer (\* wildcards)](https://stackoverflow.com/a/229585/3755692) outside a case statement, too, if you use double brackets:
```
string='My long string'
if [[ $string == *"My long"* ]]; then
echo "It's there!"
fi
```
Note that spaces in the needle string need to be placed between double quot... |
229,554 | <p>Just wondering what the difference between <code>BeginInvoke()</code> and <code>Invoke()</code> are? </p>
<p>Mainly what each one would be used for.</p>
<p>EDIT: What is the difference between creating a threading object and calling invoke on that and just calling <code>BeginInvoke()</code> on a delegate? or are t... | [
{
"answer_id": 229558,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 10,
"selected": true,
"text": "<p>Do you mean <code>Delegate.Invoke</code>/<code>BeginInvoke</code> or <code>Control.Invoke</code>/<code>BeginInvoke</c... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | Just wondering what the difference between `BeginInvoke()` and `Invoke()` are?
Mainly what each one would be used for.
EDIT: What is the difference between creating a threading object and calling invoke on that and just calling `BeginInvoke()` on a delegate? or are they the same thing? | Do you mean `Delegate.Invoke`/`BeginInvoke` or `Control.Invoke`/`BeginInvoke`?
* `Delegate.Invoke`: Executes synchronously, on the same thread.
* `Delegate.BeginInvoke`: Executes asynchronously, on a `threadpool` thread.
* `Control.Invoke`: Executes on the UI thread, but calling thread waits for completion before cont... |
229,565 | <p>The Mutex class is very misunderstood, and Global mutexes even more so.</p>
<p>What is good, safe pattern to use when creating Global mutexes?</p>
<p>One that will work</p>
<ul>
<li>Regardless of the locale my machine is in</li>
<li>Is guaranteed to release the mutex properly</li>
<li>Optionally does not hang for... | [
{
"answer_id": 229567,
"author": "Sam Saffron",
"author_id": 17174,
"author_profile": "https://Stackoverflow.com/users/17174",
"pm_score": 10,
"selected": true,
"text": "<p>I want to make sure this is out there, because it's so hard to get right:</p>\n\n<pre><code>using System.Runtime.In... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17174/"
] | The Mutex class is very misunderstood, and Global mutexes even more so.
What is good, safe pattern to use when creating Global mutexes?
One that will work
* Regardless of the locale my machine is in
* Is guaranteed to release the mutex properly
* Optionally does not hang forever if the mutex is not acquired
* Deals ... | I want to make sure this is out there, because it's so hard to get right:
```
using System.Runtime.InteropServices; //GuidAttribute
using System.Reflection; //Assembly
using System.Threading; //Mutex
using System.Security.AccessControl; //MutexAccessRule
using System.Security.Princi... |
229,579 | <p>I have an xml file where I need to comment out a whole piece of text with Ant.</p>
<p>There's this Ant task</p>
<pre><code><replace file="${src.dir}/Version.as"
token="@revisionPrana" value="${revision}"/>
</code></pre>
<p>that I use to replace words, but in my case I need to replace a whole block... | [
{
"answer_id": 229658,
"author": "Miguel Ping",
"author_id": 22992,
"author_profile": "https://Stackoverflow.com/users/22992",
"pm_score": 4,
"selected": true,
"text": "<p>If you can identify what is to be replaced through a regular expression, I recommend using the optional task <strong... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26521/"
] | I have an xml file where I need to comment out a whole piece of text with Ant.
There's this Ant task
```
<replace file="${src.dir}/Version.as"
token="@revisionPrana" value="${revision}"/>
```
that I use to replace words, but in my case I need to replace a whole block like this:
```
<value>
<object clas... | If you can identify what is to be replaced through a regular expression, I recommend using the optional task **replaceregexp**. Here's the doc: <http://ant.apache.org/manual/Tasks/replaceregexp.html>
You can call it twice, one for the start tag and other for the end tag.
The regexp for replacing your can be a bit cum... |
229,603 | <p>I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When I start my site (I'm still running using the ASP.Net Development Web Server) the default page gives me this error:</p>
<pre><code>Server Error in '/' Application.
Using themed css files requires a header control on the page. (e.g. <head run... | [
{
"answer_id": 229846,
"author": "Richard Szalay",
"author_id": 3603,
"author_profile": "https://Stackoverflow.com/users/3603",
"pm_score": 3,
"selected": true,
"text": "<p>The error is telling you that your ASP.NET page (or master page) needs to have a <head runat=\"server\"> tag. Wi... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1383003/"
] | I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When I start my site (I'm still running using the ASP.Net Development Web Server) the default page gives me this error:
```
Server Error in '/' Application.
Using themed css files requires a header control on the page. (e.g. <head runat="server" />).
D... | The error is telling you that your ASP.NET page (or master page) needs to have a <head runat="server"> tag. Without it, you cannot use themes.
Since server side header tags shouldn't have a dependency on viewstate (as they are not contained in forms), it might still work.
Having said that, themes don't necessarily si... |
229,622 | <p>I am working on a stored procedure with several optional parameters. Some of these parameters are single values and it's easy enough to use a WHERE clause like:</p>
<pre><code>WHERE (@parameter IS NULL OR column = @parameter)
</code></pre>
<p>However, in some instances, the WHERE condition is more complicated:</p... | [
{
"answer_id": 229641,
"author": "GvS",
"author_id": 11492,
"author_profile": "https://Stackoverflow.com/users/11492",
"pm_score": 3,
"selected": false,
"text": "<p>I would create separate queries for the parameter being available or not.</p>\n\n<p>This will create simpler SQL, and the o... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11780/"
] | I am working on a stored procedure with several optional parameters. Some of these parameters are single values and it's easy enough to use a WHERE clause like:
```
WHERE (@parameter IS NULL OR column = @parameter)
```
However, in some instances, the WHERE condition is more complicated:
```
WHERE (@NewGroupId IS NU... | The main problem is likely to be [parameter sniffing](http://omnibuzz-sql.blogspot.com/2006/11/parameter-sniffing-stored-procedures.html), and wildly different optimal execution plans depending on which of your parameters are NULL. Try running the stored proc with [RECOMPILE](http://www.sqlmag.com/Article/ArticleID/943... |
229,623 | <pre><code><input type="submit"/>
<style>
input {
background: url(tick.png) bottom left no-repeat;
padding-left: 18px;
}
</style>
</code></pre>
<p>But the bevel goes away, how can I add an icon to submit button and keep the bevel?<br>
Edit: I want it to look like the browser default.</p>
| [
{
"answer_id": 229640,
"author": "NotMe",
"author_id": 2424,
"author_profile": "https://Stackoverflow.com/users/2424",
"pm_score": 0,
"selected": false,
"text": "<p>Use border. For example:</p>\n\n<pre><code>INPUT.button {\n BORDER-RIGHT: #999999 1px solid;\n BORDER-TOP: #999999 1... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21559/"
] | ```
<input type="submit"/>
<style>
input {
background: url(tick.png) bottom left no-repeat;
padding-left: 18px;
}
</style>
```
But the bevel goes away, how can I add an icon to submit button and keep the bevel?
Edit: I want it to look like the browser default. | Using <.input type="submit" /> with a background will look different depending on what browser / OS you're on.
If you want to keep the browser styles, you could use the button element, which allows HTML inside the tag:
```
<button type="submit"><img src="image.gif" /> Text</button>
or
<button type="submit"><span cla... |
229,630 | <p>My application has several threads:
1) Main Thread
2) 2 Sub-Main Threads (each with Message Loop, as shown below), used by TFQM
3) n Worker Threads (simple loop, containing Sleep())</p>
<p>My problem is, when I close my application, the Worker Threads manage to exit properly, but 1 of the 2 Sub-Main Threads hangs (... | [
{
"answer_id": 229808,
"author": "Davy Landman",
"author_id": 11098,
"author_profile": "https://Stackoverflow.com/users/11098",
"pm_score": 3,
"selected": false,
"text": "<p>I've had the same problem, and I found out I <strong>shouldn't</strong> create a hidden window just to recieve mes... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30787/"
] | My application has several threads:
1) Main Thread
2) 2 Sub-Main Threads (each with Message Loop, as shown below), used by TFQM
3) n Worker Threads (simple loop, containing Sleep())
My problem is, when I close my application, the Worker Threads manage to exit properly, but 1 of the 2 Sub-Main Threads hangs (never exit... | If I may point to few problems in your code ...
1) You're not checking output of AllocateHwnd. Yes, most probably it will never fail, but still ...
2) AllocateHwnd belogs OUT of try..finally! If it fails, DeallocateHwnd should not be called.
3) AllocateHwnd is not threadsafe. If you call it from multiple threads at ... |
229,632 | <p>In a C program (p1), how to launch a dynamically constructed command (and its arguments) that reads its standard input from p1's standard output?</p>
<p>Note that: </p>
<ol>
<li><p>A method other than this stdout -->
stdin piping is also OK <strong>provided</strong>
it is <strong>PORTABLE</strong> across Windows a... | [
{
"answer_id": 229786,
"author": "Pieter",
"author_id": 5822,
"author_profile": "https://Stackoverflow.com/users/5822",
"pm_score": 2,
"selected": false,
"text": "<p>It's not 100% clear to me what you're trying to achieve exactly to be honest.</p>\n\n<p>But as I understand it, you could ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10955/"
] | In a C program (p1), how to launch a dynamically constructed command (and its arguments) that reads its standard input from p1's standard output?
Note that:
1. A method other than this stdout -->
stdin piping is also OK **provided**
it is **PORTABLE** across Windows and
Linux.
2. I cannot use C++, Java, Perl, Ruby,
... | It's not 100% clear to me what you're trying to achieve exactly to be honest.
But as I understand it, you could take a look at [Boost.Process](http://www.netbsd.org/~jmmv/process/)
You can do things like
```
bp::child cs = p.start();
bp::postream& os = cs.get_stdin();
```
And then use the *os* as any stream to d... |
229,633 | <p>I want my <kbd>AltGr</kbd> key to behave exactly like left <kbd>Alt</kbd>.<br>
Usually, I do this kind of stuff with <a href="http://www.autohotkey.com/" rel="noreferrer">Autohotkey</a>, but I'm open to different solutions. </p>
<p>I tried this:</p>
<pre><code>LControl & RAlt::Alt
</code></pre>
<p>And Autoho... | [
{
"answer_id": 229716,
"author": "Brian Schmitt",
"author_id": 30492,
"author_profile": "https://Stackoverflow.com/users/30492",
"pm_score": 0,
"selected": false,
"text": "<p>In AHK, Can you do:</p>\n\n<pre><code>LControl & RAlt::!\n</code></pre>\n\n<p>Or</p>\n\n<pre><code><^>!... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2239/"
] | I want my `AltGr` key to behave exactly like left `Alt`.
Usually, I do this kind of stuff with [Autohotkey](http://www.autohotkey.com/), but I'm open to different solutions.
I tried this:
```
LControl & RAlt::Alt
```
And Autohotkey displayed error about `Alt` not being recognized action.
Then I tried the fol... | Thank you all for answers. I was unable to solve this using AutoHotkey -- PhilLho's answer was close, but I really needed exatly the same behaviour as with left `Alt` key.
However, the [registry thing](https://stackoverflow.com/questions/229633/how-to-globally-map-altgr-key-to-alt-key#396859) actually worked as I nee... |
229,643 | <p>Following on from a <a href="https://stackoverflow.com/questions/221417/how-do-i-programmatically-access-the-target-path-of-a-windows-symbolic-link">previous question</a>, I am creating a symbolic link on a Server 2008 from a Vista machine using UNC paths. I can create the link just fine. I can go to the Server 2008... | [
{
"answer_id": 230047,
"author": "David Arno",
"author_id": 7122,
"author_profile": "https://Stackoverflow.com/users/7122",
"pm_score": 6,
"selected": false,
"text": "<p>Well I found the answer, though to describe it as badly documented is an understatement!</p>\n\n<p>First of all, <a hr... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7122/"
] | Following on from a [previous question](https://stackoverflow.com/questions/221417/how-do-i-programmatically-access-the-target-path-of-a-windows-symbolic-link), I am creating a symbolic link on a Server 2008 from a Vista machine using UNC paths. I can create the link just fine. I can go to the Server 2008 box and doubl... | To add to [@David Arno's helpful answer](https://stackoverflow.com/a/230047/45375), based on W7:
---
`fsutil.exe` can be made to show what arguments it takes by simply running:
```
fsutil behavior set /?
```
To **report the *current* configuration**, run `fsutil behavior query SymlinkEvaluation` - see [@Jake1164's... |
229,656 | <p>I've got an error in my build which says:</p>
<blockquote>
<p>Error 12 Cannot implicitly convert
type
'System.Collections.Generic.IEnumerator< BaseClass>'
to
'System.Collections.Generic.IEnumerator< IParentClass>'.
An explicit conversion exists (are you
missing a cast?)</p>
</blockquote>
<p>Is... | [
{
"answer_id": 229667,
"author": "spoulson",
"author_id": 3347,
"author_profile": "https://Stackoverflow.com/users/3347",
"pm_score": 0,
"selected": false,
"text": "<p><code>IEnumerator<BaseClass></code> and <code>IEnumerator<ParentClass></code> are unrelated, eventhough thei... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] | I've got an error in my build which says:
>
> Error 12 Cannot implicitly convert
> type
> 'System.Collections.Generic.IEnumerator< BaseClass>'
> to
> 'System.Collections.Generic.IEnumerator< IParentClass>'.
> An explicit conversion exists (are you
> missing a cast?)
>
>
>
Is it wrong to simply cast it away?... | No you can't, because generics aren't covariant in C# at the moment. .NET itself has some support (for delegates and interfaces) but it's not really used yet.
If you were returning `IEnumerable<BaseClass>` instead of `IEnumerator<BaseClass>` (and assuming .NEt 3.5) you could use `Enumerable.Cast` - but you'll currentl... |
229,671 | <p>I read the following in a review of Knuth's "The Art of Computer Programming":</p>
<p>"The very 'practicality' means that the would-be CS major has to learn Kernighan's mistakes in designing C, notably the infamous fact that a for loop evaluates the for condition repeatedly, which duplicates while and fails to matc... | [
{
"answer_id": 229694,
"author": "mweerden",
"author_id": 4285,
"author_profile": "https://Stackoverflow.com/users/4285",
"pm_score": 2,
"selected": false,
"text": "<p>He probably refers to for loops like <code>for i:=0 to N</code> and for-each loops that iterate over the elements of a s... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30529/"
] | I read the following in a review of Knuth's "The Art of Computer Programming":
"The very 'practicality' means that the would-be CS major has to learn Kernighan's mistakes in designing C, notably the infamous fact that a for loop evaluates the for condition repeatedly, which duplicates while and fails to match the beha... | Consider this:
```
for i:=0 to 100 do { ... }
```
In this case, we could replace the final value, 100, by a function call:
```
for i:=0 to final_value() do { ... }
```
... and the `final_value`-function would be called only once.
In C, however:
```
for (int i=0; i<final_value(); ++i) // ...
```
... the `final... |
229,676 | <p>Greetings,</p>
<p>The VBA code below will create an Excel QueryTable object and display it starting on Range("D2"). The specific address of this target range is immaterial.</p>
<p>My question is -- is it possible to manually feed in values to an in-memory Recordset, and then have the table read from it? In other... | [
{
"answer_id": 231714,
"author": "DJ.",
"author_id": 10492,
"author_profile": "https://Stackoverflow.com/users/10492",
"pm_score": 0,
"selected": false,
"text": "<p>From the Excel VB Help\nThe connection parameter can be:</p>\n\n<p>\"An ADO or DAO Recordset object. Data is read from the ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7311/"
] | Greetings,
The VBA code below will create an Excel QueryTable object and display it starting on Range("D2"). The specific address of this target range is immaterial.
My question is -- is it possible to manually feed in values to an in-memory Recordset, and then have the table read from it? In other words, I want to s... | Yes, sure.
```
Dim vConnection As Variant, vCommandText As Variant
Dim r As ADODB.Recordset
Dim i As Long
'Save query table definition
vConnection = QueryTable.Connection
vCommandText = QueryTable.CommandText
Set r = New ADODB.Recordset
<populate r>
Set QueryTable.Recordset = r
QueryTable.Refres... |
229,726 | <p>I've seen <a href="https://stackoverflow.com/questions/49156/importing-javascript-in-jsp-tags">this question</a> regading the importing of js-files related to the tag content itself. I have a similar problem, here I have a jsp tag that generates some HTML and has a generic js-implementation that handles the behavior... | [
{
"answer_id": 229771,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Although I agree that it's not entirely elegant, I've been known to do it a few times when combining server-side decisions ... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12540/"
] | I've seen [this question](https://stackoverflow.com/questions/49156/importing-javascript-in-jsp-tags) regading the importing of js-files related to the tag content itself. I have a similar problem, here I have a jsp tag that generates some HTML and has a generic js-implementation that handles the behavior of this HTML.... | You should strive for javascript in its own files. This is usually done with [Progressive Enhancement](http://accessites.org/site/2007/02/graceful-degradation-progressive-enhancement/). But some times you don't have a choice, for instance when the same JSP renders pages in different languages. Here's a real-life exampl... |
229,756 | <p>I'm relatively new to Python and am having problems programming with Scapy, the Python network manipulation tool. However, I can't tell if it's as much a Scapy problem as it is a being-a-Python-newbie problem. On the <a href="http://www.secdev.org/projects/scapy/build_your_own_tools.html" rel="noreferrer">scapy site... | [
{
"answer_id": 229819,
"author": "ddaa",
"author_id": 11549,
"author_profile": "https://Stackoverflow.com/users/11549",
"pm_score": 4,
"selected": true,
"text": "<p>With the caveat from Federico Ramponi \"You should use scapy as an interpreter by its own, not as a library\", I want to an... | 2008/10/23 | [
"https://Stackoverflow.com/questions/229756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/422/"
] | I'm relatively new to Python and am having problems programming with Scapy, the Python network manipulation tool. However, I can't tell if it's as much a Scapy problem as it is a being-a-Python-newbie problem. On the [scapy site](http://www.secdev.org/projects/scapy/build_your_own_tools.html), they give a sample progra... | With the caveat from Federico Ramponi "You should use scapy as an interpreter by its own, not as a library", I want to answer the non-scapy-specific parts of the question.
**Q:** when installing Python libraries, do I need to change my path or anything similar?
**A:** I think you are talking about changing `PYTHONPAT... |