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 |
|---|---|---|---|---|---|---|
529,207 | <p>To start out, I have looked at the following pages and don't quite have my answer:
<a href="https://stackoverflow.com/questions/51217/how-would-you-organize-a-subversion-repository-for-in-house-software-projects">how-would-you-organize-a-subversion-repository-for-in-house-software-projects</a> and
<a href="https://s... | [
{
"answer_id": 529241,
"author": "SilentGhost",
"author_id": 12855,
"author_profile": "https://Stackoverflow.com/users/12855",
"pm_score": 1,
"selected": false,
"text": "<p>I think your best bet is the second option: having all code under single repo with htdocs and cgi-bin directories. ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40619/"
] | To start out, I have looked at the following pages and don't quite have my answer:
[how-would-you-organize-a-subversion-repository-for-in-house-software-projects](https://stackoverflow.com/questions/51217/how-would-you-organize-a-subversion-repository-for-in-house-software-projects) and
[how-do-you-organize-your-versio... | I think you're making the right call by keeping a single repository for your many projects, so I would only make a change to your deployment process:
Your svn repo would look like (your first option.)
```
/svnrepo/project1/trunk
/svnrepo/project1/trunk/htdocs
/svnrepo/project1/trunk/css
...
/svnrepo/project1/branches... |
529,208 | <p>Here is the Query I am using:</p>
<pre><code>SELECT * FROM ra_ProjectCalendar
WHERE MonthNumber between @Month and @Month + 12 and FullYear = @Year
</code></pre>
<p>It works great for this year, but, stops at December of this year. How do I get it to show a running year?</p>
| [
{
"answer_id": 529223,
"author": "E.J. Brennan",
"author_id": 53686,
"author_profile": "https://Stackoverflow.com/users/53686",
"pm_score": 0,
"selected": false,
"text": "<p>Something like this might work better - but its not clear what your intent is:</p>\n\n<pre><code>select * \n from ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5633/"
] | Here is the Query I am using:
```
SELECT * FROM ra_ProjectCalendar
WHERE MonthNumber between @Month and @Month + 12 and FullYear = @Year
```
It works great for this year, but, stops at December of this year. How do I get it to show a running year? | Try this:
```
SELECT * FROM ra_ProjectCalendar
WHERE
(MonthNumber > @Month AND FullYear = @Year)
OR (MonthNumber < @Month AND FullYear = @Year + 1)
``` |
529,210 | <p><strong>Hi All,</strong></p>
<p>I have two .net applications, these applications want to talk to each other, I made a setting in the first project as follows</p>
<pre><code>[CompilerGeneratedAttribute()]
[GeneratedCodeAttribute("SettingsSingleFileGenerator", "9.0.0.0")]
public sealed partial class Settings :Appli... | [
{
"answer_id": 529511,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 0,
"selected": false,
"text": "<p>Settings are persisted to a configuration file that is saved on disk. As far as I know the default place for this ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32718/"
] | **Hi All,**
I have two .net applications, these applications want to talk to each other, I made a setting in the first project as follows
```
[CompilerGeneratedAttribute()]
[GeneratedCodeAttribute("SettingsSingleFileGenerator", "9.0.0.0")]
public sealed partial class Settings :ApplicationSettingsBase
{
[Use... | User level app settings are isolated in a subdirectory of AppData. One app cannot find the settings of another app. Just use a plain file. |
529,214 | <p>I have two cells with a string of bits 0111010 and 0101011. I want to XOR the two together so that the resulting cell would be 0010001.</p>
<p>I know you can use this for boolean values</p>
<pre><code>=OR(AND(A1,NOT(A2)),AND(A2,NOT(A1)))
</code></pre>
<p>but it doesn't work for a string of bits.</p>
| [
{
"answer_id": 529233,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 0,
"selected": false,
"text": "<p>=1-(A1<>0)+(A2<>0) for each bit.</p>\n\n<p>You can split it into individual columns for the above formula us... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43994/"
] | I have two cells with a string of bits 0111010 and 0101011. I want to XOR the two together so that the resulting cell would be 0010001.
I know you can use this for boolean values
```
=OR(AND(A1,NOT(A2)),AND(A2,NOT(A1)))
```
but it doesn't work for a string of bits. | You need to use VBA to do this. If you open VBA, create a new Module and enter the function
```
Public Function BITXOR(x As Long, y As Long)
BITXOR = x Xor y
End Function
```
You can then use the DEC2BIN and BIN2DEC to convert from binary to decimal to run this function. For example:
Cell A1 = 0111010
Cell A2 ... |
529,236 | <p>As I've stated before I'm working on a digg clone to teach myself ASP.NET MVC Inside and out but I've hit a road bump that I can't seem to avoid.</p>
<p>I want to be able to optimize this application as much as possible so I have my DAL which is a bunch of classes of ...Repository : Repository. Now to help optimiz... | [
{
"answer_id": 529307,
"author": "User",
"author_id": 62830,
"author_profile": "https://Stackoverflow.com/users/62830",
"pm_score": 1,
"selected": false,
"text": "<p>It looks like you're missing the BLL.</p>\n\n<p>Actually, the right architecture of an MVC application is what many people... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25416/"
] | As I've stated before I'm working on a digg clone to teach myself ASP.NET MVC Inside and out but I've hit a road bump that I can't seem to avoid.
I want to be able to optimize this application as much as possible so I have my DAL which is a bunch of classes of ...Repository : Repository. Now to help optimize for perfo... | In my MVC apps I'm using architecture that Rob Conery showed on his MVC Storefront video series and it works like charm for me.
Repository => Service + Filters => Controller => View
I've tried to simulate what you want to achieve and managed todo like this
**Edit1**: Changed IList to IQueryable in repository and fil... |
529,238 | <p>I have your basic asp.net web form which contains some client-side JavaScript that forces the page to time out and then redirect after 5 minutes. Mainly to protect possibly sensitive information.</p>
<p>At timeout, I want to force a server post back allowing me to save the form values for future edits.</p>
<p>I ha... | [
{
"answer_id": 529283,
"author": "hacker",
"author_id": 60256,
"author_profile": "https://Stackoverflow.com/users/60256",
"pm_score": 1,
"selected": false,
"text": "<p>This may be overkill, but you could setup a javascript timer to fire a web service call. The .NET web service can accep... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64262/"
] | I have your basic asp.net web form which contains some client-side JavaScript that forces the page to time out and then redirect after 5 minutes. Mainly to protect possibly sensitive information.
At timeout, I want to force a server post back allowing me to save the form values for future edits.
I have played with bo... | No great solutions so I build my own. A pretty simple custom control. Comments welcome.
```
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace BinaryOcean.Web.Library.WebControls
{
[ToolboxData("<{0}:PostBackTimer runat=\"server\" />"), DefaultProperty("Seco... |
529,240 | <p>I have a script where I do some magic stuff to dynamically load a module, and instantiate the first class found in the module. But I can't use <code>types.ClassType</code> anymore in Python 3. What is the correct way to do this now?</p>
| [
{
"answer_id": 529288,
"author": "SilentGhost",
"author_id": 12855,
"author_profile": "https://Stackoverflow.com/users/12855",
"pm_score": 3,
"selected": false,
"text": "<p>It was used for <a href=\"http://docs.python.org/release/2.5.2/ref/node33.html\" rel=\"nofollow noreferrer\">classi... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3757/"
] | I have a script where I do some magic stuff to dynamically load a module, and instantiate the first class found in the module. But I can't use `types.ClassType` anymore in Python 3. What is the correct way to do this now? | I figured it out. It seems that classes are of type "type". Here is an example of how to distinguish between classes and other objects at runtime.
```
>>> class C: pass
...
>>> type(C)
<class 'type'>
>>> isinstance(C, type)
True
>>> isinstance('string', type)
False
``` |
529,249 | <p>In a multi-thread app. is there a way to programatically have thread-B check what function thead-A is currently in?</p>
| [
{
"answer_id": 529266,
"author": "Jon Tackabury",
"author_id": 343,
"author_profile": "https://Stackoverflow.com/users/343",
"pm_score": 3,
"selected": false,
"text": "<p>You can get a stack trace of another thread by doing this:</p>\n\n<pre><code>System.Diagnostics.StackTrace stackTrace... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22582/"
] | In a multi-thread app. is there a way to programatically have thread-B check what function thead-A is currently in? | You can get a stack trace of another thread by doing this:
```
System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(myThread);
```
From this you can get the call stack, and the function it's currently executing. |
529,252 | <p>The Microchip PIC MPLAB (MCC18) compiler segments its memory into 256 chunks ( 0x100 ).</p>
<p>How can I create an array larger than 256 bytes?</p>
<pre><code>char buffer[256];
</code></pre>
<p>Just to get to 256 I needed to make a seperate segment with a <code>#pragma</code></p>
<pre><code>#pragma udata segment... | [
{
"answer_id": 529328,
"author": "rmeador",
"author_id": 10861,
"author_profile": "https://Stackoverflow.com/users/10861",
"pm_score": 2,
"selected": false,
"text": "<p>Perhaps someone with more knowledge will prove me wrong, but I don't think it's possible to do what you want. If the m... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/609/"
] | The Microchip PIC MPLAB (MCC18) compiler segments its memory into 256 chunks ( 0x100 ).
How can I create an array larger than 256 bytes?
```
char buffer[256];
```
Just to get to 256 I needed to make a seperate segment with a `#pragma`
```
#pragma udata segment_name
char buffer[256];
#pragma udata
```
So I can ei... | Pasting answer from:
<http://forum.microchip.com/printable.aspx?m=39357>
Just in case it goes away.
>
> In Three Easy Steps Step 1: Assign the
> variable into a named section in
> source code:
>
>
>
> ```
> #pragma udata big_scn
> char big_array[0x180];
> #pragma udata
>
> ```
>
> Step 2: Create the larger ... |
529,286 | <p>I am doing some asynchronous work on a separate thread using:</p>
<pre><code>ThreadPool.QueueUserWorkItem()
</code></pre>
<p>and in this separate thread, I need to call <code>HttpContext.Current</code> so that I can access:</p>
<pre><code>HttpContext.Current.Cache
HttpContext.Current.Server
HttpContext.Current.R... | [
{
"answer_id": 529308,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 5,
"selected": false,
"text": "<p>You can access the ASP.NET cache with <strong>HttpRuntime.Cache</strong> even when you don't have a HttpContext, bu... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1100768/"
] | I am doing some asynchronous work on a separate thread using:
```
ThreadPool.QueueUserWorkItem()
```
and in this separate thread, I need to call `HttpContext.Current` so that I can access:
```
HttpContext.Current.Cache
HttpContext.Current.Server
HttpContext.Current.Request
```
However, `HttpContext.Current`... | I'd try not to hold a reference to an object that depends on the ASP.NET stack like the HttpContext. If you need to do some work in a different thread, it's because you don't want to wait in the ASP.NET one till your task is finished. And maybe the Request/Context/Session is terminated while your thread is not.
You sh... |
529,287 | <p>I have a system that exports a .csv file and some of the rows contain special box characters such that the data looks like this:</p>
<pre><code>Please specify the primary type of opportunity which you’re proposing:
└─ Please specify what type of sport:
└─ What is this person’s vocation?
└── How long have they been ... | [
{
"answer_id": 529303,
"author": "Edoardo Vacchi",
"author_id": 7849,
"author_profile": "https://Stackoverflow.com/users/7849",
"pm_score": 2,
"selected": false,
"text": "<p>excel is probably trying to open the file using the wrong encoding; try opening the file from within Excel, and ch... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34942/"
] | I have a system that exports a .csv file and some of the rows contain special box characters such that the data looks like this:
```
Please specify the primary type of opportunity which you’re proposing:
└─ Please specify what type of sport:
└─ What is this person’s vocation?
└── How long have they been in the industr... | In a PHP generated CSV I solved it with utf8\_decode() for the concerning columns. |
529,327 | <p>I'm writing a program in C for Linux on an ARM9 processor. The program is to access network packets which include a sequence of tagged data like:</p>
<pre><code><fieldID><length><data><fieldID><length><data> ...
</code></pre>
<p>The fieldID and length fields are both uint16_t. ... | [
{
"answer_id": 529339,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<p>To avoid alignment issues in this case, access all data as an <code>unsigned char *</code>. So:</p>\n\n<pre><code>unsi... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7685/"
] | I'm writing a program in C for Linux on an ARM9 processor. The program is to access network packets which include a sequence of tagged data like:
```
<fieldID><length><data><fieldID><length><data> ...
```
The fieldID and length fields are both uint16\_t. The data can be 1 or more bytes (up to 64k if the full length ... | To avoid alignment issues in this case, access all data as an `unsigned char *`. So:
```
unsigned char *p;
//...
uint16_t id = p[0] | (p[1] << 8);
p += 2;
```
The above example assumes "little endian" data layout, where the least significant byte comes first in a multi-byte number. |
529,334 | <p>I've got a VirtualHost that looks something like:</p>
<pre><code><VirtualHost *:80>
ServerName domain1.com
ServerAlias www.domain1.com domain2.com www.domain2.com
</VirtualHost>
</code></pre>
<p>When someone visits www.domain1.com/test, they should be redirected to:</p>
<pre><code>domain1.com/t... | [
{
"answer_id": 529386,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 3,
"selected": false,
"text": "<p>No need for rewrites.</p>\n\n<pre><code><VirtualHost *:80>\n ServerName domain1.com\n ServerAlias domain2.c... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22468/"
] | I've got a VirtualHost that looks something like:
```
<VirtualHost *:80>
ServerName domain1.com
ServerAlias www.domain1.com domain2.com www.domain2.com
</VirtualHost>
```
When someone visits www.domain1.com/test, they should be redirected to:
```
domain1.com/test
```
When someone visits www.domain2.com/tes... | Your RewriteCond is a bit wonky. I'm surprised it does anything at all, since it would seem to be trying to match the host `www.domain1.com` against the pattern `www\.www.domain1.com`. These directives worked for me:
```
# Redirect www to non-www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^... |
529,345 | <p>what's the best way to do this? I'm no command line warrior, but I was thinking there's possibly a way of using <code>grep</code> and <code>cat</code>.</p>
<p>I just want to replace a string that occurs in a folder and sub-folders. what's the best way to do this? I'm running ubuntu if that matters.</p>
| [
{
"answer_id": 529361,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 6,
"selected": true,
"text": "<pre><code>find . -type f -print0 | xargs -0 -n 1 sed -i -e 's/from/to/g'\n</code></pre>\n\n<p>The first part of that is... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28360/"
] | what's the best way to do this? I'm no command line warrior, but I was thinking there's possibly a way of using `grep` and `cat`.
I just want to replace a string that occurs in a folder and sub-folders. what's the best way to do this? I'm running ubuntu if that matters. | ```
find . -type f -print0 | xargs -0 -n 1 sed -i -e 's/from/to/g'
```
The first part of that is a find command to find the files you want to change. You may need to modify that appropriately. The `xargs` command takes every file the find found and applies the `sed` command to it. The `sed` command takes every instan... |
529,355 | <p>I'm working on an approach to trace logging for my company's VB.NET project. The .NET framework has pretty versatile trace capabilities and I'd like to use what .NET already provides. My company wants to stay away from 3rd party software, so log4net and whatnot is out of the question.</p>
<p>They want to be able ... | [
{
"answer_id": 529375,
"author": "Sandeep Datta",
"author_id": 39648,
"author_profile": "https://Stackoverflow.com/users/39648",
"pm_score": 0,
"selected": false,
"text": "<p>If you are talking about primitive variables like int, double etc then this will be tough but if you need to trac... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54844/"
] | I'm working on an approach to trace logging for my company's VB.NET project. The .NET framework has pretty versatile trace capabilities and I'd like to use what .NET already provides. My company wants to stay away from 3rd party software, so log4net and whatnot is out of the question.
They want to be able to trace the... | Tracing every variable change would quickly become messy and lead to information overload for any but the most trivial of applications.
If there are specific variables that you want to trace the changes in, wrap them in a simple self-rolled Traceable class with accessors that write out to Trace when you do an update. |
529,374 | <p>So, I am working with .NET. I have an XSL file, XslTransform object in C# that reads in the XSL file and transforms a piece of XML data (manufactured in-house) into HTML. </p>
<p>I notice that my final output has <strong><</strong> and <strong>></strong> automatically encoded into <strong>&lt;</strong> and <... | [
{
"answer_id": 529406,
"author": "Assaf Lavie",
"author_id": 11208,
"author_profile": "https://Stackoverflow.com/users/11208",
"pm_score": 0,
"selected": false,
"text": "<p>(XslTransform is deprecated, according to MSDN. They recommend you switch to XslCompiledTransform.)</p>\n\n<p>Can y... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10088/"
] | So, I am working with .NET. I have an XSL file, XslTransform object in C# that reads in the XSL file and transforms a piece of XML data (manufactured in-house) into HTML.
I notice that my final output has **<** and **>** automatically encoded into **<** and **>**. Is there any ways I can prevent that from happe... | Your xsl file should have:
* an output of html
* omit namespaces for all used in the xslt
i.e.
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="xsl msxsl">
<xsl:output method="html" indent="no" om... |
529,395 | <p>I am a noob when it comes to python. I have a python script which gives me output like this:</p>
<pre><code>[last] ZVZX-W3vo9I: Downloading video webpage
[last] ZVZX-W3vo9I: Extracting video information
[download] Destination: myvideo.flv
[download] 9.9% of 10.09M at 3.30M/s ETA 00:02
</code></pre>
<p>The las... | [
{
"answer_id": 529415,
"author": "mipadi",
"author_id": 28804,
"author_profile": "https://Stackoverflow.com/users/28804",
"pm_score": 3,
"selected": true,
"text": "<p>If I understand your request properly, you should be able to change that function to this:</p>\n\n<pre><code>def report_p... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51649/"
] | I am a noob when it comes to python. I have a python script which gives me output like this:
```
[last] ZVZX-W3vo9I: Downloading video webpage
[last] ZVZX-W3vo9I: Extracting video information
[download] Destination: myvideo.flv
[download] 9.9% of 10.09M at 3.30M/s ETA 00:02
```
The last line keeps getting updat... | If I understand your request properly, you should be able to change that function to this:
```
def report_progress(self, percent_str, data_len_str, speed_str, eta_str):
"""Report download progress."""
print u'[download] %s of %s at %s ETA %s' % (percent_str, data_len_str, speed_str, eta_str)
```
That will pr... |
529,407 | <p>I want to create a sort of light/thick box that only acts on a single DIV within a page.
When mine fires off the first div(phantom_back) acts as I want it but the second, phantom_top sets its self after phantom_back regardless of its z-index and positioning.</p>
<p>What am I doing wrong?</p>
<p>Here is what I have... | [
{
"answer_id": 529478,
"author": "Jason",
"author_id": 22786,
"author_profile": "https://Stackoverflow.com/users/22786",
"pm_score": 0,
"selected": false,
"text": "<p>phantom_top is set to position:relative not absolute therefore it's currently not overlapping phantom_back.</p>\n"
},
... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46857/"
] | I want to create a sort of light/thick box that only acts on a single DIV within a page.
When mine fires off the first div(phantom\_back) acts as I want it but the second, phantom\_top sets its self after phantom\_back regardless of its z-index and positioning.
What am I doing wrong?
Here is what I have so far:
```
... | So, I got it. I set an absolute positioning on phantom\_back and instead of trying to restack them I just set the visibility. When I tried to set the z-index it would fall apart on me.
```
<html>
<head>
<script type="text/javascript">
<!--//
function phantom_back(image)
{
do... |
529,424 | <p>How do I traverse a list in reverse order in Python? So I can start from <code>collection[len(collection)-1]</code> and end in <code>collection[0]</code>.</p>
<p>I also want to be able to access the loop index.</p>
| [
{
"answer_id": 529427,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 12,
"selected": true,
"text": "<p>Use the built-in <a href=\"https://docs.python.org/library/functions.html#reversed\" rel=\"noreferrer\"><code>reversed... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51816/"
] | How do I traverse a list in reverse order in Python? So I can start from `collection[len(collection)-1]` and end in `collection[0]`.
I also want to be able to access the loop index. | Use the built-in [`reversed()`](https://docs.python.org/library/functions.html#reversed) function:
```
>>> a = ["foo", "bar", "baz"]
>>> for i in reversed(a):
... print(i)
...
baz
bar
foo
```
To also access the original index, use [`enumerate()`](https://docs.python.org/library/functions.html#enumerate) on your... |
529,428 | <p>I have a query that I am generating the XML from in Oracle using the DBMS_XMLGEN package.</p>
<p>As an example, I am using a cursor as follows:</p>
<pre><code>SELECT
A.NAME primaryName,
(CURSOR(SELECT B.NAME AS NAME FROM B WHERE B.ID=A.ID)) SYNONYMS
FROM
A
</code></pre>
<p>I have a query context, qtx, an... | [
{
"answer_id": 529480,
"author": "Nick",
"author_id": 62985,
"author_profile": "https://Stackoverflow.com/users/62985",
"pm_score": 2,
"selected": true,
"text": "<p>You'll need to drop down to PL/SQL where you have more control over the dbms_xmlgen package. For instance, here is how you ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64274/"
] | I have a query that I am generating the XML from in Oracle using the DBMS\_XMLGEN package.
As an example, I am using a cursor as follows:
```
SELECT
A.NAME primaryName,
(CURSOR(SELECT B.NAME AS NAME FROM B WHERE B.ID=A.ID)) SYNONYMS
FROM
A
```
I have a query context, qtx, and set the query to the above for... | You'll need to drop down to PL/SQL where you have more control over the dbms\_xmlgen package. For instance, here is how you can change the behavior of the row tags it sets.
```
declare
qryctx DBMS_XMLGEN.ctxhandle;
results xmltype;
begin
qryctx := dbms_xmlgen.newcontext('select foo from bar where id = my_id');
db... |
529,432 | <p>Is there a way to use DecimalFormat (or some other standard formatter) to format numbers like this:</p>
<blockquote>
<p>1,000,000 => 1.00M</p>
<p>1,234,567 => 1.23M</p>
<p>1,234,567,890 => 1234.57M</p>
</blockquote>
<p>Basically dividing some number by 1 million, keeping 2 decimal places, and slappi... | [
{
"answer_id": 529453,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "<p>Take a look at <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/text/ChoiceFormat.html\" rel=\"nofollow noreferrer\... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1471/"
] | Is there a way to use DecimalFormat (or some other standard formatter) to format numbers like this:
>
> 1,000,000 => 1.00M
>
>
> 1,234,567 => 1.23M
>
>
> 1,234,567,890 => 1234.57M
>
>
>
Basically dividing some number by 1 million, keeping 2 decimal places, and slapping an 'M' on the end. I've thought about cr... | ```
String.format("%.2fM", theNumber/ 1000000.0);
```
For more information see the [String.format javadocs](http://java.sun.com/javase/6/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object...)). |
529,447 | <p>here is the code </p>
<pre><code><php?
$id1 =1;
$id2 = "module 1 loaded";
echo "$var1=$id1","$var2=$id2";
?>
</code></pre>
<p>i know this is not correct way how can i pass these two varables to flash</p>
| [
{
"answer_id": 529492,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>If you want to create a script which outputs data which can be loaded with <a href=\"http://www.adobe.com/support/flas... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16458/"
] | here is the code
```
<php?
$id1 =1;
$id2 = "module 1 loaded";
echo "$var1=$id1","$var2=$id2";
?>
```
i know this is not correct way how can i pass these two varables to flash | ```
<?php
echo http_build_query( array(
'var1' => 1
,'var2' => 'module 1 loaded'
));
``` |
529,474 | <p>I tried to run a shell script from java code, but I am facing problem. The script is in batchstart.sh file -</p>
<pre><code>#!/bin/ksh
export DISPLAY=:0.0
</code></pre>
<p>Now the script is run with a dot on the command line -- . batchstart.sh</p>
<p>How do I run it from java? My java code is below. It throws the... | [
{
"answer_id": 529495,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 1,
"selected": false,
"text": "<p>The source command (\"<code>.</code>\") is a shell built-in. You have to explicitly run <code>/bin/ksh</code>, passin... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26927/"
] | I tried to run a shell script from java code, but I am facing problem. The script is in batchstart.sh file -
```
#!/bin/ksh
export DISPLAY=:0.0
```
Now the script is run with a dot on the command line -- . batchstart.sh
How do I run it from java? My java code is below. It throws the following exception -
```
java... | The source command ("`.`") is a shell built-in. You have to explicitly run `/bin/ksh`, passing your script name as the argument (followed by any script arguments).
You have a larger problem if you **need** to source the script. That usually means that environment changes happen in the context of the current shell, not... |
529,482 | <p>I am new to coding and trying to get up to speed with Objective-C.
Came across some code I did not understand. I was hoping someone could
clarify it for me. In the case below, I am not sure how *foo2 is working and why it is not being released? </p>
<pre><code>ClassOne *pointer = [[ClassOne alloc]init];
ClassTwo *... | [
{
"answer_id": 529553,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 1,
"selected": false,
"text": "<p>Because you haven't released it. You're releasing references here, not freeing pointers. It's not quite the same t... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54836/"
] | I am new to coding and trying to get up to speed with Objective-C.
Came across some code I did not understand. I was hoping someone could
clarify it for me. In the case below, I am not sure how \*foo2 is working and why it is not being released?
```
ClassOne *pointer = [[ClassOne alloc]init];
ClassTwo *foo = [[Class... | With Objective-C Cocoa, we're working with semi-automatic reference-counting memory management. When allocating memory for an object, retaining an object, or calling a `copy` method on an object, the retain count (reference count) increments by 1. When calling `release` on an object, it decrements the retain count by o... |
529,484 | <p>in .NET is there a function that returns the root letter (the letter without special attributes like cedilla), kinda:</p>
<pre><code>Select Case c
Case "á", "à", "ã", "â", "ä", "ª" : x = "a"
Case "é", "è", "ê", "ë" : x = "e"
Case "í", "ì", "î", "ï" : x = "i"
Case "ó", "ò", "õ", "ô", "ö", "º" : x = "o"
Cas... | [
{
"answer_id": 529496,
"author": "Chetan S",
"author_id": 31284,
"author_profile": "https://Stackoverflow.com/users/31284",
"pm_score": 4,
"selected": true,
"text": "<p>See if this works out for you:</p>\n\n<p><a href=\"http://weblogs.asp.net/fmarguerie/archive/2006/10/30/removing-diacri... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28004/"
] | in .NET is there a function that returns the root letter (the letter without special attributes like cedilla), kinda:
```
Select Case c
Case "á", "à", "ã", "â", "ä", "ª" : x = "a"
Case "é", "è", "ê", "ë" : x = "e"
Case "í", "ì", "î", "ï" : x = "i"
Case "ó", "ò", "õ", "ô", "ö", "º" : x = "o"
Case "ú", "ù", "û... | See if this works out for you:
<http://weblogs.asp.net/fmarguerie/archive/2006/10/30/removing-diacritics-accents-from-strings.aspx> |
529,502 | <p>I'm using the Delphi function </p>
<pre><code>StringCodePage
</code></pre>
<p>I call it on a string returned by a COM function (Acrobat Annotation getContents - see my other posts) and it returns 0. </p>
<p>What is 0? Ansi?</p>
| [
{
"answer_id": 529604,
"author": "gabr",
"author_id": 4997,
"author_profile": "https://Stackoverflow.com/users/4997",
"pm_score": 4,
"selected": true,
"text": "<p>Code page 0 is CP_ACP, current Windows ANSI code page.</p>\n<p>From Windows.pas:</p>\n<pre><code>{$EXTERNALSYM CP_ACP}\nCP_AC... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6244/"
] | I'm using the Delphi function
```
StringCodePage
```
I call it on a string returned by a COM function (Acrobat Annotation getContents - see my other posts) and it returns 0.
What is 0? Ansi? | Code page 0 is CP\_ACP, current Windows ANSI code page.
From Windows.pas:
```
{$EXTERNALSYM CP_ACP}
CP_ACP = 0; { default to ANSI code page }
```
From [MSDN](http://msdn.microsoft.com/en-us/library/ms776413.aspx "MultiByteToWideChar"):
>
> CP\_ACP
>
>
> The current system Windows A... |
529,515 | <p>I have been trying to fill my ultracombo box with data yet it takes a signifigant amount of time. However when I run the same stored procedure from withing sql server it takes relatively no time. The line of code that the program gets hung up on is:</p>
<pre><code>SprocPatientsTableAdapter.Fill(Me.PatientsDataSet.s... | [
{
"answer_id": 529534,
"author": "Sanjay Sheth",
"author_id": 57680,
"author_profile": "https://Stackoverflow.com/users/57680",
"pm_score": 1,
"selected": false,
"text": "<p>Try using the SQL Server Profiler to see what query your program is sending exactly to the database. You may see s... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5578/"
] | I have been trying to fill my ultracombo box with data yet it takes a signifigant amount of time. However when I run the same stored procedure from withing sql server it takes relatively no time. The line of code that the program gets hung up on is:
```
SprocPatientsTableAdapter.Fill(Me.PatientsDataSet.sprocPatients, ... | Try using the SQL Server Profiler to see what query your program is sending exactly to the database. You may see some other parameters being passed that are affecting the query and slowing it down dramatically. |
529,535 | <p>I have a PHP script which executes a shell command:</p>
<pre><code>$handle = popen('python last', 'r');
$read = fread($handle, 4096);
print_r($read);
pclose($handle);
</code></pre>
<p>I echo the output of the shell output. When I run this in the command I get something like this:</p>
<pre><code>[root@localhost te... | [
{
"answer_id": 529612,
"author": "arul",
"author_id": 15409,
"author_profile": "https://Stackoverflow.com/users/15409",
"pm_score": 5,
"selected": true,
"text": "<p>You read only the first 4,096 bytes from the pipe, you'll need to place the <code>fread</code>/<code>print</code>_r in a lo... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51649/"
] | I have a PHP script which executes a shell command:
```
$handle = popen('python last', 'r');
$read = fread($handle, 4096);
print_r($read);
pclose($handle);
```
I echo the output of the shell output. When I run this in the command I get something like this:
```
[root@localhost tester]# python last
[last] ZVZX-W3vo9I... | You read only the first 4,096 bytes from the pipe, you'll need to place the `fread`/`print`\_r in a loop and check for the end-of-file using the `feof` function.
```
$handle = popen('python last', 'r');
while(!feof($handle))
{
print_r(fread($handle, 4096));
}
pclose($handle);
``` |
529,537 | <p>In MySQL, I can create an access a session variable by using a single @.
Example initialization:</p>
<pre><code>set @myVar = true;
</code></pre>
<p>Some trigger containing this code:</p>
<pre><code>if (@myVar is not true) then
execute something
</code></pre>
<p>What is the equivalent in Oracle 10g?</p>
| [
{
"answer_id": 529600,
"author": "Thomas Jones-Low",
"author_id": 23030,
"author_profile": "https://Stackoverflow.com/users/23030",
"pm_score": 2,
"selected": false,
"text": "<p>A package global variable would probably do the same trick. </p>\n\n<pre><code>CREATE OR REPLACE PACKAGE foo a... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6013/"
] | In MySQL, I can create an access a session variable by using a single @.
Example initialization:
```
set @myVar = true;
```
Some trigger containing this code:
```
if (@myVar is not true) then
execute something
```
What is the equivalent in Oracle 10g? | ```
SQL> EXEC DBMS_SESSION.SET_CONTEXT('CLIENTCONTEXT', 'myvar', 'myvalue');
PL/SQL procedure successfully completed
SQL> SELECT SYS_CONTEXT('CLIENTCONTEXT', 'myvar') FROM dual;
SYS_CONTEXT('CLIENTCONTEXT','M
--------------------------------------------------------------------------------
myvalue
``` |
529,550 | <p>I have a C# class library and a startup project (a console app). The class library includes a service reference to a web service. When I try to run the project, I get an InvalidOperationException because the startup project isn't reading the class library's app.config, and it's ignoring the service reference. To get... | [
{
"answer_id": 529575,
"author": "Martin Bring",
"author_id": 42230,
"author_profile": "https://Stackoverflow.com/users/42230",
"pm_score": 1,
"selected": false,
"text": "<p>You just need to copy the config key, pointing to the service, from your class library config file to your console... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42981/"
] | I have a C# class library and a startup project (a console app). The class library includes a service reference to a web service. When I try to run the project, I get an InvalidOperationException because the startup project isn't reading the class library's app.config, and it's ignoring the service reference. To get it... | Think about what you are trying to do - you have two assemblies that you are building:
```
Library
ConsoleApp
```
Both of these assemblies have configuration files - I would imagine they look something like this:
```
Library
app.config
ConsoleApp
ConsoleApp.exe.config
```
When you run `ConsoleApp` it has ... |
529,551 | <p>I want remove "Language" querystring from my url. How can I do this? (using Asp.net 3.5 , c#)</p>
<pre><code>Default.aspx?Agent=10&Language=2
</code></pre>
<p>I want to remove "Language=2", but language would be the first,middle or last. So I will have this</p>
<pre><code>Default.aspx?Agent=2... | [
{
"answer_id": 529585,
"author": "RKitson",
"author_id": 16947,
"author_profile": "https://Stackoverflow.com/users/16947",
"pm_score": 0,
"selected": false,
"text": "<p>You're probably going to want use a Regular Expression to find the parameter you want to remove from the querystring, t... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51734/"
] | I want remove "Language" querystring from my url. How can I do this? (using Asp.net 3.5 , c#)
```
Default.aspx?Agent=10&Language=2
```
I want to remove "Language=2", but language would be the first,middle or last. So I will have this
```
Default.aspx?Agent=20
``` | I answered a [similar question](https://stackoverflow.com/questions/229925/outputing-a-manipulated-querystring-in-c/) a while ago. Basically, the best way would be to use the class `HttpValueCollection`, which the `QueryString` property actually is, unfortunately it is internal in the .NET framework.
You could use Refl... |
529,556 | <p>I'm trying to use XPath to find all elements that have an element in a given namespace.</p>
<p>For example, in the following document I want to find the <code>foo:bar</code> and <code>doodah</code> elements:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<root xmlns:foo="http://foo.example.com">... | [
{
"answer_id": 529611,
"author": "jor",
"author_id": 53326,
"author_profile": "https://Stackoverflow.com/users/53326",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure if this is what you mean, but by only deleting one char in your XPath you get all elements in a certain namesp... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31582/"
] | I'm trying to use XPath to find all elements that have an element in a given namespace.
For example, in the following document I want to find the `foo:bar` and `doodah` elements:
```
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:foo="http://foo.example.com">
<foo:bar quux="value">Content</foo:bar>
<widget>Co... | Use:
```
//*[namespace-uri()='yourNamespaceURI-here'
or
@*[namespace-uri()='yourNamespaceURI-here']
]
```
the predicate two conditions are or-ed with the XPath `or` operator.
The XPath expression thus selects any element that either:
* belongs to the specified namespace.
* has attributes that belong to ... |
529,570 | <p>I'm going to apologize in advance for how basic this question is, but this is my first time using JavaScript in HTML.</p>
<p>Basically, I have a JavaScript that produces a different bit of random text every time a user loads the page. I'd like to format that text in Helvetica and then display it centred in the midd... | [
{
"answer_id": 529589,
"author": "David Kolar",
"author_id": 3283,
"author_profile": "https://Stackoverflow.com/users/3283",
"pm_score": 0,
"selected": false,
"text": "<p>How about using <code>text-align: center</code>?:</p>\n\n<pre><code>#content \n{\nfont-family: Helvetica, Geneva, Ari... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64286/"
] | I'm going to apologize in advance for how basic this question is, but this is my first time using JavaScript in HTML.
Basically, I have a JavaScript that produces a different bit of random text every time a user loads the page. I'd like to format that text in Helvetica and then display it centred in the middle of the ... | Well for starters, your missing your HTML tags.
You need to wrap your HTML code between HTML Tags.
Second, you will need to set your text to a different color as the background color. In your CSS, you will need to change the #horizon color to black, or something else.
Other than that, your code works. |
529,590 | <p>I've recently been working with someone else's code and I realized that this individual has a very different philosophy regarding private variables and method parameters than I do. I generally feel that private variables should only be used in a case when:</p>
<ol>
<li>The variable needs to be stored for recall lat... | [
{
"answer_id": 529615,
"author": "David Anderson",
"author_id": 52589,
"author_profile": "https://Stackoverflow.com/users/52589",
"pm_score": 2,
"selected": false,
"text": "<p>You should only create variables when and where they are needed, and dispose of them when you are done. If the c... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57191/"
] | I've recently been working with someone else's code and I realized that this individual has a very different philosophy regarding private variables and method parameters than I do. I generally feel that private variables should only be used in a case when:
1. The variable needs to be stored for recall later.
2. The da... | In general, class members should represent *state* of the class object.
They are not temporary locations for method parameters (that's what method parameters are for). |
529,621 | <p>Hi is there any way to change a Resource brush from code or via some binding?
what I want to do is change the color of my "main" brush when a button is clicked.</p>
<p>Thanks a lot!</p>
<p>Edit:</p>
<p>Its a GradientBrush how do i change the colors on that? </p>
<pre><code>myBrush.GradientStops[0].Color = Colors... | [
{
"answer_id": 529730,
"author": "geofftnz",
"author_id": 20122,
"author_profile": "https://Stackoverflow.com/users/20122",
"pm_score": -1,
"selected": false,
"text": "<p>If you're using the Model-View-ViewModel (MVVM) pattern or something similar, you could make the brush colour (or the... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58553/"
] | Hi is there any way to change a Resource brush from code or via some binding?
what I want to do is change the color of my "main" brush when a button is clicked.
Thanks a lot!
Edit:
Its a GradientBrush how do i change the colors on that?
```
myBrush.GradientStops[0].Color = Colors.Red;
```
just gives me a excepti... | For animating the change, try creating a Storyboard and calling Begin on it.
(I'll go throw together an example)
edit: Looks like it's another Silverlight != WPF fail on my part. I cant seem to get it going in WPF. |
529,625 | <p>The default </p>
<pre><code>[1..5]
</code></pre>
<p>gives this</p>
<pre><code>[1,2,3,4,5]
</code></pre>
<p>and can also be done with the range function. Is it possible to change the step size between the points, so that I could get something like the following instead?</p>
<pre><code>[1,1.5,2,2.5,3,3.5,4,4.5,5]... | [
{
"answer_id": 529630,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 6,
"selected": true,
"text": "<pre><code>[1,1.5..5]\n</code></pre>\n"
},
{
"answer_id": 529837,
"author": "Paul Johnson",
"author_... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/85/"
] | The default
```
[1..5]
```
gives this
```
[1,2,3,4,5]
```
and can also be done with the range function. Is it possible to change the step size between the points, so that I could get something like the following instead?
```
[1,1.5,2,2.5,3,3.5,4,4.5,5]
``` | ```
[1,1.5..5]
``` |
529,643 | <p>We are trying to prevent users from typing beyond the maximum characters our DB allows for text area fields in our web app. Once they have reached the max length allowed in the text area we would still like to allow them to hit keys that are non-printing for example: <code>Tab</code>, <code>backspace</code>, <code>c... | [
{
"answer_id": 529630,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 6,
"selected": true,
"text": "<pre><code>[1,1.5..5]\n</code></pre>\n"
},
{
"answer_id": 529837,
"author": "Paul Johnson",
"author_... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36333/"
] | We are trying to prevent users from typing beyond the maximum characters our DB allows for text area fields in our web app. Once they have reached the max length allowed in the text area we would still like to allow them to hit keys that are non-printing for example: `Tab`, `backspace`, `ctrl`+`s`, etc.
I'm wondering ... | ```
[1,1.5..5]
``` |
529,647 | <p>I have looked all of the place for this and I can't seem to get a complete answer for this. So if the answer does already exist on stackoverflow then I apologize in advance.</p>
<p>I want a unique and random ID so that users in my website can't guess the next number and just hop to someone else's information. I pla... | [
{
"answer_id": 529679,
"author": "David Basarab",
"author_id": 2469,
"author_profile": "https://Stackoverflow.com/users/2469",
"pm_score": 4,
"selected": false,
"text": "<p>If you don't want other users to see people information why don't you secure the page which you are using the id?</... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62544/"
] | I have looked all of the place for this and I can't seem to get a complete answer for this. So if the answer does already exist on stackoverflow then I apologize in advance.
I want a unique and random ID so that users in my website can't guess the next number and just hop to someone else's information. I plan to stick... | [In response to the edit]
You should consider query strings as "evil input". You need to programmatically check that the authenticated user is allowed to view the requested item.
```
if( !item456.BelongsTo(user123) )
{
// Either show them one of their items or a show an error message.
}
``` |
529,651 | <p>I have a Ruby script in my Rails app that I use to load some data from Twitter.</p>
<p>In the future I will make it an automatic background process, but for now I run it manually like: </p>
<pre><code>ruby /lib/twitter/twitterLoad.rb
</code></pre>
<p>In order to use the Rails model classes and such, I have the fo... | [
{
"answer_id": 529670,
"author": "Aram Verstegen",
"author_id": 64234,
"author_profile": "https://Stackoverflow.com/users/64234",
"pm_score": 0,
"selected": false,
"text": "<p>add the line:\n<code>RAILS_ENV = '<your environment of choice>'</code></p>\n\n<p><a href=\"http://wiki.rub... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24988/"
] | I have a Ruby script in my Rails app that I use to load some data from Twitter.
In the future I will make it an automatic background process, but for now I run it manually like:
```
ruby /lib/twitter/twitterLoad.rb
```
In order to use the Rails model classes and such, I have the following as the top line of the sc... | If you're going to be using the rails environment, your best bet would be to make this a rake script. To do this, put a *twitter.rake* file into *lib/tasks* and begin and end it like this:
```
task(:twitter_load => :environment) do
# your code goes here
end
```
That way, you're doing it by "following conventions" ... |
529,652 | <p>I have a string of values separated by a space that I return to the Jquery call, but it does not separate the words into rows. Should the data be returned as a string or a list or something else?</p>
| [
{
"answer_id": 529669,
"author": "nickohrn",
"author_id": 59907,
"author_profile": "https://Stackoverflow.com/users/59907",
"pm_score": 2,
"selected": false,
"text": "<p>If you're using the plugin located <a href=\"http://plugins.jquery.com/project/jq-autocomplete\" rel=\"nofollow norefe... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49632/"
] | I have a string of values separated by a space that I return to the Jquery call, but it does not separate the words into rows. Should the data be returned as a string or a list or something else? | By default it wants the results separated by newlines. If you supply a list of values separated by spaces you'll want to provide a parse function that will take the returned data and turn it into an array. The same is true if you supply a list of values instead.
Here's a sample from a project I'm working on that retur... |
529,653 | <p>Working with Test::Unit and Shoulda. Trying to test <code>Users.create</code>. My understanding is that Rails forms send params for an object like this:</p>
<pre><code>user[email]
</code></pre>
<p>Which turns into hash in your action, right?</p>
<pre><code>params[:user][:email]
</code></pre>
<p>OK, so in my test... | [
{
"answer_id": 529665,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 7,
"selected": true,
"text": "<pre><code>post :create, :user => { :email => 'foo@bar.com' }\n</code></pre>\n\n<p>The general form for all the te... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] | Working with Test::Unit and Shoulda. Trying to test `Users.create`. My understanding is that Rails forms send params for an object like this:
```
user[email]
```
Which turns into hash in your action, right?
```
params[:user][:email]
```
OK, so in my test I've tried...
```
setup { post :create, :post => { 'user[e... | ```
post :create, :user => { :email => 'foo@bar.com' }
```
The general form for all the test methods of get, post, put, delete are as follows:
```
def post(action_name, params_hash = {}, session_hash = {})
```
And in tests, the params hash gets directly sent into `params` of your controller action with no translat... |
529,654 | <p>I'm trying to return sequence.nextval to my program from a proc stored in a package. I'm pretty green when it comes to PL/SQL and I'm kind of at a loss as to what is happening. The error that is actually being return is </p>
<p>PLS-00306: Wrong number or types of arguments in call to PROCGET_BOOKMARKID line 1, co... | [
{
"answer_id": 529773,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": true,
"text": "<p>I've just compiled your package, in <code>PL/SQL Developer</code> it works fine.</p>\n\n<p>The problem seems to be with... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49294/"
] | I'm trying to return sequence.nextval to my program from a proc stored in a package. I'm pretty green when it comes to PL/SQL and I'm kind of at a loss as to what is happening. The error that is actually being return is
PLS-00306: Wrong number or types of arguments in call to PROCGET\_BOOKMARKID line 1, column 7 stat... | I've just compiled your package, in `PL/SQL Developer` it works fine.
The problem seems to be with the datatypes in your `C#` code.
From what I see in description, you don't bind any parameters. You should bind parameters somewhere in your code, like
```
OracleParameter bid = new OracleParameter("bookmarkID", Oracle... |
529,655 | <p>Is it possible to send attributes in a SAML authentication request?</p>
<pre><code><samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="aaf23196-1773-2113-474a-fe114412ab72"
Version="2.0"
IssueInstant="2004-12-05T09:21:59Z"
... | [
{
"answer_id": 531374,
"author": "metadaddy",
"author_id": 33905,
"author_profile": "https://Stackoverflow.com/users/33905",
"pm_score": 4,
"selected": true,
"text": "<p>Technically, yes, it is possible, since AuthnRequest can contain an Extensions element, which can contain anything - s... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22801/"
] | Is it possible to send attributes in a SAML authentication request?
```
<samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="aaf23196-1773-2113-474a-fe114412ab72"
Version="2.0"
IssueInstant="2004-12-05T09:21:59Z"
AssertionConsum... | Technically, yes, it is possible, since AuthnRequest can contain an Extensions element, which can contain anything - see [the SAML 'core' spec](http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf): AuthnRequest (section 3.4.1) is derived from RequestAbstractType (section 3.2.1) which has an optional Exte... |
529,657 | <p>I'm trying to write a regular expression that surrounds "http" URLs with angle brackets, except for lines beginning with two slashes. The best I've come up with is:</p>
<p><code>s#^(?!//)(.*?)(<a href="http://[" rel="nofollow noreferrer">http://[</a>^\s]+)#$1<$2>#gm;</code></p>
<p>This works great for these two... | [
{
"answer_id": 529710,
"author": "aib",
"author_id": 1088,
"author_profile": "https://Stackoverflow.com/users/1088",
"pm_score": 2,
"selected": false,
"text": "<p>You should really use two regexes; one to identify the \"commented-out\" lines and one to modify the http's in the regular li... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91385/"
] | I'm trying to write a regular expression that surrounds "http" URLs with angle brackets, except for lines beginning with two slashes. The best I've come up with is:
`s#^(?!//)(.*?)(<http://[>^\s]+)#$1<$2>#gm;`
This works great for these two:
---
Input: `<http://a.com>`
Output: `<<http://a.com>>`
---
Input: `//<h... | rewriting it a little...with my suggestions and using the whitespace modifier so it's actually readable. :)
```
s{
(?:^|\G) # start of the last match, so you never backtrack and don't capture.
(?!//) # a section without //
(.*?) # followed by anything
(
http:// # with http://
... |
529,697 | <p>how do I make a pointer to a multidimensional array, which have a unknown size? I've tried this:</p>
<p><code>int **triangles;</code></p>
<p><code>triangles = new int[numTriangles][3];</code></p>
<p>But i get this error:</p>
<p><code>cannot convert 'int (*)[3]' to 'int**' in assignment</code></p>
| [
{
"answer_id": 529715,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<pre><code>triangles = new int[numTriangles*3];\n</code></pre>\n\n<p>Then access it as:</p>\n\n<pre><code>triangles[numTriangle... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216175/"
] | how do I make a pointer to a multidimensional array, which have a unknown size? I've tried this:
`int **triangles;`
`triangles = new int[numTriangles][3];`
But i get this error:
`cannot convert 'int (*)[3]' to 'int**' in assignment` | ```
triangles = new int[numTriangles*3];
```
Then access it as:
```
triangles[numTriangles*triangleIndex+vertexIndex] = blah;
```
But this is tedious and error prone so I suggest using [boost.multi\_array](http://www.boost.org/doc/libs/1_38_0/libs/multi_array/doc/index.html) instead, or rolling your own (really si... |
529,706 | <p>When I attempt to use the iterator form of parsing for a Spirit grammar I get a argument passing conversion error from the iterator type to const char*. How do I fix this?</p>
<p>There are some restrictions. I'm using an iterator adapter on large inputs, so it is not feasible for me to convert to a C style string... | [
{
"answer_id": 529792,
"author": "Greg Rogers",
"author_id": 5963,
"author_profile": "https://Stackoverflow.com/users/5963",
"pm_score": 0,
"selected": false,
"text": "<p>Here is one way of getting the char *'s pointing at the same elements as the iterators:</p>\n\n<pre><code>&v.fron... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I attempt to use the iterator form of parsing for a Spirit grammar I get a argument passing conversion error from the iterator type to const char\*. How do I fix this?
There are some restrictions. I'm using an iterator adapter on large inputs, so it is not feasible for me to convert to a C style string.
Here is ... | Hard to tell from the code as posted, since it contains a few basic errors.
After correction of these, it compiles fine on my machine (with MSVC++7.1):
```
#include <boost/spirit/core.hpp>
#include <vector>
#include <string>
using namespace std;
using namespace boost::spirit;
struct ex : public grammar<ex> {
template ... |
529,711 | <p>Locally my application works fine using ajaxpro, but on the server I can't seem to figure out why it is not working.</p>
<p>using firebug I have the following erros:</p>
<p>GET prototype.ashx 404 not found
GET core.ashx 404 not found
GET ms.ashx 404 not found</p>
<p>Same code works locally, so it must be a IIS7 s... | [
{
"answer_id": 529767,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>Are you sure that you have the handlers registered properly in the web.config file?</p>\n\n<p>You should have someth... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Locally my application works fine using ajaxpro, but on the server I can't seem to figure out why it is not working.
using firebug I have the following erros:
GET prototype.ashx 404 not found
GET core.ashx 404 not found
GET ms.ashx 404 not found
Same code works locally, so it must be a IIS7 setting?
**edit, my web.... | For AjaxPro.dll to work in IIS7 you should set your application pool's PipelinMode to Classical instead of Integrated.
I have tried everywhere to find this but at the end this was what saved me. |
529,713 | <p>I have quite a lot of PHP view files, which I used to include in my controllers using simple include statements. They all use methods declared in a view class which they get like $view->method(); However I recently decided that it would be better if the including would also be done by this view class. This however c... | [
{
"answer_id": 529764,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 3,
"selected": true,
"text": "<p>You can't change include() scope, no, so your method is probably about as good as it gets in the situation you're describi... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35197/"
] | I have quite a lot of PHP view files, which I used to include in my controllers using simple include statements. They all use methods declared in a view class which they get like $view->method(); However I recently decided that it would be better if the including would also be done by this view class. This however chan... | You can't change include() scope, no, so your method is probably about as good as it gets in the situation you're describing. Though I'd skip the ugly PHP4-compat ampersand, myself. |
529,726 | <p>I have two tables tbl1 and tbl2, both with two columns, one for id and one for product. I want to extract the rows that are in both, i.e. rows where tbl1.id = tbl2.id and tbl1.product = tbl2.product and join the row from tbl1 and tbl2 into one row. </p>
<p>I imagine this goes something like this:</p>
<pre><code>SE... | [
{
"answer_id": 529738,
"author": "Lance Roberts",
"author_id": 13295,
"author_profile": "https://Stackoverflow.com/users/13295",
"pm_score": 0,
"selected": false,
"text": "<pre><code>SELECT \n tbl1.*, tbl2.*\nFROM tbl1, tbl2, tbl3\n WHERE\n tbl1.id = tbl2.id\n AND tbl1.product = ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have two tables tbl1 and tbl2, both with two columns, one for id and one for product. I want to extract the rows that are in both, i.e. rows where tbl1.id = tbl2.id and tbl1.product = tbl2.product and join the row from tbl1 and tbl2 into one row.
I imagine this goes something like this:
```
SELECT tbl1.\*, tbl2.\*... | ```
SELECT
t1.id,
t1.product,
t2.product
FROM
tbl1 t1
LEFT OUTER JOIN mapping_table map ON
map.id = tbl1.id
INNER JOIN tbl2 t2 ON
t2.id = t1.id AND
(t2.product = t1.product OR t2.product = map.tbl2_product)
```
You may need to tweak this based on whether or not you want rows to be c... |
529,782 | <p>I just ran across this error message while working in C#</p>
<blockquote>
<p>A property or indexer may not be passed as an out or ref parameter</p>
</blockquote>
<p>I known what caused this and did the quick solution of creating a local variable of the correct type, calling the function with it as the <code>out<... | [
{
"answer_id": 529802,
"author": "Brian Rasmussen",
"author_id": 38206,
"author_profile": "https://Stackoverflow.com/users/38206",
"pm_score": 3,
"selected": false,
"text": "<p>You can use fields with <code>ref</code>/<code>out</code>, but not properties. The reason is that properties ar... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | I just ran across this error message while working in C#
>
> A property or indexer may not be passed as an out or ref parameter
>
>
>
I known what caused this and did the quick solution of creating a local variable of the correct type, calling the function with it as the `out`/`ref` parameter and then assigning i... | Just for info, C# 4.0 *will* have something *like* this sugar, but only when calling interop methods - partly due to the sheer propensity of `ref` in this scenario. I haven't tested it much (in the CTP); we'll have to see how it pans out... |
529,785 | <pre><code>projectEuler3(600851475143);
var projectEuler3 = function (composite) {
var result = 2;
while(composite > 1)
{
if (composite % result)
{
result++
} else {
composite = composite / result;
console.log(result);
}
}
};
</code... | [
{
"answer_id": 529802,
"author": "Brian Rasmussen",
"author_id": 38206,
"author_profile": "https://Stackoverflow.com/users/38206",
"pm_score": 3,
"selected": false,
"text": "<p>You can use fields with <code>ref</code>/<code>out</code>, but not properties. The reason is that properties ar... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64275/"
] | ```
projectEuler3(600851475143);
var projectEuler3 = function (composite) {
var result = 2;
while(composite > 1)
{
if (composite % result)
{
result++
} else {
composite = composite / result;
console.log(result);
}
}
};
``` | Just for info, C# 4.0 *will* have something *like* this sugar, but only when calling interop methods - partly due to the sheer propensity of `ref` in this scenario. I haven't tested it much (in the CTP); we'll have to see how it pans out... |
529,822 | <p>I want to separate a specific set of stored procedures into a seperate database … sort of like a library. However, when I run these procs from another database, they appear to call objects from within the library database.</p>
<p>Here is some source code which demonstrates the problem</p>
<pre><code>use mylibdb
g... | [
{
"answer_id": 529889,
"author": "BC.",
"author_id": 54838,
"author_profile": "https://Stackoverflow.com/users/54838",
"pm_score": 1,
"selected": false,
"text": "<p>You could treat the library as code instead of database objects and create the procedures in the database schemas that use ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29043/"
] | I want to separate a specific set of stored procedures into a seperate database … sort of like a library. However, when I run these procs from another database, they appear to call objects from within the library database.
Here is some source code which demonstrates the problem
```
use mylibdb
go
create proc gettabl... | I've determined this cannot be done, so I saved the scripts as script files, rather than in procs.
So, my proc would be reduced to this anonymous block:
```
begin
declare @cnt int;
select @cnt=count(*)
from sysobjects
where xtype='U';
print 'Table count : ' + cast( @cnt as ... |
529,823 | <p>I am working on a little <a href="http://mirror.mit-ocw.sbu.ac.ir/OcwWeb/Electrical-Engineering-and-Computer-Science/6-170Fall-2005/Projects/index.htm" rel="nofollow noreferrer">pinball-game project</a> for a hobby and am looking for a pattern to encapsulate constant variables.</p>
<p>I have a model, within which t... | [
{
"answer_id": 529834,
"author": "alphadogg",
"author_id": 59494,
"author_profile": "https://Stackoverflow.com/users/59494",
"pm_score": 3,
"selected": true,
"text": "<p>Are you looking for the <a href=\"http://en.wikipedia.org/wiki/Singleton_pattern\" rel=\"nofollow noreferrer\">Singlet... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120/"
] | I am working on a little [pinball-game project](http://mirror.mit-ocw.sbu.ac.ir/OcwWeb/Electrical-Engineering-and-Computer-Science/6-170Fall-2005/Projects/index.htm) for a hobby and am looking for a pattern to encapsulate constant variables.
I have a model, within which there are values which will be constant over the... | Are you looking for the [Singleton](http://en.wikipedia.org/wiki/Singleton_pattern) or, a variant, the [Monostate](http://c2.com/cgi/wiki?MonostatePattern)? If not, how does that pattern fail your needs?
Of course, here's the mandatory disclaimer that [Anything Global Is Evil](http://c2.com/cgi/wiki?SingletonsAreEvil)... |
529,825 | <p>I'm currently beating my head against a wall trying to figure this out. But long story short, I'd like to convert a string between 2 UTF-8 '\u0002' to bold formating. This is for an IRC client that I'm working on so I've been running into these quite a bit. I've treid regex and found that matching on the rtf as ((\'... | [
{
"answer_id": 529925,
"author": "Daniel LeCheminant",
"author_id": 62055,
"author_profile": "https://Stackoverflow.com/users/62055",
"pm_score": 2,
"selected": true,
"text": "<p>You could use either</p>\n\n<pre><code>rtb.Rtf = Regex.Replace(rtb.Rtf, @\"\\\\'02\\s*(.*?)\\s*\\\\'02\", @\"... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45533/"
] | I'm currently beating my head against a wall trying to figure this out. But long story short, I'd like to convert a string between 2 UTF-8 '\u0002' to bold formating. This is for an IRC client that I'm working on so I've been running into these quite a bit. I've treid regex and found that matching on the rtf as ((\'02)... | You could use either
```
rtb.Rtf = Regex.Replace(rtb.Rtf, @"\\'02\s*(.*?)\s*\\'02", @"\b $1 \b0");
```
or
```
rtb.Rtf = Regex.Replace(rtb.Rtf, @"\\'02\s*(.*?)\s*\\'02", @"\'02 \b $1 \b0 \'02");
```
depending on whether you want to keep the \u0002s in there.
The \b and \b0 turn the bold on and off in RTF. |
529,830 | <p>I have a Perl regular expression (shown <a href="https://stackoverflow.com/questions/529657/how-do-i-write-a-regex-that-performs-multiple-substitutions-on-each-line-except/529735#529735">here</a>, though understanding the whole thing isn't hopefully necessary to answering this question) that contains the \G metachar... | [
{
"answer_id": 529846,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 2,
"selected": false,
"text": "<p>Try these:</p>\n\n<pre><code>import re\nre.sub()\nre.findall()\nre.finditer()\n</code></pre>\n\n<p>for example:</p>... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91385/"
] | I have a Perl regular expression (shown [here](https://stackoverflow.com/questions/529657/how-do-i-write-a-regex-that-performs-multiple-substitutions-on-each-line-except/529735#529735), though understanding the whole thing isn't hopefully necessary to answering this question) that contains the \G metacharacter. I'd lik... | Try these:
```
import re
re.sub()
re.findall()
re.finditer()
```
for example:
```
# Finds all words of length 3 or 4
s = "the quick brown fox jumped over the lazy dogs."
print re.findall(r'\b\w{3,4}\b', s)
# prints ['the','fox','over','the','lazy','dogs']
``` |
529,831 | <p>Is there a way the C++ STL Maps support this, since lower_bound and upper_bound on maps strictly return the value greater than the passed value.</p>
<p><a href="http://java.sun.com/javase/6/docs/api/java/util/NavigableMap.html#lowerKey(K)" rel="noreferrer">Lower key </a></p>
<p>Use case I have a map with times as ... | [
{
"answer_id": 529880,
"author": "KenE",
"author_id": 43783,
"author_profile": "https://Stackoverflow.com/users/43783",
"pm_score": 3,
"selected": false,
"text": "<p>If you don't care about the ordering, you can use map::upper_bound to get the element you want, but you need to define the... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43756/"
] | Is there a way the C++ STL Maps support this, since lower\_bound and upper\_bound on maps strictly return the value greater than the passed value.
[Lower key](http://java.sun.com/javase/6/docs/api/java/util/NavigableMap.html#lowerKey(K))
Use case I have a map with times as keys in a sorted manner so in a MAP
```
ti... | Yeah, lower\_bound can be used for that, i've seen it before and used it like that.
```
map_type::iterator it = map.lower_bound(2.3);
if(it != map.begin()) {
--it;
// it now points at the right element
}
```
Would actually return the greatest, yet smaller (if it != map.begin() was true) one. If it was at .b... |
529,836 | <p>I'm using the following pattern in C#:</p>
<pre><code>IList<foo> x = y.Select(a => new foo
{
b = Calc1(),
c = Calc2()
}).ToList();
foreach(foo f in x)
{
f.d = b / c;
}
</code></pre>
<p>What I would like to do though is:</p>
<pre><code>IList<foo> x = y.Select(a => new foo
{
b = C... | [
{
"answer_id": 529851,
"author": "Erik Forbes",
"author_id": 16942,
"author_profile": "https://Stackoverflow.com/users/16942",
"pm_score": 3,
"selected": false,
"text": "<p>If you expand this to use the full LINQ syntax:</p>\n\n<pre><code>IList<foo> x = (from a in y\n ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | I'm using the following pattern in C#:
```
IList<foo> x = y.Select(a => new foo
{
b = Calc1(),
c = Calc2()
}).ToList();
foreach(foo f in x)
{
f.d = b / c;
}
```
What I would like to do though is:
```
IList<foo> x = y.Select(a => new foo
{
b = Calc1(),
c = Calc2()
d = b / c;
}).ToList();
``... | You can't re-use initialized properties in an initializer.
I like Erik's technique. If the query expression syntax is a bother, you can use a full-on anonymous method.
```
List<int> y = new List<int>() { 1, 2, 3, 4 };
var x = y.Select(a =>
{
int b = a + 1;
i... |
529,850 | <p>I have a Cube which draws its data from 4 fact/dim tables. </p>
<ol>
<li><code>FactCaseEvents (EventID,CaseID,TimeID)</code> </li>
<li><code>DimEvents (EventID, EventName)</code> </li>
<li><code>DimCases (CaseID,StateID,ClientID)</code> </li>
<li><code>DimTime (TimeID,FullDate)</code></li>
</ol>
<p>Events would... | [
{
"answer_id": 529851,
"author": "Erik Forbes",
"author_id": 16942,
"author_profile": "https://Stackoverflow.com/users/16942",
"pm_score": 3,
"selected": false,
"text": "<p>If you expand this to use the full LINQ syntax:</p>\n\n<pre><code>IList<foo> x = (from a in y\n ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13954/"
] | I have a Cube which draws its data from 4 fact/dim tables.
1. `FactCaseEvents (EventID,CaseID,TimeID)`
2. `DimEvents (EventID, EventName)`
3. `DimCases (CaseID,StateID,ClientID)`
4. `DimTime (TimeID,FullDate)`
Events would be: `CaseReceived,CaseOpened,CaseClientContacted,CaseClosed`
DimTime holds an entry for every... | You can't re-use initialized properties in an initializer.
I like Erik's technique. If the query expression syntax is a bother, you can use a full-on anonymous method.
```
List<int> y = new List<int>() { 1, 2, 3, 4 };
var x = y.Select(a =>
{
int b = a + 1;
i... |
529,857 | <p>I have a query string parameter value that contains an ampersand. For example, a valid value for the parameter may be:</p>
<pre><code>a & b
</code></pre>
<p>When I generate the URL that contains the parameter, I'm using System.Web.HTTPUtility.UrlEncode() to make each element URL-friendly. It's (correctly) givi... | [
{
"answer_id": 530443,
"author": "Craig Walker",
"author_id": 3488,
"author_profile": "https://Stackoverflow.com/users/3488",
"pm_score": 1,
"selected": true,
"text": "<p>Switching to <a href=\"http://www.urlrewriting.net/149/en/home.html\" rel=\"nofollow noreferrer\">UrlRewritingNet.Url... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3488/"
] | I have a query string parameter value that contains an ampersand. For example, a valid value for the parameter may be:
```
a & b
```
When I generate the URL that contains the parameter, I'm using System.Web.HTTPUtility.UrlEncode() to make each element URL-friendly. It's (correctly) giving me a URL like:
<http://exa... | Switching to [UrlRewritingNet.UrlRewrite](http://www.urlrewriting.net/149/en/home.html) did **not** help, as it apparently has the same bug. I'm thinking it might have something to do with ASP.NET after all. |
529,863 | <p>Which is your preference?</p>
<p>Let's say we have a generic Product table that has an ID, a name, and a foreign key reference to a category. Would you prefer to name your table like:</p>
<pre><code>CREATE TABLE Products
(
ProductID int NOT NULL IDENTITY(1,1) PRIMARY KEY,
CategoryID int NOT NULL FOREIGN K... | [
{
"answer_id": 529909,
"author": "thinkbeforecoding",
"author_id": 47001,
"author_profile": "https://Stackoverflow.com/users/47001",
"pm_score": 6,
"selected": true,
"text": "<p>The table name already gives the context.\nNo need to prefix columns name with it.\nWhen joining tables use ta... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40667/"
] | Which is your preference?
Let's say we have a generic Product table that has an ID, a name, and a foreign key reference to a category. Would you prefer to name your table like:
```
CREATE TABLE Products
(
ProductID int NOT NULL IDENTITY(1,1) PRIMARY KEY,
CategoryID int NOT NULL FOREIGN KEY REFERENCES Categori... | The table name already gives the context.
No need to prefix columns name with it.
When joining tables use table.column syntax. |
529,866 | <p>I am looking into using only a ddl to run my query, not a ddl and a Button_Click function. I am yet to find what to do. How do I do this?</p>
| [
{
"answer_id": 529878,
"author": "Bob",
"author_id": 45,
"author_profile": "https://Stackoverflow.com/users/45",
"pm_score": 2,
"selected": false,
"text": "<p>Set the AutoPostBack property to true, then hook into the OnSelectedIndexChanged event</p>\n\n<pre><code><asp:DropDownList \n ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54197/"
] | I am looking into using only a ddl to run my query, not a ddl and a Button\_Click function. I am yet to find what to do. How do I do this? | In your as(p/c)x:
```
<asp:DropDownList runat="server"
id="ddl"
OnSelectedIndexChanged="SelectionChanged"
AutoPostBack="true">
<asp:ListItem Text="Page 1" Value="/page1.aspx" />
<asp:ListItem Text="Page 2" Value="/page2.aspx" />
</asp:DropDownList>
```
T... |
529,868 | <p>I know how to use Perl's Getopt::Long, but I'm not sure how I can configure it to accept <em>any</em> "--key=value" pair that hasn't been explicitly defined and stick it in a hash. In other words, I don't know ahead of time what options the user may want, so there's no way for me to define all of them, yet I want to... | [
{
"answer_id": 529914,
"author": "runrig",
"author_id": 10415,
"author_profile": "https://Stackoverflow.com/users/10415",
"pm_score": 3,
"selected": false,
"text": "<p>Getopt::Long doesn't do that. You can parse the options yourself...e.g.</p>\n\n<pre><code>my %opt;\nmy @OPTS = @ARGV;\nf... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64319/"
] | I know how to use Perl's Getopt::Long, but I'm not sure how I can configure it to accept *any* "--key=value" pair that hasn't been explicitly defined and stick it in a hash. In other words, I don't know ahead of time what options the user may want, so there's no way for me to define all of them, yet I want to be able t... | The [`Getopt::Long`](http://search.cpan.org/perldoc?Getopt::Long) documentation suggests a configuration option that might help:
```
pass_through (default: disabled)
Options that are unknown, ambiguous or supplied
with an invalid option value are passed through
in @ARGV instead o... |
529,869 | <p>I have the following Rails link generating code</p>
<p>(I have removed potentially 'industry secret' stuff, sorry for the odd names, but the length of variable names and values match)</p>
<pre><code><%= link_to_remote "FOUR", :method => "get", :url => {:action => "testing01_four_log_info", :fourth_name... | [
{
"answer_id": 531132,
"author": "jdl",
"author_id": 9465,
"author_profile": "https://Stackoverflow.com/users/9465",
"pm_score": 3,
"selected": true,
"text": "<p>When really weird things like this happen, it's time to double-check the obvious.</p>\n\n<ul>\n<li>Do you have JavaScript enab... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757/"
] | I have the following Rails link generating code
(I have removed potentially 'industry secret' stuff, sorry for the odd names, but the length of variable names and values match)
```
<%= link_to_remote "FOUR", :method => "get", :url => {:action => "testing01_four_log_info", :fourth_name => "LA1", :testing01_num => "123... | When really weird things like this happen, it's time to double-check the obvious.
* Do you have JavaScript enabled in
Firefox?
* Do you have NoScript, or
anything like it, installed? |
529,874 | <p>I need to change what rows are grabbed from the database based upon a few flags. How can I do this? My current code is like this:</p>
<pre><code>this.tblTenantTableAdapter.Fill(this.rentalEaseDataSet.tblTenant);
</code></pre>
<p>Say if I wanted only rows that the id was greater than 50, how would I do that?</p>
<... | [
{
"answer_id": 529895,
"author": "GEOCHET",
"author_id": 5640,
"author_profile": "https://Stackoverflow.com/users/5640",
"pm_score": 3,
"selected": true,
"text": "<p>Why wouldn't you use a <code>WHERE</code> clause in your SQL query?</p>\n\n<p>Also, I would hope you don't use your <code>... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | I need to change what rows are grabbed from the database based upon a few flags. How can I do this? My current code is like this:
```
this.tblTenantTableAdapter.Fill(this.rentalEaseDataSet.tblTenant);
```
Say if I wanted only rows that the id was greater than 50, how would I do that?
**Edit:**
The code to access t... | Why wouldn't you use a `WHERE` clause in your SQL query?
Also, I would hope you don't use your `ID` field for anything like this. If you just want the first 50 selections, you may want to use a `TOP 50` clause or something similar.
For some info on how to do this with your TableAdapter: <http://www.shiningstar.net/AS... |
529,875 | <p>This question builds off of a previously asked question:
<a href="https://stackoverflow.com/questions/529109/c-pass-by-reference-multidimensional-array-with-known-size">Pass by reference multidimensional array with known size</a></p>
<p>I have been trying to figure out how to get my functions to play nicely with 2d... | [
{
"answer_id": 529943,
"author": "BigSandwich",
"author_id": 26983,
"author_profile": "https://Stackoverflow.com/users/26983",
"pm_score": 2,
"selected": false,
"text": "<pre><code>typedef array_type unsigned int **;\ninitialize_BMP_array(array_type& bmparray, int height, int width)\... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62305/"
] | This question builds off of a previously asked question:
[Pass by reference multidimensional array with known size](https://stackoverflow.com/questions/529109/c-pass-by-reference-multidimensional-array-with-known-size)
I have been trying to figure out how to get my functions to play nicely with 2d array references. A ... | Use a class to wrap it, then pass objects by reference
```
class BMP_array
{
public:
BMP_array(int height, int width)
: buffer(NULL)
{
buffer = (unsigned int **)malloc(height * sizeof(unsigned int *));
for (int i = 0; i < height; i++)
{
buffer[i] = (unsigned int *)malloc(width ... |
529,890 | <p>I know that you can prepopulate admin form fields based on other fields. For example, I have a slug field that is automatically populated based on the title field.</p>
<p>However, I would also like to make other automatic prepopulations based on the date. For example, I have an URL field, and I want it to automatic... | [
{
"answer_id": 530165,
"author": "Mr Shark",
"author_id": 6093,
"author_profile": "https://Stackoverflow.com/users/6093",
"pm_score": 2,
"selected": false,
"text": "<p>The slug handling is done with javascript.</p>\n\n<p>So you have to <a href=\"http://docs.djangoproject.com/en/dev/ref/c... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I know that you can prepopulate admin form fields based on other fields. For example, I have a slug field that is automatically populated based on the title field.
However, I would also like to make other automatic prepopulations based on the date. For example, I have an URL field, and I want it to automatically be se... | I know that you can prepopulate some values via GET, it will be something like this
```
http://localhost:8000/admin/app/model/add/?model_field=hello
```
I got some problems with date fields but, maybe this could help you. |
529,929 | <p>In C#, is it possible to decorate an Enum type with an attribute or do something else to specify what the default value should be, without having the change the values? The numbers required might be set in stone for whatever reason, and it'd be handy to still have control over the default.</p>
<pre><code>enum Orien... | [
{
"answer_id": 529937,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 10,
"selected": true,
"text": "<p>The default for an <code>enum</code> (in fact, any value type) is 0 -- even if that is not a valid value for that ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82/"
] | In C#, is it possible to decorate an Enum type with an attribute or do something else to specify what the default value should be, without having the change the values? The numbers required might be set in stone for whatever reason, and it'd be handy to still have control over the default.
```
enum Orientation
{
N... | The default for an `enum` (in fact, any value type) is 0 -- even if that is not a valid value for that `enum`. It cannot be changed. |
529,941 | <p>I'm looking at the AdventureWorks sample database for SQL Server 2008, and I see in their creation scripts that they tend to use the following:</p>
<pre><code>ALTER TABLE [Production].[ProductCostHistory] WITH CHECK ADD
CONSTRAINT [FK_ProductCostHistory_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Pro... | [
{
"answer_id": 530303,
"author": "Chris Hynes",
"author_id": 8037,
"author_profile": "https://Stackoverflow.com/users/8037",
"pm_score": 8,
"selected": true,
"text": "<p>The first syntax is redundant - the <code>WITH CHECK</code> is default for new constraints, and the constraint is turn... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40667/"
] | I'm looking at the AdventureWorks sample database for SQL Server 2008, and I see in their creation scripts that they tend to use the following:
```
ALTER TABLE [Production].[ProductCostHistory] WITH CHECK ADD
CONSTRAINT [FK_ProductCostHistory_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Production].[Prod... | The first syntax is redundant - the `WITH CHECK` is default for new constraints, and the constraint is turned on by default as well.
This syntax is generated by the SQL management studio when generating sql scripts -- I'm assuming it's some sort of extra redundancy, possibly to ensure the constraint is enabled even if... |
529,944 | <p>This works just fine:</p>
<pre><code> protected void txtTest_Load(object sender, EventArgs e)
{
if (sender is TextBox) {...}
}
</code></pre>
<p>Is there a way to check if sender is NOT a TextBox, some kind of an equivalent of != for "is"?</p>
<p>Please, don't suggest moving the logic to ELSE{}... | [
{
"answer_id": 529959,
"author": "Jon Tackabury",
"author_id": 343,
"author_profile": "https://Stackoverflow.com/users/343",
"pm_score": 9,
"selected": true,
"text": "<p>This is one way:</p>\n\n<pre><code>if (!(sender is TextBox)) {...}\n</code></pre>\n"
},
{
"answer_id": 529976,... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3661/"
] | This works just fine:
```
protected void txtTest_Load(object sender, EventArgs e)
{
if (sender is TextBox) {...}
}
```
Is there a way to check if sender is NOT a TextBox, some kind of an equivalent of != for "is"?
Please, don't suggest moving the logic to ELSE{} :) | This is one way:
```
if (!(sender is TextBox)) {...}
``` |
529,946 | <p>CreateFile allocates 2(!!) handles and CloseHandle closes only one handle when trying to get the low-level access to cd-rom device. OS Windows XP SP3, 5 of 7 tested computers works the same.</p>
<p>When trying to access hdd drive letter CreateFiles works OK and allocate only one handle.</p>
<p>Here is the sample c... | [
{
"answer_id": 530743,
"author": "lsalamon",
"author_id": 47733,
"author_profile": "https://Stackoverflow.com/users/47733",
"pm_score": 0,
"selected": false,
"text": "<p>Suggestion:<br>\nPut log begin at call CreateFileW, this confirm how many times it is executed;<br></p>\n"
},
{
... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2279145/"
] | CreateFile allocates 2(!!) handles and CloseHandle closes only one handle when trying to get the low-level access to cd-rom device. OS Windows XP SP3, 5 of 7 tested computers works the same.
When trying to access hdd drive letter CreateFiles works OK and allocate only one handle.
Here is the sample code:
HANDLE m\_d... | There seem to be a few bugs in your sample code. If it was in fact copy & pasted from your program, then there would have to be something else going on.
First, you're calling a Unicode function with a MBCS string: the first argument should either be prepended with `L` or surrounded with `_T()`.
Second, and perhaps mo... |
529,949 | <p>I have a personal website with a MediaWiki installation on a shared host. The Apache configuration treats all .php request with PHP 4, and all .php5 requests with PHP5.</p>
<p>For compatibility reasons I need to be able to use the .php extension, but MediaWiki is only available on PHP5. I tried to use the mod_rewri... | [
{
"answer_id": 529967,
"author": "Ólafur Waage",
"author_id": 22459,
"author_profile": "https://Stackoverflow.com/users/22459",
"pm_score": 0,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code>AddType x-mapp-php .php5\n</code></pre>\n\n<p>It might be the other way around, try it ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5789/"
] | I have a personal website with a MediaWiki installation on a shared host. The Apache configuration treats all .php request with PHP 4, and all .php5 requests with PHP5.
For compatibility reasons I need to be able to use the .php extension, but MediaWiki is only available on PHP5. I tried to use the mod\_rewrite engine... | ```
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.php $1.php5 [R=301,L]
RewriteRule ^(.*)\.php $1.php5 [L]
```
I found this on the following [web site](http://www.webforgers.net/mod-rewrite/basic-tutorials-lesson-3.php) which may be useful, you could make it more specific and remove the catchall to change only a ... |
529,951 | <p>I am working on machine with XP Dutch version installed on it. Visual studio 2005 is installed in English. I'm having the annoying problem while debugging that all .NET Framework exception message appear in Dutch, which make them really worthless. I tried to change this to English by setting the regional settings in... | [
{
"answer_id": 529981,
"author": "Darin Dimitrov",
"author_id": 29407,
"author_profile": "https://Stackoverflow.com/users/29407",
"pm_score": 3,
"selected": false,
"text": "<p>This issue has been discussed <a href=\"https://stackoverflow.com/questions/209133/c-exception-messages-in-engli... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59503/"
] | I am working on machine with XP Dutch version installed on it. Visual studio 2005 is installed in English. I'm having the annoying problem while debugging that all .NET Framework exception message appear in Dutch, which make them really worthless. I tried to change this to English by setting the regional settings in th... | I did some more research and apparently it is not possible to change the CurrentUICulture by default to a different language then the native language of the installed OS. It can only be changed when doing something like this in the code itself:
```
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
``` |
529,965 | <p>I'm detecting @replies in a Twitter stream with the following PHP code using regexes.</p>
<pre><code>$text = preg_replace('!^@([A-Za-z0-9_]+)!', '<a href="http://twitter.com/$1" target="_blank">@$1</a>', $text);
$text = preg_replace('! @([A-Za-z0-9_]+)!', ' <a href="http://twitter.com/$1" target="_bl... | [
{
"answer_id": 530010,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 0,
"selected": false,
"text": "<p>Here's how I'd do the combination</p>\n\n<pre><code>$text = preg_replace('!(^| )@([A-Za-z0-9_]+)!', '$1<a href=\"... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1902010/"
] | I'm detecting @replies in a Twitter stream with the following PHP code using regexes.
```
$text = preg_replace('!^@([A-Za-z0-9_]+)!', '<a href="http://twitter.com/$1" target="_blank">@$1</a>', $text);
$text = preg_replace('! @([A-Za-z0-9_]+)!', ' <a href="http://twitter.com/$1" target="_blank">@$1</a>', $text);
```
... | OK, on a second thought, not flagging whatever@email means that the previous element has to be a "non-word" item, because any other element that could be contained in a word could be signaled as an email, so it would lead:
```
!(^|\W)@([A-Za-z0-9_]+)!
```
but then you have to use $2 instead of $1. |
529,969 | <p>I am using VS 2008 and trying to create a dataset for ms sql reporting services. I have two tables that I want to relate. One has a column with type of int, the other shortint. VS give me an error of</p>
<blockquote>
<p>Parent and Child columns don't have type-matching columns.</p>
</blockquote>
<p>Is there a... | [
{
"answer_id": 530010,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 0,
"selected": false,
"text": "<p>Here's how I'd do the combination</p>\n\n<pre><code>$text = preg_replace('!(^| )@([A-Za-z0-9_]+)!', '$1<a href=\"... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20692/"
] | I am using VS 2008 and trying to create a dataset for ms sql reporting services. I have two tables that I want to relate. One has a column with type of int, the other shortint. VS give me an error of
>
> Parent and Child columns don't have type-matching columns.
>
>
>
Is there any way to over ride this? In old sq... | OK, on a second thought, not flagging whatever@email means that the previous element has to be a "non-word" item, because any other element that could be contained in a word could be signaled as an email, so it would lead:
```
!(^|\W)@([A-Za-z0-9_]+)!
```
but then you have to use $2 instead of $1. |
530,012 | <p>I am trying to use a <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Date.html" rel="noreferrer"><code>java.util.Date</code></a> as input and then creating a query with it - so I need a <a href="http://docs.oracle.com/javase/8/docs/api/java/sql/Date.html" rel="noreferrer"><code>java.sql.Date</code></a>. ... | [
{
"answer_id": 530022,
"author": "David Ackerman",
"author_id": 2504,
"author_profile": "https://Stackoverflow.com/users/2504",
"pm_score": 9,
"selected": false,
"text": "<p>Nevermind....</p>\n\n<pre><code>public class MainClass {\n\n public static void main(String[] args) {\n java.u... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2504/"
] | I am trying to use a [`java.util.Date`](http://docs.oracle.com/javase/8/docs/api/java/util/Date.html) as input and then creating a query with it - so I need a [`java.sql.Date`](http://docs.oracle.com/javase/8/docs/api/java/sql/Date.html).
I was surprised to find that it couldn't do the conversion implicitly or explic... | tl;dr
=====
>
> How to convert java.util.Date to java.sql.Date?
>
>
>
**Don’t.**
Both `Date` classes are outmoded. [Sun](https://en.wikipedia.org/wiki/Sun_Microsystems), [Oracle](https://en.wikipedia.org/wiki/Oracle), and the [JCP](https://en.wikipedia.org/wiki/Java_Community_Process) community gave up on those ... |
530,043 | <p>I have a database with event information, including date (in MMDDYYYY format). is it possible to write an SQL Server statement to only get rows that fall within a certain time frame?</p>
<p>something like this pseudo-statement:</p>
<pre><code>SELECT * FROM events WHERE [current_date minus date <= 31] ORDER BY d... | [
{
"answer_id": 530051,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/aa258269(SQL.80).aspx\" rel=\"nofollow noreferrer\">DateDiff</... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I have a database with event information, including date (in MMDDYYYY format). is it possible to write an SQL Server statement to only get rows that fall within a certain time frame?
something like this pseudo-statement:
```
SELECT * FROM events WHERE [current_date minus date <= 31] ORDER BY date ASC
```
where `dat... | SELECT \* FROM events WHERE date > getdate() - 31 ORDER BY date ASC |
530,045 | <p>I have a view with the task to show a bunch of images (similar to the photos app).</p>
<p>In the top area is the full-size image and in the bottom a list of images.</p>
<p>Let's say exist 100 images. Now the user is on the 15-20 image section and is on the image 16.</p>
<p>Now, my problem is how aproach this. I w... | [
{
"answer_id": 530049,
"author": "Genericrich",
"author_id": 39932,
"author_profile": "https://Stackoverflow.com/users/39932",
"pm_score": -1,
"selected": false,
"text": "<p>In landscape mode you are on your own.</p>\n\n<p>Wouldn't really be that hard to do using a grid of UIImageViews.<... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | I have a view with the task to show a bunch of images (similar to the photos app).
In the top area is the full-size image and in the bottom a list of images.
Let's say exist 100 images. Now the user is on the 15-20 image section and is on the image 16.
Now, my problem is how aproach this. I wanna something that work... | Actually, you should still be able to use a UITableView for your scrolling list of images, if I understand your needs properly. You want to have a scrolling list of single images along the bottom of the screen, like you see in something like Aperture.
To do this, create a UITableView and rotate it 90 degrees using a C... |
530,077 | <p>I have four flags </p>
<pre><code>Current = 0x1
Past = 0x2
Future = 0x4
All = 0x7
</code></pre>
<p>Say I receive the two flags Past and Future (<code>setFlags(PAST | FUTURE)</code>). How can I tell if <code>Past</code> is in it? Likewise how can I tell that <code>Current</code> is not in it? That way I don'... | [
{
"answer_id": 530099,
"author": "Misko",
"author_id": 61523,
"author_profile": "https://Stackoverflow.com/users/61523",
"pm_score": 2,
"selected": false,
"text": "<pre><code>if ((flags & PAST) == PAST)\n{\n // PAST is there\n}\n\nif ((flags & CURRENT) != CURRENT)\n{\n // CURRE... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | I have four flags
```
Current = 0x1
Past = 0x2
Future = 0x4
All = 0x7
```
Say I receive the two flags Past and Future (`setFlags(PAST | FUTURE)`). How can I tell if `Past` is in it? Likewise how can I tell that `Current` is not in it? That way I don't have to test for every possible combination. | If you want all bits in the test mask to match:
```
if((value & mask) == mask) {...}
```
If you want any single bit in the test mask to match:
```
if((value & mask) != 0) {...}
```
The difference is most apparent when you are testing a value for multiple things.
To test for exclusion:
```
if ((value & mask) == ... |
530,114 | <p>In python, what does the 2nd % signifies?</p>
<pre><code>print "%s" % ( i )
</code></pre>
| [
{
"answer_id": 530123,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 0,
"selected": false,
"text": "<p>It's a <a href=\"http://docs.python.org/library/stdtypes.html#string-formatting\" rel=\"nofollow noreferrer\">forma... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51816/"
] | In python, what does the 2nd % signifies?
```
print "%s" % ( i )
``` | As others have said, this is the Python string formatting/interpolation operator. It's basically the equivalent of sprintf in C, for example:
`a = "%d bottles of %s on the wall" % (10, "beer")`
is equivalent to something like
`a = sprintf("%d bottles of %s on the wall", 10, "beer");`
in C. Each of these has the res... |
530,116 | <p>As the title says, I need to write a small program to read data from standard input, sort it, and send it to standard output. The program should take 1 argument that tells it how long is one record (in bytes). Here's how I test it:</p>
<pre><code>printf 'D\x00C\x00\x00B\x00A' | ./binsort 2 | od -c
</code></pre>
<p... | [
{
"answer_id": 530155,
"author": "jakber",
"author_id": 29812,
"author_profile": "https://Stackoverflow.com/users/29812",
"pm_score": 2,
"selected": false,
"text": "<p>fgets and fprintf deal with strings (which in C are char-arrays ending with the special character \\0).</p>\n\n<p>Use fr... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18406/"
] | As the title says, I need to write a small program to read data from standard input, sort it, and send it to standard output. The program should take 1 argument that tells it how long is one record (in bytes). Here's how I test it:
```
printf 'D\x00C\x00\x00B\x00A' | ./binsort 2 | od -c
```
The above should output s... | Don't use `scanf()` and `printf()`. Those are supposed to be used with text data. Since you're dealing with binary data, you instead want to use the lower-level `fread()` and `fwrite()` functions. Since you don't know how much total data there is, you'll have to use a dynamic data structure (such as a resizeable array)... |
530,119 | <p>I'm having some performance issues in a rails project (running on rails 2.0.5), for example in my user administration pages.</p>
<p>my user model has many relations (details, addresses, roles...) who get loaded with eager loading. That creates really huge SQL queries, for some cases, it takes almost a minute to loa... | [
{
"answer_id": 530235,
"author": "Milan Novota",
"author_id": 26123,
"author_profile": "https://Stackoverflow.com/users/26123",
"pm_score": 2,
"selected": false,
"text": "<p>I use table views in Rails on a regular basis and I'm pretty happy about it. Rails treat them as normal tables as ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094972/"
] | I'm having some performance issues in a rails project (running on rails 2.0.5), for example in my user administration pages.
my user model has many relations (details, addresses, roles...) who get loaded with eager loading. That creates really huge SQL queries, for some cases, it takes almost a minute to load 30 users... | The "problem" with views (and in this case you'd probably want a materialized view, assuming the data on which the complex query is based doesn't change often) is that you violate Rails' DRY'ness, to some extent (the addition of the UserV model for the view, which the purists will argue is a duplication of the User mod... |
530,130 | <p>I have a datagrid which is populated with CSV data when the user drag/drops a file onto it. Is it possible to display a message in the blank grid for example "Please drag a file here" or "This grid is currently empty". The grid currently displays as a dark grey box as I wait until the file is dragged to setup the co... | [
{
"answer_id": 530139,
"author": "Brandon",
"author_id": 63775,
"author_profile": "https://Stackoverflow.com/users/63775",
"pm_score": 1,
"selected": false,
"text": "<p>I think the easiest thing to do here is to make a giant label control to do the \"Drag Here\" and handle the label's dr... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60763/"
] | I have a datagrid which is populated with CSV data when the user drag/drops a file onto it. Is it possible to display a message in the blank grid for example "Please drag a file here" or "This grid is currently empty". The grid currently displays as a dark grey box as I wait until the file is dragged to setup the colum... | We subclassed the DataGridView control and added this. We didnt need the drag/drop functionality - we just needed to tell the user when there was no data returned from their query.
We have an emptyText property declared like this:
```
private string cvstrEmptyText = "";
[Category("Custom")]
[Description("... |
530,143 | <p>I have a .NET application and need to load a native library whose location is specified by the user. PInvoke looks like it'll only load from the global search paths (or a path specified at compile time?). Would the best method be to create a C++/CLI assembly which calls LoadLibrary at runtime?</p>
<p>Would C++/CL... | [
{
"answer_id": 530169,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 3,
"selected": false,
"text": "<p>If you already have a C#/VB.Net project it would be much simpler to just PInvoke LoadLibrary in order to get a DLL to ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a .NET application and need to load a native library whose location is specified by the user. PInvoke looks like it'll only load from the global search paths (or a path specified at compile time?). Would the best method be to create a C++/CLI assembly which calls LoadLibrary at runtime?
Would C++/CLI be simpler... | If you already have a C#/VB.Net project it would be much simpler to just PInvoke LoadLibrary in order to get a DLL to load. It takes one quick PInvoke call from the existing dll
```
public partial class NativeMethods {
/// Return Type: HMODULE->HINSTANCE->HINSTANCE__*
///lpLibFileName: LPCWSTR->WCHAR*
[Sy... |
530,179 | <p>If I am using a tree structure of nodes similar to the code below, do I have to worry about the circular reference?<br>
I have read that PHP uses a memory allocation mechanism which can make life very hard for the garbage collector when there are circular references involved. </p>
<p>What I want to know is: </p>
... | [
{
"answer_id": 530200,
"author": "Allain Lalonde",
"author_id": 2443,
"author_profile": "https://Stackoverflow.com/users/2443",
"pm_score": 2,
"selected": false,
"text": "<p>Maybe so, but since it throws out all objects at the end of every request (unless you're caching), I don't think m... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12161/"
] | If I am using a tree structure of nodes similar to the code below, do I have to worry about the circular reference?
I have read that PHP uses a memory allocation mechanism which can make life very hard for the garbage collector when there are circular references involved.
What I want to know is:
* If my tree con... | Point by point:
>
> * If my tree consists of only a few nodes, say 25, is this a problem?
>
>
>
Not unless your nodes are real monsters.
>
> * Will the memory be freed at the end of the script or am I slowly creating a problem for the server?
>
>
>
When the interpreter shuts down all the memory is released... |
530,183 | <p>Is there a way to pass a start time via URL when opening a video online?
For example:</p>
<pre><code>http://www.example.com/newvideo.wmv?starttime=00:33:34.0
</code></pre>
<p>I've seen different methods for using Javascript or making ASX files in order to give some control over it but I just need to jump to a cert... | [
{
"answer_id": 530494,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 7,
"selected": true,
"text": "<p>Here's <a href=\"https://web.archive.org/web/20060107061334/http://www1.cs.columbia.edu/async/misc/technologyreview_oc... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43333/"
] | Is there a way to pass a start time via URL when opening a video online?
For example:
```
http://www.example.com/newvideo.wmv?starttime=00:33:34.0
```
I've seen different methods for using Javascript or making ASX files in order to give some control over it but I just need to jump to a certain time in the file when ... | Here's [an article from a few years ago](https://web.archive.org/web/20060107061334/http://www1.cs.columbia.edu/async/misc/technologyreview_oct_01_2001.html) that's gung-ho on the technology, but I think the answer can be found in this quote:
>
> Why, for example, did Intel scrap its asynchronous chip? The answer is ... |
530,192 | <p>I need to port the <a href="http://en.wikipedia.org/wiki/Internal_rate_of_return" rel="noreferrer">IRR</a> function found in Excel and VB to ActionScript.</p>
<ul>
<li><a href="http://www.techonthenet.com/excel/formulas/irr.php" rel="noreferrer">Excel IRR formula</a></li>
</ul>
<p>Any idea how to find the "source"... | [
{
"answer_id": 530271,
"author": "jason",
"author_id": 45914,
"author_profile": "https://Stackoverflow.com/users/45914",
"pm_score": 2,
"selected": false,
"text": "<p>This is fairly easy to code using an iterative solver such as the bisection method or Newton's method. If your cash flows... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] | I need to port the [IRR](http://en.wikipedia.org/wiki/Internal_rate_of_return) function found in Excel and VB to ActionScript.
* [Excel IRR formula](http://www.techonthenet.com/excel/formulas/irr.php)
Any idea how to find the "source" to such functions? does anyone have this implemented in some other c-like language? | This is fairly easy to code using an iterative solver such as the bisection method or Newton's method. If your cash flows `C_t_j` occur at times `t_j` then the internal rate of return `r` satisfies sum `j = 1` to `n` of
```
C_t_j / (1 + r)^t_j
```
equals zero. Call this `f(r)`. Then `f'(r)` is sum `j = 1` to `n` of... |
530,198 | <p>Our company does a lot of flash work and occasionally offline / kiosk applications. I'd like to recommend a touchscreen to our client but don't know enough about the market. </p>
<p>Anyone have any good experiences with any particular model of touchscreen? Thanks!</p>
| [
{
"answer_id": 530271,
"author": "jason",
"author_id": 45914,
"author_profile": "https://Stackoverflow.com/users/45914",
"pm_score": 2,
"selected": false,
"text": "<p>This is fairly easy to code using an iterative solver such as the bisection method or Newton's method. If your cash flows... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59160/"
] | Our company does a lot of flash work and occasionally offline / kiosk applications. I'd like to recommend a touchscreen to our client but don't know enough about the market.
Anyone have any good experiences with any particular model of touchscreen? Thanks! | This is fairly easy to code using an iterative solver such as the bisection method or Newton's method. If your cash flows `C_t_j` occur at times `t_j` then the internal rate of return `r` satisfies sum `j = 1` to `n` of
```
C_t_j / (1 + r)^t_j
```
equals zero. Call this `f(r)`. Then `f'(r)` is sum `j = 1` to `n` of... |
530,201 | <p>I've created a button control template where I want to change the glow color of the button on the xaml level. Here is what I mean.</p>
<pre><code><Button x:Name="btnClose" Template="{DynamicResource GlassButton}" Width="32" Height="32" GlowStartColor="Red" GlowEndColor="DarkRed">Button1</Button>
</code... | [
{
"answer_id": 531540,
"author": "Alan Mendelevich",
"author_id": 19546,
"author_profile": "https://Stackoverflow.com/users/19546",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I understand the question you want to bind glow colors in your template to glow properties on your c... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15969/"
] | I've created a button control template where I want to change the glow color of the button on the xaml level. Here is what I mean.
```
<Button x:Name="btnClose" Template="{DynamicResource GlassButton}" Width="32" Height="32" GlowStartColor="Red" GlowEndColor="DarkRed">Button1</Button>
```
The GlowStartColor and Glow... | You need to either subclass Button and add those two properties or add those two properties as attached properties (by creating a new class with two attached dependency properties). |
530,204 | <p>The documentation provides a succinct example, and one that looks like it's missing a hop/pair anyway. When I set up a script to access a remote server and pattern my NTLM communication similarly, I get the following output:<br>
...<br>
All clients connected, Test beginning.<br>
Invalid code received.<br... | [
{
"answer_id": 562396,
"author": "codepoke",
"author_id": 14127,
"author_profile": "https://Stackoverflow.com/users/14127",
"pm_score": 4,
"selected": true,
"text": "<p>The error is in the documentation:</p>\n\n<pre><code>authentication = \"ntlm\";\n</code></pre>\n\n<p>Should be: </p>\n... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14127/"
] | The documentation provides a succinct example, and one that looks like it's missing a hop/pair anyway. When I set up a script to access a remote server and pattern my NTLM communication similarly, I get the following output:
...
All clients connected, Test beginning.
Invalid code received.
Error accepti... | The error is in the documentation:
```
authentication = "ntlm";
```
Should be:
```
authentication = NTLM;
```
The parameter is not a dynstring, but a KEYWORD. The quotes throw the parser off the scent.
I'll mark this as answer, since it is, but I still have an issue. At present I cannot find the exactly correc... |
530,205 | <p>Which method View() is called last in the System.Web.Mvc.Controller? Or should I override each one? I would like to set some view data in my BaseController, which inherits from System.Web.Mvc.Controller.</p>
<p><strong>Edit:</strong>
I would like to store basic user information like IsLoggedIn and BasicUserDetail... | [
{
"answer_id": 530221,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 3,
"selected": true,
"text": "<p>There are two different implementations (in RC 1):</p>\n\n<pre><code> protected internal virtual ViewResult View(s... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23528/"
] | Which method View() is called last in the System.Web.Mvc.Controller? Or should I override each one? I would like to set some view data in my BaseController, which inherits from System.Web.Mvc.Controller.
**Edit:**
I would like to store basic user information like IsLoggedIn and BasicUserDetails { PermissionLevel, User... | There are two different implementations (in RC 1):
```
protected internal virtual ViewResult View(string viewName, string masterName, object model) {
protected internal virtual ViewResult View(IView view, object model) {
```
All the others call these two. However, I would not presume that this is going to s... |
530,208 | <p>For a homework assignment I was given a Card class that has enumerated types for the Rank and Suit. I am required to compare two poker hands (each hand is an <code>ArrayList</code> of 5 cards) and decide the winner.</p>
<p>The <code>isStraight()</code> function is really bothering me, because I have to start over t... | [
{
"answer_id": 530257,
"author": "shsteimer",
"author_id": 292,
"author_profile": "https://Stackoverflow.com/users/292",
"pm_score": 4,
"selected": true,
"text": "<p>You do realize that by the rules of any poker game I've ever played or heard of a straight cannot wrap right? Ace can be l... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29595/"
] | For a homework assignment I was given a Card class that has enumerated types for the Rank and Suit. I am required to compare two poker hands (each hand is an `ArrayList` of 5 cards) and decide the winner.
The `isStraight()` function is really bothering me, because I have to start over the count after the Ace. For exam... | You do realize that by the rules of any poker game I've ever played or heard of a straight cannot wrap right? Ace can be low [A,2,3,4,5] or high [10,J,Q,K,A] but it can't wrap. According to those rules (not yours) I've implemented something similar before. Basically you sort the array and walk it, making sure the curre... |
530,210 | <p>Let's say that in the controller I get an array of objects from the database this way:</p>
<pre><code>@statuses = TwitterStatus.find(:all, :order => "tweet_id DESC", :include => :twitter_user)
</code></pre>
<p>Also I have the following loop in the view:</p>
<pre><code><% unless @statuses.nil? -%>
<... | [
{
"answer_id": 530252,
"author": "Aram Verstegen",
"author_id": 64234,
"author_profile": "https://Stackoverflow.com/users/64234",
"pm_score": 2,
"selected": false,
"text": "<p>You might want to add some instance methods to the TwitterStatus model.\nFor instance:</p>\n\n<pre><code>def for... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24988/"
] | Let's say that in the controller I get an array of objects from the database this way:
```
@statuses = TwitterStatus.find(:all, :order => "tweet_id DESC", :include => :twitter_user)
```
Also I have the following loop in the view:
```
<% unless @statuses.nil? -%>
<ol>
<% for status in @statuses %>
<li><%= h... | I want to agree with Aram. My Views were littered with formatting code until I started adding model methods that cleaned them up considerably. In my last app it was Names and Times (an employee scheduling application).
```
class Employee
def full_name
self.first_name + " " + self.last_name
end
end
```
And Tim... |
530,211 | <p>I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size <strong>all threads</strong> that are filling the queue will be blocked on add until an item is removed from the queue.</p>
<p>The solution below is what I am usin... | [
{
"answer_id": 530223,
"author": "DavidN",
"author_id": 33662,
"author_profile": "https://Stackoverflow.com/users/33662",
"pm_score": -1,
"selected": false,
"text": "<p>If you want maximum throughput, allowing multiple readers to read and only one writer to write, BCL has something calle... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3957/"
] | I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size **all threads** that are filling the queue will be blocked on add until an item is removed from the queue.
The solution below is what I am using right now and my ques... | That looks very unsafe (very little synchronization); how about something like:
```
class SizeQueue<T>
{
private readonly Queue<T> queue = new Queue<T>();
private readonly int maxSize;
public SizeQueue(int maxSize) { this.maxSize = maxSize; }
public void Enqueue(T item)
{
lock (queue)
... |
530,225 | <p>Say I have a visitor like this</p>
<pre><code>class Visitor : IVisitor
{
void Accept(Visitable v)
{
/// other code
v.AChild.Visit(this);
v.BChild.Visit(this);
}
}
</code></pre>
<p>Where AChild and BChild can be of the exact same type but the visiting code needs to differen... | [
{
"answer_id": 530253,
"author": "David Koelle",
"author_id": 2197,
"author_profile": "https://Stackoverflow.com/users/2197",
"pm_score": 0,
"selected": false,
"text": "<p>Based on your architecture, you should just call <code>v.Visit(this)</code>, and let your implementation of Visitabl... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | Say I have a visitor like this
```
class Visitor : IVisitor
{
void Accept(Visitable v)
{
/// other code
v.AChild.Visit(this);
v.BChild.Visit(this);
}
}
```
Where AChild and BChild can be of the exact same type but the visiting code needs to differentiate between them (it nee... | You're still naming the methods backwards from the way I believe the pattern is traditionally used. Visitable (or Element) usually has an accept method and Visitor has a visitX method. I'm going to use the traditional naming scheme to avoid confusing myself :-)
IMO the easiest way to get this to work is by having mult... |
530,230 | <p>I'd like to be able to better access the database so I can execute queries (primarily because I don't understand/know the API for it, but I do know SQL). I don't want to remove everything Visual Studio has done because a lot is already built upon it, but how can I get an object that I can use to execute SQL queries.... | [
{
"answer_id": 530243,
"author": "Robert S.",
"author_id": 7565,
"author_profile": "https://Stackoverflow.com/users/7565",
"pm_score": 1,
"selected": false,
"text": "<p>Are you asking what .NET libraries you can use to execute SQL against a database? If so, start by looking at <code>SqlC... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | I'd like to be able to better access the database so I can execute queries (primarily because I don't understand/know the API for it, but I do know SQL). I don't want to remove everything Visual Studio has done because a lot is already built upon it, but how can I get an object that I can use to execute SQL queries.
T... | Try something like [this](http://blog.biztalk-info.com/archive/2008/06/19/Execute_SQL_Query_from_within_a_C_function.aspx):
```
using (SqlConnection conn = new SqlConnection("Connection String Goes Here"))
{
conn.Open();
using (SqlCommand comm = new SqlCommand("SELECT * FROM TABLE", conn))
{
return... |
530,240 | <p>I have an iPhone app with an embedded UIWebview (Safari) control. I'd like to be able to store the images from certain webpages locally. </p>
<p>Can I programmatically access the path where UIWebview downloads images? Or do I need to parse the HTML and then go find the image resource out on the net and download ... | [
{
"answer_id": 530454,
"author": "hhafez",
"author_id": 42303,
"author_profile": "https://Stackoverflow.com/users/42303",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you can save the images using the UIWebview directly, you'r going to have to fetch the images manually...<... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an iPhone app with an embedded UIWebview (Safari) control. I'd like to be able to store the images from certain webpages locally.
Can I programmatically access the path where UIWebview downloads images? Or do I need to parse the HTML and then go find the image resource out on the net and download it again? | I do not know if you can access the preloaded images from Safari's cache...
However you can easily find the image URLs without parsing HTML, by running a bit of javascript instead:
```
NSString *script = @"var n = document.images.length; var names = [];"
"for (var i = 0; i < n; i++) {"
... |
530,255 | <p>How can I exchange two variables in LISP without using a third variable?</p>
| [
{
"answer_id": 530771,
"author": "ayrnieu",
"author_id": 60190,
"author_profile": "https://Stackoverflow.com/users/60190",
"pm_score": 6,
"selected": true,
"text": "<pre><code>(rotatef a b)\n</code></pre>\n"
},
{
"answer_id": 1101263,
"author": "Michael H.",
"author_id": ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63832/"
] | How can I exchange two variables in LISP without using a third variable? | ```
(rotatef a b)
``` |
530,262 | <p>for quite a while now, I've been trying to figure out how to setup an automated build process at our shop. I've read many posts and guides on this matter and none of them really fits my specifics needs.</p>
<p>My SVN repository is laid out as follows</p>
<pre><code>\projects
\projectA (a product)
\tags
... | [
{
"answer_id": 539823,
"author": "apekarske",
"author_id": 65323,
"author_profile": "https://Stackoverflow.com/users/65323",
"pm_score": 0,
"selected": false,
"text": "<p>Can you have NAnt or MSBuild call a perl or some other scripting language script to examine the svn repository and do... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15497/"
] | for quite a while now, I've been trying to figure out how to setup an automated build process at our shop. I've read many posts and guides on this matter and none of them really fits my specifics needs.
My SVN repository is laid out as follows
```
\projects
\projectA (a product)
\tags
\1.0.0.1
... | In NantContrib there is a SVN command you can use to get information. Any query you can run from the SVN command line you should be able to use and then parse the result. So you could do a tag search, match the tags to folders on your network share, then perform a checkout for any that are missing using the svn-checkou... |
530,272 | <p>I have several update methods in a javascript file, used for updating my ajax application, like so:</p>
<pre><code>function updateByPk(layer, pk) {
url = "get_auction.php?cmd=GetAuctionData&pk="+pk+"&sid="+Math.random();
update(layer, url);
}
function updateByQuery(layer, query) {
url = "get_reco... | [
{
"answer_id": 530316,
"author": "Mez",
"author_id": 20010,
"author_profile": "https://Stackoverflow.com/users/20010",
"pm_score": 2,
"selected": true,
"text": "<p>if I get the question, then you're asking whether pagination, and similar, is better to be done through Javascript + AJAX, o... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have several update methods in a javascript file, used for updating my ajax application, like so:
```
function updateByPk(layer, pk) {
url = "get_auction.php?cmd=GetAuctionData&pk="+pk+"&sid="+Math.random();
update(layer, url);
}
function updateByQuery(layer, query) {
url = "get_records.php?cmd=GetRecordSe... | if I get the question, then you're asking whether pagination, and similar, is better to be done through Javascript + AJAX, or to be done through a call to the server?
I'd personally say to just use a request to the server. AJAX is uneccesary in cases like this, other than for "bling" factor (yes, that is a technical t... |
530,278 | <p>For my Programming 102 class we are asked to deliver C code that compiles and runs under Linux. I don't have enough spare space on my hard drive to install Linux alongside Windows, and so I use cygwin to compile my programs.</p>
<p>The most recent program I had to give in compiles and runs fine under cygwin. It com... | [
{
"answer_id": 530294,
"author": "alxp",
"author_id": 19513,
"author_profile": "https://Stackoverflow.com/users/19513",
"pm_score": 2,
"selected": false,
"text": "<p>I haven't heard of anything specific about GCC weirdness under Cygwin but in your case it would probably be a good idea to... | 2009/02/09 | [
"https://Stackoverflow.com/questions/530278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19927/"
] | For my Programming 102 class we are asked to deliver C code that compiles and runs under Linux. I don't have enough spare space on my hard drive to install Linux alongside Windows, and so I use cygwin to compile my programs.
The most recent program I had to give in compiles and runs fine under cygwin. It compiles fine... | Like others have said, you might want to post some of your code here, even if that's not the real point of your question. It might still be a good learning experience to have everyone here poke through your code and see if they can find what caused the segfault.
But yeah, the problem is that there are so many platform... |