qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
61,893 | <p>I am attempting to copy a custom struct from kernel space to user space. inside user space errno returns 'bad address'. What is the usual cause of a bad address error?</p>
<pre><code>if(copy_to_user(info, &kernel_info, sizeof(struct prinfo)))
</code></pre>
| [
{
"answer_id": 61948,
"author": "roo",
"author_id": 716,
"author_profile": "https://Stackoverflow.com/users/716",
"pm_score": 3,
"selected": false,
"text": "info"
},
{
"answer_id": 29774005,
"author": "Vijay Kumar Kanta",
"author_id": 1103688,
"author_profile": "https... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
61,894 | <p>So I've done the trivial "warmup" apps with GAE. Now I'd like to build something with a more complex directory structure. Something along the lines of:</p>
<pre><code>siteroot/
models/
controllers/
controller1/
controller2/
...
templates/
template1/
template2/
...
</code></pre>
<p>..etc. The controllers will be Python modules handling requests. They would then need to locate (Django-style) templates in associated folders. Most of the demo apps I've seen resolve template paths like this:</p>
<pre><code>path = os.path.join(os.path.dirname(__file__), 'myPage.html')
</code></pre>
<p>...the __ file __ property resolves to the currently executing script. So, in my above example, if a Python script were running in controllers/controller1/, then the 'myPage.html' would resolve to that same directory -- controllers/controller1/myPage.html -- and I would rather cleanly separate my Python code and templates.</p>
<p>The solution I've hacked together feels... hacky:</p>
<pre><code>base_paths = os.path.split(os.path.dirname(__file__))
template_dir = os.path.join(base_paths[0], "templates")
</code></pre>
<p>So, I'm just snipping off the last element of the path for the currently running script and appending the template directory to the new path. The other (non-GAE specific) solutions I've seen for resolving Python paths seem pretty heavyweight (such as splitting paths into lists and manipulating accordingly). Django seems to have an answer for this, but I'd rather stick to the GAE API, vs. creating a full Django app and modifying it for GAE.</p>
<p>I'm assuming anything hard-coded would be non-starter, since the apps live on Google's infinite server farm. So what's a better way?</p>
| [
{
"answer_id": 62121,
"author": "Toni Ruža",
"author_id": 6267,
"author_profile": "https://Stackoverflow.com/users/6267",
"pm_score": 1,
"selected": false,
"text": "dirname"
},
{
"answer_id": 102572,
"author": "Nick Johnson",
"author_id": 12030,
"author_profile": "htt... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4904/"
] |
61,902 | <p>I want to embed a wikipedia article into a page but I don't want all the wrapper (navigation, etc.) that sits around the articles. I saw it done here: <a href="http://www.dayah.com/periodic/" rel="nofollow noreferrer">http://www.dayah.com/periodic/</a>. Click on an element and the iframe is displayed and links to the article only (no wrapper). So how'd they do that? Seems like JavaScript handles showing the iframe and constructing the href but after browsing the pages javascript (<a href="http://www.dayah.com/periodic/Script/interactivity.js" rel="nofollow noreferrer">http://www.dayah.com/periodic/Script/interactivity.js</a>) I still can't figure out how the url is built. Thanks.</p>
| [
{
"answer_id": 61907,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": -1,
"selected": false,
"text": "<div id=\"bodyContent\">"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/61902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5234/"
] |
61,906 | <p>In Hibernate we have two classes with the following classes with JPA mapping:</p>
<pre><code>package com.example.hibernate
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity
public class Foo {
private long id;
private Bar bar;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
public Bar getBar() {
return bar;
}
public void setBar(Bar bar) {
this.bar = bar;
}
}
package com.example.hibernate
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
public class Bar {
private long id;
private String title;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
</code></pre>
<p>Now when we load from the database an object from class Foo using session get e.g:</p>
<p>Foo foo = (Foo)session.get(Foo.class, 1 /* or some other id that exists in the DB*/);
the Bar member of foo is a proxy object (in our case javassist proxy but it can be cglib one depending on the bytecode provider you use), that is not initialized.
If you then use session.get to fetch the Bar object that is the member of the Foo class just loaded (we are in the same session), Hibernate does not issue another DB query and fetches the object from the session (first level) cache. The problem is this is a proxy to Bar class which is not initialized and trying to call this object getId() will return 0, and getTitle() will return null.
Our current solution is pretty ugly and checks if the object returned from get is a proxy here is the code (form a generic DAO implementation):</p>
<pre><code>@SuppressWarnings("unchecked")
@Override
@Transactional(readOnly = true)
public <T extends IEntity> T get(Class<T> clazz, Serializable primaryKey) throws DataAccessException {
T entity = (T) currentSession().get(clazz, primaryKey);
if (entity != null) {
if (LOG.isWarnEnabled()) {
LOG.warn("Object not found for class " + clazz.getName() + " with primary key " + primaryKey);
}
} else if (entity instanceof HibernateProxy){ // TODO: force initialization due to Hibernate bug
HibernateProxy proxy = (HibernateProxy)entity;
if (!Hibernate.isInitialized(proxy)) {
Hibernate.initialize(proxy);
}
entity = (T)proxy.getHibernateLazyInitializer().getImplementation();
}
return entity;
}
</code></pre>
<p>Is there a better way to do this, couldn't find a solution in the Hibernate forum, and didn't find the issue in Hibernate's JIRA.</p>
<p>Note: we cannot just use foo.getBar() (which will initialize the proxy properly) to get the Bar class object, because the session.get operation to fetch the Bar object does not know (or care for that matter) that the Bar class is also a lazy member of a Foo object that was just fetched.</p>
| [
{
"answer_id": 61989,
"author": "Binil Thomas",
"author_id": 3973,
"author_profile": "https://Stackoverflow.com/users/3973",
"pm_score": 0,
"selected": false,
"text": "@Entity\npublic class Foo {\n private Long id; private String name; private Bar bar;\n\n public Foo() { }\n pub... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3332/"
] |
61,953 | <p>Let's say I have the following simple enum:</p>
<pre><code>enum Response
{
Yes = 1,
No = 2,
Maybe = 3
}
</code></pre>
<p>How can I bind this enum to a DropDownList control so that the descriptions are displayed in the list as well as retrieve the associated numeric value (1,2,3) once an option has been selected?</p>
| [
{
"answer_id": 61961,
"author": "Mark Glorie",
"author_id": 952,
"author_profile": "https://Stackoverflow.com/users/952",
"pm_score": 8,
"selected": true,
"text": "Dim itemValues As Array = System.Enum.GetValues(GetType(Response))\nDim itemNames As Array = System.Enum.GetNames(GetType(Re... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] |
61,963 | <p>I want to import an oracle dump into a different tablespace.</p>
<p>I have a tablespace A used by User A. I've revoked DBA on this user and given him the grants connect and resource. Then I've dumped everything with the command</p>
<blockquote>
<p>exp a/*** owner=a file=oracledump.DMP log=log.log compress=y</p>
</blockquote>
<p>Now I want to import the dump into the tablespace B used by User B. So I've given him the grants on connect and resource (no DBA). Then I've executed the following import:</p>
<blockquote>
<p>imp b/*** file=oracledump.DMP log=import.log fromuser=a touser=b</p>
</blockquote>
<p>The result is a log with lots of errors:</p>
<blockquote>
<p>IMP-00017: following statement failed with ORACLE error 20001: "BEGIN DBMS_STATS.SET_TABLE_STATS
IMP-00003: ORACLE error 20001 encountered
ORA-20001: Invalid or inconsistent input values</p>
</blockquote>
<p>After that, I've tried the same import command but with the option statistics=none. This resulted in the following errors:</p>
<blockquote>
<p>ORA-00959: tablespace 'A_TBLSPACE' does not exist</p>
</blockquote>
<p>How should this be done?</p>
<p>Note: a lot of columns are of type CLOB. It looks like the problems have something to do with that.</p>
<p>Note2: The oracle versions are a mixture of 9.2, 10.1, and 10.1 XE. But I don't think it has to do with versions.</p>
| [
{
"answer_id": 63823,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "REMAP_TABLESPACE=A_TBLSPACE:NEW_TABLESPACE_GOES_HERE\n"
},
{
"answer_id": 71826,
"author": "Andrew",
"author_id... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5043/"
] |
61,967 | <p>Let's say I have the following simple table variable:</p>
<pre><code>declare @databases table
(
DatabaseID int,
Name varchar(15),
Server varchar(15)
)
-- insert a bunch rows into @databases
</code></pre>
<p>Is declaring and using a cursor my only option if I wanted to iterate through the rows? Is there another way?</p>
| [
{
"answer_id": 61981,
"author": "GateKiller",
"author_id": 383,
"author_profile": "https://Stackoverflow.com/users/383",
"pm_score": 2,
"selected": false,
"text": "While (Select Count(*) From #TempTable) > 0\nBegin\n Insert Into @Databases...\n\n Delete From #TempTable Where x = x\... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] |
61,972 | <p>Best recommendations for accessing and manipulation of sqlite databases from JavaScript.</p>
| [
{
"answer_id": 11110639,
"author": "Juicy Scripter",
"author_id": 155033,
"author_profile": "https://Stackoverflow.com/users/155033",
"pm_score": 5,
"selected": false,
"text": "sql.js"
},
{
"answer_id": 23878874,
"author": "lovasoa",
"author_id": 3579309,
"author_prof... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6390/"
] |
61,995 | <p>Given the following XML:</p>
<pre><code><current>
<login_name>jd</login_name>
</current>
<people>
<person>
<first>John</first>
<last>Doe</last>
<login_name>jd</login_name>
</preson>
<person>
<first>Pierre</first>
<last>Spring</last>
<login_name>ps</login_name>
</preson>
</people>
</code></pre>
<p>How can I get "John Doe" from within the current/login matcher?</p>
<p>I tried the following:</p>
<pre><code><xsl:template match="current/login_name">
<xsl:value-of select="../people/first[login_name = .]"/>
<xsl:text> </xsl:text>
<xsl:value-of select="../people/last[login_name = .]"/>
</xsl:template>
</code></pre>
| [
{
"answer_id": 62010,
"author": "Kendall Helmstetter Gelner",
"author_id": 6330,
"author_profile": "https://Stackoverflow.com/users/6330",
"pm_score": 0,
"selected": false,
"text": "<xsl:variable name=\"login\" select=\"//current/login_name/text()\"/>\n\n<xsl:template match=\"current/log... | 2008/09/15 | [
"https://Stackoverflow.com/questions/61995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1532/"
] |
62,012 | <p>I was wondering if anybody knew of a method to configure apache to fall back to returning a static HTML page, should it (Apache) be able to determine that PHP has died? This would provide the developer with a elegant solution to displaying an error page and not (worst case scenario) the source code of the PHP page that should have been executed.</p>
<p>Thanks.</p>
| [
{
"answer_id": 62748,
"author": "AdamTheHutt",
"author_id": 1103,
"author_profile": "https://Stackoverflow.com/users/1103",
"pm_score": 1,
"selected": false,
"text": "E_FATAL"
},
{
"answer_id": 65988,
"author": "farzad",
"author_id": 9394,
"author_profile": "https://S... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6085/"
] |
62,013 | <p>I set up a website to use SqlMembershipProvider as written on <a href="http://msdn.microsoft.com/en-us/library/ms998347.aspx" rel="nofollow noreferrer">this page</a>.</p>
<p>I followed every step. I have the database, I modified the Web.config to use this provider, with the correct connection string, and the authentication mode is set to Forms. Created some users to test with.</p>
<p>I created a Login.aspx and put the Login control on it. Everything works fine until the point that a user can log in. </p>
<p>I call Default.aspx, it gets redirected to Login.aspx, I enter the user and the correct password. No error message, nothing seems to be wrong, but I see again the Login form, to enter the user's login information. However if I check the cookies in the browser, I can see that the cookie with the specified name exists.</p>
<p>I already tried to handle the events by myself and check, what is happening in them, but no success.</p>
<p>I'm using VS2008, Website in filesystem, SQL Express 2005 to store aspnetdb, no role management, tested with K-Meleon, IE7.0 and Chrome.</p>
<p>Any ideas?</p>
<p><strong>Resolution:</strong> After some mailing with Rob we have the ideal solution, which is now the accepted answer.</p>
| [
{
"answer_id": 62050,
"author": "Leo Moore",
"author_id": 6336,
"author_profile": "https://Stackoverflow.com/users/6336",
"pm_score": 2,
"selected": false,
"text": " <!--Deny all users -->\n <authorization>\n <deny users=\"*\" />\n </authorization>\n"
},
{
"answer_id": ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/968/"
] |
62,029 | <p>I use the VS2008 command prompt for builds, TFS access etc. and the cygwin prompt for grep, vi and unix-like tools. Is there any way I can 'import' the vcvars32.bat functionality into the cygwin environment so I can call "tfs checkout" from cygwin itself?</p>
| [
{
"answer_id": 168447,
"author": "Ted",
"author_id": 8965,
"author_profile": "https://Stackoverflow.com/users/8965",
"pm_score": 3,
"selected": false,
"text": "@echo off\n@REM Select the latest VS Tools\nIF EXIST %VS100COMNTOOLS% (\n CALL \"%VS100COMNTOOLS%\\vsvars32.bat\"\n GOTO ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45603/"
] |
62,034 | <p>I am trying to write a unit test for an action method which calls the <code>Controller.RedirectToReferrer()</code> method, but am getting a "No referrer available" message.</p>
<p>How can I isolate and mock this method?</p>
| [
{
"answer_id": 137467,
"author": "James Thigpen",
"author_id": 3285,
"author_profile": "https://Stackoverflow.com/users/3285",
"pm_score": 0,
"selected": false,
"text": "[TestFixture]\npublic class LoginControllerTests : GenericBaseControllerTest<LoginController>\n{\n private string r... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6413/"
] |
62,038 | <p>I have a sequence of migrations in a rails app which includes the following steps:</p>
<ol>
<li>Create basic version of the 'user' model</li>
<li>Create an instance of this model - there needs to be at least one initial user in my system so that you can log in and start using it</li>
<li>Update the 'user' model to add a new field / column.</li>
</ol>
<p>Now I'm using "validates_inclusion_of" on this new field/column. This worked fine on my initial development machine, which already had a database with these migrations applied. However, if I go to a fresh machine and run all the migrations, step 2 fails, because validates_inclusion_of fails, because the field from migration 3 hasn't been added to the model class yet.</p>
<p>As a workaround, I can comment out the "validates_..." line, run the migrations, and uncomment it, but that's not nice.</p>
<p>Better would be to re-order my migrations so the user creation (step 2) comes last, after all columns have been added.</p>
<p>I'm a rails newbie though, so I thought I'd ask what the preferred way to handle this situation is :)</p>
| [
{
"answer_id": 62148,
"author": "Ben Scofield",
"author_id": 6478,
"author_profile": "https://Stackoverflow.com/users/6478",
"pm_score": 4,
"selected": true,
"text": "rake db:schema:load"
},
{
"answer_id": 63073,
"author": "Étienne Barrié",
"author_id": 7489,
"author_... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3974/"
] |
62,044 | <p>I'm trying to construct a find command to process a bunch of files in a directory using two different executables. Unfortunately, <code>-exec</code> on find doesn't allow to use pipe or even <code>\|</code> because the shell interprets that character first. </p>
<p>Here is specifically what I'm trying to do (which doesn't work because pipe ends the find command):</p>
<pre><code>find /path/to/jpgs -type f -exec jhead -v {} | grep 123 \; -print
</code></pre>
| [
{
"answer_id": 62054,
"author": "Xetius",
"author_id": 274,
"author_profile": "https://Stackoverflow.com/users/274",
"pm_score": 1,
"selected": false,
"text": "find /path/to/jpgs -type f -exec jhead -v {} \\; | grep 123\n"
},
{
"answer_id": 62060,
"author": "Martin Marconcini... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3499/"
] |
62,079 | <p>I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the script to output.</p>
<blockquote>
<p>1) Is it actually worth taking such things into account?</p>
<p>2) Assuming it is worth taking it into account, how do I do this?</p>
</blockquote>
<p>I'm using a Mac so I've got access to Linux commands and I'm not afraid to compile/create a command to help me, I just don't know how to write such a command.</p>
| [
{
"answer_id": 62094,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 3,
"selected": true,
"text": "$ time script.php\nHI!\n\nreal 0m3.218s\nuser 0m0.080s\nsys 0m0.064s\n"
},
{
"answer_id": 62099,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
62,086 | <p>I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there!</p>
<p>Suppose I have the following XML (using e4x):</p>
<pre><code>var xml:XML = <root><example>foo</example></root>
</code></pre>
<p>I can change the contents of the example node using the following code:</p>
<pre><code>xml.example = "bar";
</code></pre>
<p>However, if I have this:</p>
<pre><code>var xml:XML = <root>foo</root>
</code></pre>
<p>How do i change the contents of the root node?</p>
<pre><code>xml = "bar";
</code></pre>
<p>Obviously doesn't work as I'm attempting to assign a string to an XML object.</p>
| [
{
"answer_id": 62165,
"author": "Loren Segal",
"author_id": 6436,
"author_profile": "https://Stackoverflow.com/users/6436",
"pm_score": 0,
"selected": false,
"text": "var xml = <root>foo</root>; // </fix_syntax_highlighter>\nvar parser = new DOMParser();\nvar serializer = new XMLSerializ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6448/"
] |
62,137 | <p>I've just heard the term covered index in some database discussion - what does it mean?</p>
| [
{
"answer_id": 62140,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 7,
"selected": true,
"text": "SELECT *\nFROM tablename\nWHERE criteria\n"
},
{
"answer_id": 62143,
"author": "aku",
"author_id": 1196... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5466/"
] |
62,151 | <p>I've been wondering what exactly are the principles of how the two properties work. I know the second one is universal and basically doesn't deal with time zones, but can someone explain in detail how they work and which one should be used in what scenario?</p>
| [
{
"answer_id": 62160,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 10,
"selected": true,
"text": "DateTime.Now"
},
{
"answer_id": 62164,
"author": "Jeff Atwood",
"author_id": 1,
"author_profile": "h... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1801/"
] |
62,153 | <p>Several times now I've been faced with plans from a team that wants to build their own bug tracking system - Not as a product, but as an internal tool.</p>
<p>The arguments I've heard in favous are usually along the lines of :</p>
<ul>
<li>Wanting to 'eat our own dog food' in terms of some internally built web framework</li>
<li>Needing some highly specialised report, or the ability to tweak some feature in some allegedly unique way</li>
<li>Believing that it isn't difficult to build a bug tracking system</li>
</ul>
<p>What arguments might you use to support buying an existing bug tracking system? In particular, what features sound easy but turn out hard to implement, or are difficult and important but often overlooked?</p>
| [
{
"answer_id": 180008,
"author": "Constantin",
"author_id": 20310,
"author_profile": "https://Stackoverflow.com/users/20310",
"pm_score": 7,
"selected": true,
"text": " Trac: 44 KLoC, 10 Person Years, $577,003\nBugzilla: 54 KLoC, 13 Person Years, $714,437\n Redmine: 171 KLoC, 44... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] |
62,188 | <p>To commemorate the public launch of Stack Overflow, what's the shortest code to cause a stack overflow? Any language welcome.</p>
<p>ETA: Just to be clear on this question, seeing as I'm an occasional Scheme user: tail-call "recursion" is really iteration, and any solution which can be converted to an iterative solution relatively trivially by a decent compiler won't be counted. :-P</p>
<p>ETA2: I've now selected a “best answer”; see <a href="https://stackoverflow.com/questions/62188/stack-overflow-code-golf/71833#71833">this post</a> for rationale. Thanks to everyone who contributed! :-)</p>
| [
{
"answer_id": 62189,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 7,
"selected": false,
"text": "push eax\njmp short $-1\n"
},
{
"answer_id": 62191,
"author": "Niyaz",
"author_id": 184,
"author_profile"... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13/"
] |
62,201 | <p>I've got a rails application where users have to log in. Therefore in order for the application to be usable, there must be one initial user in the system for the first person to log in with (they can then create subsequent users). Up to now I've used a migration to add a special user to the database.</p>
<p>After asking <a href="https://stackoverflow.com/questions/62038/rails-model-validators-break-earlier-migrations">this question</a>, it seems that I should be using db:schema:load, rather than running the migrations, to set up fresh databases on new development machines. Unfortunately, this doesn't seem to include the migrations which insert data, only those which set up tables, keys etc.</p>
<p>My question is, what's the best way to handle this situation:</p>
<ol>
<li>Is there a way to get d:s:l to include data-insertion migrations?</li>
<li>Should I not be using migrations at all to insert data this way?</li>
<li>Should I not be pre-populating the database with data at all? Should I update the application code so that it handles the case where there are no users gracefully, and lets an initial user account be created live from within the application?</li>
<li>Any other options? :)</li>
</ol>
| [
{
"answer_id": 62262,
"author": "Trevor Stow",
"author_id": 75093,
"author_profile": "https://Stackoverflow.com/users/75093",
"pm_score": 2,
"selected": false,
"text": "script/console production\n"
},
{
"answer_id": 62528,
"author": "Aaron Wheeler",
"author_id": 6940,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3974/"
] |
62,219 | <p>As I get more and more namespaces in my solution, the list of using statements at the top of my files grows longer and longer. This is especially the case in my unit tests where for each component that might be called I need to include the using for the interface, the IoC container, and the concrete type. </p>
<p>With upward of 17 lines of usings in my integration test files its just getting downright messy. Does anyone know if theres a way to define a macro for my base using statements? Any other solutions?</p>
| [
{
"answer_id": 62224,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 3,
"selected": true,
"text": "#region"
},
{
"answer_id": 62453,
"author": "Steve Cooper",
"author_id": 6722,
"author_profile": "htt... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] |
62,226 | <p>An instance of class A instantiates a couple of other objects, say for example from class B:</p>
<pre><code>$foo = new B();
</code></pre>
<p>I would like to access A's public class variables from methods within B.</p>
<p>Unless I'm missing something, the only way to do this is to pass the current object to the instances of B:</p>
<pre><code>$foo = new B($this);
</code></pre>
<p>Is this best practice or is there another way to do this?</p>
| [
{
"answer_id": 76201,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 0,
"selected": false,
"text": "$foo = new B( A::getInstance() );\n"
},
{
"answer_id": 883890,
"author": "Jet",
"author_id": 109480,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6260/"
] |
62,230 | <p>How do I save a jpg image to database and then load it in Delphi using FIBplus and TImage?</p>
| [
{
"answer_id": 69243,
"author": "Ali",
"author_id": 10989,
"author_profile": "https://Stackoverflow.com/users/10989",
"pm_score": 2,
"selected": false,
"text": "var\n S : TMemoryStream;\nbegin\n S := TMemoryStream.Create;\n try\n TBlobField(AdoQuery1.FieldByName('ImageField')).Save... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6155/"
] |
62,241 | <p>Is there an easy way to avoid dealing with text encoding problems?</p>
| [
{
"answer_id": 62257,
"author": "Peter",
"author_id": 6094,
"author_profile": "https://Stackoverflow.com/users/6094",
"pm_score": 7,
"selected": true,
"text": "Reader"
},
{
"answer_id": 1360466,
"author": "Sam Barnum",
"author_id": 14467,
"author_profile": "https://St... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3885/"
] |
62,245 | <p>I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row depending on the event or add it as new if the agent doesn't exist. Currently I have this Mnesia transaction in each event and of course that is a bunch of repeated code for checking the existence of agents and so on. </p>
<p>I'm trying to change it so that there is one function like <em>change_agent/2</em> that I call from the events that handles this for me. </p>
<p>My problems are of course records.... I find no way of dynamically creating them or merging 2 of them together or anything. Preferably there would be a function I could call like:</p>
<pre><code>change_agent("001", #agent(id = "001", name = "Steve")).
change_agent("001", #agent(id = "001", paused = 0, talking_to = "None")).
</code></pre>
| [
{
"answer_id": 62556,
"author": "uwiger",
"author_id": 6834,
"author_profile": "https://Stackoverflow.com/users/6834",
"pm_score": 2,
"selected": false,
"text": "-compile({parse_transform, exprecs}).\n-export_records([...]). % name the records that you want to 'export'\n"
},
{
"... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5601/"
] |
62,264 | <p>I recently asked about <a href="https://stackoverflow.com/questions/39742/does-git-have-anything-like-svn-propset-svnkeywords-or-pre-post-commit-hooks">keyword expansion in Git</a> and I'm willing to accept the design not to really support this idea in Git. </p>
<p>For better or worse, the project I'm working on at the moment requires SVN keyword expansion like this:</p>
<pre><code>svn propset svn:keywords "Id" expl3.dtx
</code></pre>
<p>to keep this string up-to-date:</p>
<pre><code>$Id: expl3.dtx 803 2008-09-11 14:01:58Z will $
</code></pre>
<p>But I would quite like to use Git to do my version control. Unfortunately, git-svn doesn't support this, according to the docs:</p>
<blockquote>
<p>"We ignore all SVN properties except svn:executable"</p>
</blockquote>
<p>But it doesn't seem too tricky to have this keyword stuff emulated by a couple of pre/post commit hooks. Am I the first person to want this? Does anyone have some code to do this?</p>
| [
{
"answer_id": 62288,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 1,
"selected": false,
"text": "$Id: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef$\n"
},
{
"answer_id": 72874,
"author": "emk",
"author_id": 1... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4161/"
] |
62,268 | <p>I have a winform app that calls a web service to check for updates. This works in dev and it also works everywhere else I've tried it, just not on the installed copy on my machine (which happens to be the same in dev).</p>
<p>The error is:</p>
<p>Cannot execute a program. The command being executed was "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /noconfig /fullpaths @"C:\Documents and Settings\Giovanni.DOUBLE-AFSSZ043\Local Settings\Temp\squ8oock.cmdline".</p>
<p>The firewall is disabled and I've looked for "C:\Documents and Settings\Giovanni.DOUBLE-AFSSZ043\Local Settings\Temp\squ8oock.cmdline" and it is not there. Note that every time I try to use the web service the ".cmdline" file is different, for example the second time I ran it it was "dae8rgen.cmdline." No matter what name it has, I can never find the file.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 47547430,
"author": "Ivan Chau",
"author_id": 1608670,
"author_profile": "https://Stackoverflow.com/users/1608670",
"pm_score": 0,
"selected": false,
"text": "c:\\windows\\MICROSOFT.NET\\FRAMEWORK\\V2.0.50727\\CSC.EXE"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4050/"
] |
62,289 | <p>How is it possible to read/write to the Windows registry using Java?</p>
| [
{
"answer_id": 63231,
"author": "Alex Argo",
"author_id": 5885,
"author_profile": "https://Stackoverflow.com/users/5885",
"pm_score": 5,
"selected": false,
"text": "import java.io.File;\nimport ca.beq.util.win32.registry.RegistryKey;\nimport ca.beq.util.win32.registry.RegistryValue;\nimp... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,294 | <p>The default check-in action for a work-item is "resolve". I'd like to set it to "associate" so that this work item isn't automaticaly closed if I check-in stuff too fast. How can I do that?</p>
| [
{
"answer_id": 44068378,
"author": "maf-soft",
"author_id": 1855801,
"author_profile": "https://Stackoverflow.com/users/1855801",
"pm_score": 0,
"selected": false,
"text": "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\14.0\\TeamFoundation\\SourceControl\\Behavior\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6555/"
] |
62,317 | <p>In PHP, how can I replicate the expand/contract feature for Tinyurls as on search.twitter.com?</p>
| [
{
"answer_id": 62367,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 4,
"selected": true,
"text": "GET /dmsfm HTTP/1.0\nHost: tinyurl.com\n"
},
{
"answer_id": 62597,
"author": "Udo",
"author_id": 6907,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,340 | <pre><code>std::vector<int> ints;
// ... fill ints with random values
for(std::vector<int>::iterator it = ints.begin(); it != ints.end(); )
{
if(*it < 10)
{
*it = ints.back();
ints.pop_back();
continue;
}
it++;
}
</code></pre>
<p>This code is not working because when <code>pop_back()</code> is called, <code>it</code> is invalidated. But I don't find any doc talking about invalidation of iterators in <code>std::vector::pop_back()</code>.</p>
<p>Do you have some links about that?</p>
| [
{
"answer_id": 62522,
"author": "Ben",
"author_id": 6930,
"author_profile": "https://Stackoverflow.com/users/6930",
"pm_score": 5,
"selected": true,
"text": "pop_back()"
},
{
"answer_id": 62878,
"author": "Pieter",
"author_id": 5822,
"author_profile": "https://Stackov... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6605/"
] |
62,353 | <p>I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing this? Which attributes should be in solution wide file and which are project/assembly specific?</p>
<hr>
<p><em>Edit: If you are interested there is a follow up question <a href="https://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin">What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion?</a></em></p>
| [
{
"answer_id": 62631,
"author": "SaguiItay",
"author_id": 6980,
"author_profile": "https://Stackoverflow.com/users/6980",
"pm_score": 0,
"selected": false,
"text": "AssemblyTitle"
},
{
"answer_id": 62637,
"author": "JRoppert",
"author_id": 6777,
"author_profile": "htt... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2361/"
] |
62,365 | <p>Say I have an ASMX web service, MyService. The service has a method, MyMethod. I could execute MyMethod on the server side as follows:</p>
<pre><code>MyService service = new MyService();
service.MyMethod();
</code></pre>
<p>I need to do similar, with service and method not known until runtime. </p>
<p>I'm assuming that reflection is the way to go about that. Unfortunately, I'm having a hard time making it work. When I execute this code:</p>
<pre><code>Type.GetType("MyService", true);
</code></pre>
<p>It throws this error:</p>
<blockquote>
<p>Could not load type 'MyService' from assembly 'App_Web__ktsp_r0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.</p>
</blockquote>
<p>Any guidance would be appreciated.</p>
| [
{
"answer_id": 62381,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 3,
"selected": true,
"text": "Dim HTTPRequest As HttpWebRequest\nDim HTTPResponse As HttpWebResponse\nDim ResponseReader As StreamReader\nDim URL AS String\n... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60/"
] |
62,389 | <p>What are the advantages/disadvantages between MS VS C++ 6.0 and MSVS C++ 2008? </p>
<p>The main reason for asking such a question is that there are still many decent programmers that prefer using the older version instead of the newest version.</p>
<p>Is there any reason the might prefer the older over the new?</p>
| [
{
"answer_id": 379446,
"author": "FryGuy",
"author_id": 28776,
"author_profile": "https://Stackoverflow.com/users/28776",
"pm_score": 0,
"selected": false,
"text": "sometemplate<othertemplate<t>>"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6619/"
] |
62,406 | <p>I am overriding a lot of SAP's Portal functionality in my current project. I have to create a custom fixed width framework, custom iView trays, custom KM API functionality, and more.</p>
<p>With all of these custom parts, I will not be using a lot of the style functionality implemented by SAP's Theme editor. What I would like to do is create an external CSS, store it outside of the Portal and reference it. Storing externally will allow for easier updates rather than storing the CSS within a portal application. It would also allow for all custom pieces to have their styles in once place.</p>
<p>Unfortunately, I've not found a way to gain access to the HEAD portion of the page that allows me to insert an external stylesheet. Portal Applications can do so using the IResource object to gain access to internal references, but not items on another server.</p>
<p>I'm looking for any ideas that would allow me to gain this functionality. I have <a href="https://www.sdn.sap.com/irj/sdn/thread?threadID=1046064&tstart=0" rel="nofollow noreferrer">x-posted on SAP's SDN</a>, but I suspect I'll get a better answer here.</p>
| [
{
"answer_id": 66035,
"author": "Mike Cornell",
"author_id": 419788,
"author_profile": "https://Stackoverflow.com/users/419788",
"pm_score": 0,
"selected": false,
"text": "IPortalNode node = request.getNode().getPortalNode();\nIPortalResponse resp = (IPortalResponse) node.getValue(IPorta... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/419788/"
] |
62,418 | <p>When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better way than just randomly killing java.exe processes in hope that you'll hit the correct application eventually?</p>
<p><strong>EDIT:</strong> Thank you to all the people who pointed me to Sysinternal's Process Explorer - Exactly what I'm looking for!</p>
| [
{
"answer_id": 63655,
"author": "Misha",
"author_id": 7557,
"author_profile": "https://Stackoverflow.com/users/7557",
"pm_score": 6,
"selected": false,
"text": "jps -lv"
},
{
"answer_id": 63659,
"author": "Bill Michell",
"author_id": 7938,
"author_profile": "https://S... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6094/"
] |
62,430 | <p>Is is possible to construct a regular expression that rejects all input strings?</p>
| [
{
"answer_id": 62473,
"author": "Jan Hančič",
"author_id": 185527,
"author_profile": "https://Stackoverflow.com/users/185527",
"pm_score": 1,
"selected": false,
"text": "if ( inputString != \"\" )\n doSomething ()\n"
},
{
"answer_id": 62475,
"author": "aku",
"author_id":... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4984/"
] |
62,433 | <p>I have looked in vain for a good example or starting point to write a java based facebook application... I was hoping that someone here would know of one. As well, I hear that facebook will no longer support their java API is this true and if yes does that mean that we should no longer use java to write facebook apps??</p>
| [
{
"answer_id": 7411318,
"author": "stickfigure",
"author_id": 635982,
"author_profile": "https://Stackoverflow.com/users/635982",
"pm_score": 1,
"selected": false,
"text": "/** You write your own Jackson user mapping for the pieces you care about */\npublic class User {\n long uid;\n ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6788/"
] |
62,436 | <p>I am having a problem with the speed of accessing an association property with a large number of records.</p>
<p>I have an XAF app with a parent class called <code>MyParent</code>.</p>
<p>There are 230 records in <code>MyParent</code>.</p>
<p><code>MyParent</code> has a child class called <code>MyChild</code>.</p>
<p>There are 49,000 records in <code>MyChild</code>.</p>
<p>I have an association defined between <code>MyParent</code> and <code>MyChild</code> in the standard way:</p>
<p>In <code>MyChild</code>:</p>
<pre><code>// MyChild (many) and MyParent (one)
[Association("MyChild-MyParent")]
public MyParent MyParent;
</code></pre>
<p>And in <code>MyParent</code>:</p>
<pre><code>[Association("MyChild-MyParent", typeof(MyChild))]
public XPCollection<MyCHild> MyCHildren
{
get { return GetCollection<MyCHild>("MyCHildren"); }
}
</code></pre>
<p>There's a specific <code>MyParent</code> record called <code>MyParent1</code>.</p>
<p>For <code>MyParent1</code>, there are 630 <code>MyChild</code> records.</p>
<p>I have a DetailView for a class called <code>MyUI</code>.</p>
<p>The user chooses an item in one drop-down in the <code>MyUI</code> DetailView, and my code has to fill another drop-down with <code>MyChild</code> objects.</p>
<p>The user chooses <code>MyParent1</code> in the first drop-down.</p>
<p>I created a property in <code>MyUI</code> to return the collection of <code>MyChild</code> objects for the selected value in the first drop-down.</p>
<p>Here is the code for the property:</p>
<pre><code>[NonPersistent]
public XPCollection<MyChild> DisplayedValues
{
get
{
Session theSession;
MyParent theParentValue;
XPCollection<MyCHild> theChildren;
theParentValue = this.DropDownOne;
// get the parent value
if theValue == null)
{
// if none
return null;
// return null
}
theChildren = theParentValue.MyChildren;
// get the child values for the parent
return theChildren;
// return it
}
</code></pre>
<p>I marked the <code>DisplayedValues</code> property as <code>NonPersistent</code> because it is only needed for the UI of the DetailVIew. I don't think that persisting it will speed up the creation of the collection the first time, and after it's used to fill the drop-down, I don't need it, so I don't want to spend time storing it.</p>
<p>The problem is that it takes 45 seconds to call <code>theParentValue = this.DropDownOne</code>.</p>
<p>Specs:</p>
<ul>
<li>Vista Business</li>
<li>8 GB of RAM</li>
<li>2.33 GHz E6550 processor</li>
<li>SQL Server Express 2005</li>
</ul>
<p>This is too long for users to wait for one of many drop-downs in the DetailView.</p>
<p>I took the time to sketch out the business case because I have two questions:</p>
<ol>
<li><p>How can I make the associated values load faster?</p></li>
<li><p>Is there another (simple) way to program the drop-downs and DetailView that runs much faster?</p></li>
</ol>
<p>Yes, you can say that 630 is too many items to display in a drop-down, but this code is taking so long I suspect that the speed is proportional to the 49,000 and not to the 630. 100 items in the drop-down would not be too many for my app.</p>
<p>I need quite a few of these drop-downs in my app, so it's not appropriate to force the user to enter more complicated filtering criteria for each one. The user needs to pick one value and see the related values.</p>
<p>I would understand if finding a large number of records was slow, but finding a few hundred shouldn't take that long.</p>
| [
{
"answer_id": 1169654,
"author": "Steven Evers",
"author_id": 48553,
"author_profile": "https://Stackoverflow.com/users/48553",
"pm_score": 1,
"selected": false,
"text": "public class A : XPObject\n{\n [Association(\"a<b\", typeof(b))]\n public XPCollection<b> bs { get { GetCollec... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6783/"
] |
62,437 | <p>I load some XML from a servlet from my Flex application like this:</p>
<pre><code>_loader = new URLLoader();
_loader.load(new URLRequest(_servletURL+"?do=load&id="+_id));
</code></pre>
<p>As you can imagine <code>_servletURL</code> is something like <a href="http://foo.bar/path/to/servlet" rel="nofollow noreferrer">http://foo.bar/path/to/servlet</a></p>
<p>In some cases, this URL contains accented characters (long story). I pass the <code>unescaped</code> string to <code>URLRequest</code>, but it seems that flash escapes it and calls the escaped URL, which is invalid. Ideas?</p>
| [
{
"answer_id": 62519,
"author": "grapefrukt",
"author_id": 914,
"author_profile": "https://Stackoverflow.com/users/914",
"pm_score": 2,
"selected": false,
"text": "var request:URLRequest = new URLRequest(_servletURL)\nrequest.method = URLRequestMethod.GET;\nvar reqData:Object = new Objec... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199623/"
] |
62,447 | <p>Tomcat fails to start even if i remove all my applications from the WEBAPPS directory leaving everything just like after the OS installation.</p>
<p>The log (catalina.out) says:</p>
<pre><code>Using CATALINA_BASE: /usr/share/tomcat5
Using CATALINA_HOME: /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
Created MBeanServer with ID: -dpv07y:fl4s82vl.0:hydrogenium.timberlinecolorado.com:1
java.lang.NoClassDefFoundError: org.apache.catalina.core.StandardService
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.newInstance(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.init(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.modeler.Registry not found in org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/server/classes/,file:/usr/share/java/tomcat5/catalina-cluster-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-storeconfig-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-optional-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-coyote-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-jkstatus-ant-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-ajp-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-default-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-invoker-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-ant-jmx-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-http-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-util-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-apr-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/servlets-webdav-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-5.5.23.jar], parent=org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/common/classes/,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-ja.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-fr.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-en.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-es.jar,file:/usr/share/java/tomcat5/naming-resources-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/naming-factory-5.5.23.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib/jvm/java/lib/tools.jar,file:/usr/share/tomcat5/bin/bootstrap.jar,file:/usr/share/tomcat5/bin/commons-logging-api.jar,file:/usr/share/java/mx4j/mx4j-impl.jar,file:/usr/share/java/mx4j/mx4j-jmx.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
...5 more
</code></pre>
| [
{
"answer_id": 62559,
"author": "tbond",
"author_id": 6197,
"author_profile": "https://Stackoverflow.com/users/6197",
"pm_score": 0,
"selected": false,
"text": "JAVA_HOME/JRE_HOME"
},
{
"answer_id": 64862,
"author": "Alexandre Brasil",
"author_id": 8841,
"author_profi... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,449 | <p>When using the Net.Sockets.TcpListener, what is the best way to handle incoming connections (.AcceptSocket) in seperate threads?</p>
<p>The idea is to start a new thread when a new incoming connection is accepted, while the tcplistener then stays available for further incoming connections (and for every new incoming connection a new thread is created). All communication and termination with the client that originated the connection will be handled in the thread.</p>
<p>Example C# of VB.NET code is appreciated.</p>
| [
{
"answer_id": 62547,
"author": "x0n",
"author_id": 6920,
"author_profile": "https://Stackoverflow.com/users/6920",
"pm_score": 1,
"selected": false,
"text": "http://examples.oreilly.com/9780596516109/CSharp3_0CookbookCodeRTM.zip"
},
{
"answer_id": 247108,
"author": "Anton",
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1271/"
] |
62,490 | <p>I am receiving SOAP requests from a client that uses the Axis 1.4 libraries. The requests have the following form:</p>
<pre><code><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<PlaceOrderRequest xmlns="http://example.com/schema/order/request">
<order>
<ns1:requestParameter xmlns:ns1="http://example.com/schema/common/request">
<ns1:orderingSystemWithDomain>
<ns1:orderingSystem>Internet</ns1:orderingSystem>
<ns1:domainSign>2</ns1:domainSign>
</ns1:orderingSystemWithDomain>
</ns1:requestParameter>
<ns2:directDeliveryAddress ns2:addressType="0" ns2:index="1"
xmlns:ns2="http://example.com/schema/order/request">
<ns3:address xmlns:ns3="http://example.com/schema/common/request">
<ns4:zipcode xmlns:ns4="http://example.com/schema/common">12345</ns4:zipcode>
<ns5:city xmlns:ns5="http://example.com/schema/common">City</ns5:city>
<ns6:street xmlns:ns6="http://example.com/schema/common">Street</ns6:street>
<ns7:houseNum xmlns:ns7="http://example.com/schema/common">1</ns7:houseNum>
<ns8:country xmlns:ns8="http://example.com/schema/common">XX</ns8:country>
</ns3:address>
[...]
</code></pre>
<p>As you can see, several prefixes are defined for the same namespace, e.g. the namespace <a href="http://example.com/schema/common" rel="noreferrer">http://example.com/schema/common</a> has the prefixes ns4, ns5, ns6, ns7 and ns8. Some long requests define several hundred prefixes for the same namespace.</p>
<p>This causes a problem with the <a href="http://saxon.sourceforge.net/" rel="noreferrer">Saxon</a> XSLT processor, that I use to transform the requests. Saxon limits the the number of different prefixes for the same namespace to 255 and throws an exception when you define more prefixes.</p>
<p>Can Axis 1.4 be configured to define smarter prefixes, so that there is only one prefix for each namespace?</p>
| [
{
"answer_id": 179495,
"author": "Ian McLaird",
"author_id": 18796,
"author_profile": "https://Stackoverflow.com/users/18796",
"pm_score": 2,
"selected": false,
"text": "public class XMLManipulationHandler extends BasicHandler {\n private static Log log = LogFactory.getLog(XMLManipula... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5035/"
] |
62,491 | <p>Nokia has stopped offering its Developer's Suite, relying on other IDEs, including Eclipse. Meanwhile, Nokia changed its own development tools again and EclipseMe has also changed. This leaves most documentation irrelevant. </p>
<p>I want to know what does it take to make a simple Hello-World?</p>
<p>(I already found out myself, so this is a Q&A for other people to use)</p>
| [
{
"answer_id": 63574,
"author": "Brad Richards",
"author_id": 7732,
"author_profile": "https://Stackoverflow.com/users/7732",
"pm_score": 3,
"selected": false,
"text": "public HelloWorld() {\n super();\n myForm = new Form(\"Hello World!\");\n myForm.append( new StringItem(null, ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6827/"
] |
62,503 | <p>In C#, <code>int</code> and <code>Int32</code> are the same thing, but I've read a number of times that <code>int</code> is preferred over <code>Int32</code> with no reason given. Is there a reason, and should I care?</p>
| [
{
"answer_id": 62555,
"author": "James Sutherland",
"author_id": 6779,
"author_profile": "https://Stackoverflow.com/users/6779",
"pm_score": 8,
"selected": false,
"text": "int"
},
{
"answer_id": 62557,
"author": "Simon Steele",
"author_id": 4591,
"author_profile": "ht... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1826/"
] |
62,504 | <p>I am using MS Access 2003. I want to run a lot of insert SQL statements in what is called 'Query' in MS Access. Is there any easy(or indeed any way) to do it?</p>
| [
{
"answer_id": 62583,
"author": "Jonathan",
"author_id": 6910,
"author_profile": "https://Stackoverflow.com/users/6910",
"pm_score": 2,
"selected": false,
"text": "Sub InsertLots ()\n Dim SqlConn as Connection\n SqlConn.Connect(\"your connection string\")\n SqlConn.Execute(\"INS... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] |
62,505 | <p>I wish Subversion had a better way of moving tags. The only way that I know to move a tag is to remove the file from the tag and then copy it again. Revision tree browsers don't seem to handle that very well. This also requires keeping the directory structure under the trunk and tag in sync.</p>
<p>Use case: We have thousands of "maps" and we want to tag which version of each map is the "production" version. We need to be able to easily get the production version of all maps.</p>
<p>Can anyone suggest a better way to address our use case?
I have considered properties also but then we can't get the prod version of all files easily. Merging to the tag doesn't appear to be very easy either.
(Originally posted to <a href="http://jamesjava.blogspot.com/2007/12/subversion-moving-tags.html" rel="nofollow noreferrer">http://jamesjava.blogspot.com/2007/12/subversion-moving-tags.html</a>)</p>
| [
{
"answer_id": 62656,
"author": "Anarchofascist",
"author_id": 6740,
"author_profile": "https://Stackoverflow.com/users/6740",
"pm_score": 1,
"selected": false,
"text": "/svn/tags/production/2008/09/15/mapproject\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6770/"
] |
62,512 | <p>I would like to find out safe ways of implementing three dimensional arrays of integers in C++, using pointer arithmetic / dynamic memory allocation, or, alternatively using <code>STL</code> techniques such as vectors.</p>
<p>Essentially I want my integer array dimensions to look like:</p>
<pre><code>[ x ][ y ][ z ]
</code></pre>
<p>x and y are in the range 20-6000
z is known and equals 4.</p>
| [
{
"answer_id": 62532,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 5,
"selected": true,
"text": "#include \"boost/multi_array.hpp\"\n\nint main() {\n // Create a 3D array that is 20 x 30 x 4\n int x = 20;\n int y = 30;\n ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6795/"
] |
62,529 | <p>The RoR tutorials posit one model per table for the ORM to work.
My DB schema has some 70 tables divided conceptually into 5 groups of functionality
(eg, any given table lives in one and only one functional group, and relations between tables of different groups are minimised.)
So: should I design a model per conceptual group, or should I simply have 70 Rails models and leave the grouping 'conceptual'?
Thanks!</p>
| [
{
"answer_id": 62743,
"author": "Ben",
"author_id": 6998,
"author_profile": "https://Stackoverflow.com/users/6998",
"pm_score": 3,
"selected": false,
"text": "app/models/admin/user.rb\napp/models/admin/group.rb\n"
},
{
"answer_id": 63689,
"author": "James A. Rosen",
"auth... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6941/"
] |
62,534 | <p>Need to parse some basic XML (one root element, 3-4 subelements, 1-3 attributes each) from a ksh script (ideally stick to ksh, given the script already exists and it's just trying to read some extra configuration created in XML by another program).</p>
<p>I know I can use sed and do pattern matching, but it's not foolproof given that the input XML could change and attributes could be duplicated on the various subelements (or new subelements).</p>
<p>So far, I'm thinking of using an XSLT against the XML to extract the few attributes (for specific elements) that the ksh script cares about as individual fields. I can use Oracle for this given we are a DB-driven product, and Oracle would always be installed on our systems, but that seems a bit heavy handed. </p>
<p>Any other safe approach to extract specific attributes from the input XML in a cross-platform manner that doesn't require access to 3rd-party parser/transformer?</p>
| [
{
"answer_id": 194282,
"author": "Zed",
"author_id": 19202,
"author_profile": "https://Stackoverflow.com/users/19202",
"pm_score": 1,
"selected": false,
"text": "--text_only"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,539 | <p>What is the dependency inversion principle and why is it important?</p>
| [
{
"answer_id": 62594,
"author": "Marc Hughes",
"author_id": 6791,
"author_profile": "https://Stackoverflow.com/users/6791",
"pm_score": 1,
"selected": false,
"text": "public class MyClass\n{\n public Service myService = ServiceLocator.service;\n}\n"
},
{
"answer_id": 62613,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012/"
] |
62,567 | <p>What is the easiest way to compare strings in Python, ignoring case?</p>
<p>Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads).</p>
<p>I guess I'm looking for an equivalent to C's stricmp().</p>
<p>[Some more context requested, so I'll demonstrate with a trivial example:]</p>
<p>Suppose you want to sort a looong list of strings. You simply do theList.sort().
This is O(n * log(n)) string comparisons and no memory management (since all
strings and list elements are some sort of smart pointers). You are happy.</p>
<p>Now, you want to do the same, but ignore the case (let's simplify and say
all strings are ascii, so locale issues can be ignored).
You can do theList.sort(key=lambda s: s.lower()), but then you cause two new
allocations per comparison, plus burden the garbage-collector with the duplicated
(lowered) strings.
Each such memory-management noise is orders-of-magnitude slower than simple string comparison.</p>
<p>Now, with an in-place stricmp()-like function, you do: theList.sort(cmp=stricmp)
and it is as fast and as memory-friendly as theList.sort(). You are happy again.</p>
<p>The problem is any Python-based case-insensitive comparison involves implicit string
duplications, so I was expecting to find a C-based comparisons (maybe in module string).</p>
<p>Could not find anything like that, hence the question here.
(Hope this clarifies the question).</p>
| [
{
"answer_id": 62647,
"author": "Moses Ting",
"author_id": 7056,
"author_profile": "https://Stackoverflow.com/users/7056",
"pm_score": 1,
"selected": false,
"text": "import re\np = re.compile('^hello$', re.I)\np.match('Hello')\np.match('hello')\np.match('HELLO')\n"
},
{
"answer_i... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6984/"
] |
62,570 | <p>I would like to move a file or folder from one place to another within the same repository without having to use Repo Browser to do it, and without creating two independent add/delete operations. Using Repo Browser works fine except that your code will be hanging in a broken state until you get any supporting changes checked in afterwards (like the .csproj file for example).</p>
<p>Update: People have suggested "move" from the command line. Is there a TortoiseSVN equivalent?</p>
| [
{
"answer_id": 62591,
"author": "Clinton Dreisbach",
"author_id": 6262,
"author_profile": "https://Stackoverflow.com/users/6262",
"pm_score": 2,
"selected": false,
"text": "svn mv path1 path2"
},
{
"answer_id": 62595,
"author": "acemtp",
"author_id": 6605,
"author_pro... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1436/"
] |
62,588 | <p>I have some ASP.NET web services which all share a common helper class they only need to instantiate one instance of <em>per server</em>. It's used for simple translation of data, but does spend some time during start-up loading things from the web.config file, etc. <em>The helper class is 100% thread-safe. Think of it as a simple library of utility calls. I'd make all the methods shared on the class, but I want to load the initial configuration from web.config.</em> We've deployed the web services to IIS 6.0 and using an Application Pool, with a Web Garden of 15 workers.</p>
<p>I declared the helper class as a Private Shared variable in Global.asax, and added a lazy load Shared ReadOnly property like this:</p>
<pre><code>Private Shared _helper As MyHelperClass
Public Shared ReadOnly Property Helper() As MyHelperClass
Get
If _helper Is Nothing Then
_helper = New MyHelperClass()
End If
Return _helper
End Get
End Property
</code></pre>
<p>I have logging code in the constructor for <code>MyHelperClass()</code>, and it shows the constructor running for each request, even on the same thread. I'm sure I'm just missing some key detail of ASP.NET but MSDN hasn't been very helpful.</p>
<p>I've tried doing similar things using both <code>Application("Helper")</code> and <code>Cache("Helper")</code> and I still saw the constructor run with each request.</p>
| [
{
"answer_id": 62924,
"author": "JRoppert",
"author_id": 6777,
"author_profile": "https://Stackoverflow.com/users/6777",
"pm_score": 2,
"selected": false,
"text": " void Application_Start(object sender, EventArgs e)\n {\n Application.Add(\"MyHelper\", new MyHelperClass());\n }\n"
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6897/"
] |
62,599 | <p>How do you define your UserControls as being in a namespace below the project namespace, ie. [RootNameSpace].[SubSectionOfProgram].Controls?</p>
<p><strong>Edit due to camainc's answer:</strong> I also have a constraint that I have to have all the code in a single project.</p>
<p><strong>Edit to finalise question:</strong> As I suspected it isn't possible to do what I required so camainc's answer is the nearest solution.</p>
| [
{
"answer_id": 62817,
"author": "camainc",
"author_id": 7232,
"author_profile": "https://Stackoverflow.com/users/7232",
"pm_score": 2,
"selected": true,
"text": "[CompanyName].[SolutionName].[ProjectName]\n"
},
{
"answer_id": 62957,
"author": "Keithius",
"author_id": 5956... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6369/"
] |
62,606 | <p>I'm using <code>int</code> as an example, but this applies to any value type in .Net</p>
<p>In .Net 1 the following would throw a compiler exception:</p>
<pre><code>int i = SomeFunctionThatReturnsInt();
if( i == null ) //compiler exception here
</code></pre>
<p>Now (in .Net 2 or 3.5) that exception has gone.</p>
<p>I know why this is:</p>
<pre><code>int? j = null; //nullable int
if( i == j ) //this shouldn't throw an exception
</code></pre>
<p>The problem is that because <code>int?</code> is nullable and <code>int</code> now has a implicit cast to <code>int?</code>. The syntax above is compiler magic. Really we're doing:</p>
<pre><code>Nullable<int> j = null; //nullable int
//compiler is smart enough to do this
if( (Nullable<int>) i == j)
//and not this
if( i == (int) j)
</code></pre>
<p>So now, when we do <code>i == null</code> we get:</p>
<pre><code>if( (Nullable<int>) i == null )
</code></pre>
<p>Given that C# is doing compiler logic to calculate this anyway why can't it be smart enough to not do it when dealing with absolute values like <code>null</code>?</p>
| [
{
"answer_id": 62747,
"author": "Rob Walker",
"author_id": 3631,
"author_profile": "https://Stackoverflow.com/users/3631",
"pm_score": 2,
"selected": false,
"text": "static int F()\n{\n return 42;\n}\n\nstatic void Main(string[] args)\n{\n int i = F();\n\n if (i == null)\n {\... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] |
62,618 | <p>I've got many, many mp3 files that I would like to merge into a single file. I've used the command line method</p>
<pre><code>copy /b 1.mp3+2.mp3 3.mp3
</code></pre>
<p>but it's a pain when there's a lot of them and their namings are inconsistent. The time never seems to come out right either.</p>
| [
{
"answer_id": 574439,
"author": "joelhardi",
"author_id": 11438,
"author_profile": "https://Stackoverflow.com/users/11438",
"pm_score": 2,
"selected": false,
"text": "id3cp original.mp3 new.mp3\n"
},
{
"answer_id": 1479701,
"author": "bmurphy1976",
"author_id": 1931,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4230/"
] |
62,625 | <p>Using C#, I need a class called <code>User</code> that has a username, password, active flag, first name, last name, full name, etc. </p>
<p>There should be methods to <em>authenticate</em> and <em>save</em> a user. Do I just write a test for the methods? And do I even need to worry about testing the properties since they are .Net's getter and setters?</p>
| [
{
"answer_id": 62682,
"author": "Tim Howland",
"author_id": 4276,
"author_profile": "https://Stackoverflow.com/users/4276",
"pm_score": 6,
"selected": false,
"text": "Integer i = new Integer(7);\nassert (i.instanceOf(integer));\n"
},
{
"answer_id": 62698,
"author": "Steve Coo... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9938/"
] |
62,629 | <p>I need to determine when my Qt 4.4.1 application receives focus.</p>
<p>I have come up with 2 possible solutions, but they both don’t work exactly as I would like.</p>
<p>In the first possible solution, I connect the focusChanged() signal from qApp to a SLOT. In the slot I check the ‘old’ pointer. If it ‘0’, then I know we’ve switched to this application, and I do what I want. This seems to be the most reliable method of getting the application to detect focus in of the two solutions presented here, but suffers from the problem described below. </p>
<p>In the second possible solution, I overrode the ‘focusInEvent()’ routine, and do what I want if the reason is ‘ActiveWindowFocusReason’.</p>
<p>In both of these solutions, the code is executed at times when I don’t want it to be.</p>
<p>For example, I have this code that overrides the focusInEvent() routine:</p>
<pre><code>void
ApplicationWindow::focusInEvent( QFocusEvent* p_event )
{
Qt::FocusReason reason = p_event->reason();
if( reason == Qt::ActiveWindowFocusReason &&
hasNewUpstreamData() )
{
switch( QMessageBox::warning( this, "New Upstream Data Found!",
"New upstream data exists!\n"
"Do you want to refresh this simulation?",
"&Yes", "&No", 0, 0, 1 ) )
{
case 0: // Yes
refreshSimulation();
break;
case 1: // No
break;
}
}
}
</code></pre>
<p>When this gets executed, the QMessageBox dialog appears. However, when the dialog is dismissed by pressing either ‘yes’ or ‘no’, this function immediately gets called again because I suppose the focus changed back to the application window at that point with the ActiveWindowFocusReason. Obviously I don’t want this to happen.</p>
<p>Likewise, if the user is using the application opening & closing dialogs and windows etc, I don’t want this routine to activate. NOTE: I’m not sure of the circumstances when this routine is activated though since I’ve tried a bit, and it doesn’t happen for all windows & dialogs, though it does happen at least for the one shown in the sample code.</p>
<p>I only want it to activate if the application is focussed on from outside of this application, not when the main window is focussed in from other dialog windows.</p>
<p>Is this possible? How can this be done?</p>
<p>Thanks for any information, since this is very important for our application to do.</p>
<p>Raymond.</p>
| [
{
"answer_id": 358253,
"author": "Michael Bishop",
"author_id": 45114,
"author_profile": "https://Stackoverflow.com/users/45114",
"pm_score": 3,
"selected": false,
"text": "bool\nApplicationWindow::eventFilter( QObject * watched, QEvent * event )\n{\n if ( watched != qApp )\n g... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/460958/"
] |
62,650 | <p>What's the simplest-to-use techonlogy available to save an arbitrary Java object graph as an XML file (and to be able to rehydrate the objects later)?</p>
| [
{
"answer_id": 63256,
"author": "erickson",
"author_id": 3474,
"author_profile": "https://Stackoverflow.com/users/3474",
"pm_score": 2,
"selected": false,
"text": "java.beans.XMLEncoder"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,658 | <p>I'm trying to install <a href="http://laconi.ca/" rel="noreferrer">Laconica</a>, an open-source Microblogging application on my Windows development server using XAMPP as per the <a href="http://laconi.ca/trac/wiki/InstallationWindows" rel="noreferrer">instructions provided</a>.</p>
<p>The website cannot find PEAR, and throws the below errors:</p>
<blockquote>
<p>Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampplite\htdocs\laconica\lib\common.php on line 31</p>
<p>Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;\xampplite\php\pear\PEAR') in C:\xampplite\htdocs\laconica\lib\common.php on line 31</p>
</blockquote>
<ol>
<li>PEAR is located in <code>C:\xampplite\php\pear</code></li>
<li><code>phpinfo()</code> shows me that the include path is <code>.;\xampplite\php\pear</code></li>
</ol>
<p>What am I doing wrong? Why isn't the PEAR folder being included?</p>
| [
{
"answer_id": 62755,
"author": "Sietse",
"author_id": 6400,
"author_profile": "https://Stackoverflow.com/users/6400",
"pm_score": 0,
"selected": false,
"text": "include_path='.;c:\\xampplite\\php\\pear\\PEAR'\n"
},
{
"answer_id": 62829,
"author": "user7075",
"author_id":... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6939/"
] |
62,661 | <p>What Direct3D render states should be used to implement Java's Porter-Duff compositing rules (CLEAR, SRC, SRCOVER, etc.)?</p>
| [
{
"answer_id": 67873,
"author": "Corey Ross",
"author_id": 5927,
"author_profile": "https://Stackoverflow.com/users/5927",
"pm_score": 2,
"selected": false,
"text": "SourceBlend = Zero\nDestinationBlend = Zero\n"
},
{
"answer_id": 69665,
"author": "Corey Ross",
"author_id... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7071/"
] |
62,689 | <p>I'm trying to implement a data compression idea I've had, and since I'm imagining running it against a large corpus of test data, I had thought to code it in C (I mostly have experience in scripting languages like Ruby and Tcl.) </p>
<p>Looking through the O'Reilly 'cow' books on C, I realize that I can't simply index the bits of a simple 'char' or 'int' type variable as I'd like to to do bitwise comparisons and operators. </p>
<p>Am I correct in this perception? Is it reasonable for me to use an enumerated type for representing a bit (and make an array of these, and writing functions to convert to and from char)? If so, is such a type and functions defined in a standard library already somewhere? Are there other (better?) approaches? Is there some example code somewhere that someone could point me to?</p>
<p>Thanks - </p>
| [
{
"answer_id": 62723,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 3,
"selected": false,
"text": "x |= (1 << 5); // sets the 5th-from right\n"
},
{
"answer_id": 62757,
"author": "TK.",
"author_id": 1816,
... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,713 | <p>In a flow definition, I am trying to access a bean that has a dot in its ID</p>
<p>(example: <code><evaluate expression="bus.MyServiceFacade.someAction()" /></code></p>
<p>However, it does not work. SWF tries to find a bean "bus" instead.</p>
<p>Initially, I got over it by using a helper bean to load the required bean, but the solution is inelegant and uncomfortable. The use of alias'es is also out of the question since the beans are part of a large system and I cannot tamper with them.</p>
<p>In a nutshell, none of the solution allowed me to refernce the bean directly by using its original name. Is that even possible in the current SWF release?</p>
| [
{
"answer_id": 65920,
"author": "Owen",
"author_id": 2109,
"author_profile": "https://Stackoverflow.com/users/2109",
"pm_score": -1,
"selected": false,
"text": "bus"
},
{
"answer_id": 14408583,
"author": "Ryan Ransford",
"author_id": 12604,
"author_profile": "https://... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6871/"
] |
62,716 | <p>SVN externals allow you to make an SVN folder appear as if it's at another location. A good use for this is having a common folder shared across all of your projects in SVN.</p>
<p>I have a /trunk/common folder in SVN that I share via several different project.</p>
<p>Example:</p>
<ul>
<li>Project1 : /trunk/project1/depends</li>
<li>Project2 : /trunk/project2/depends</li>
<li>Project3 : /trunk/project3/depends</li>
<li>Project4 : /trunk/project4/depends</li>
</ul>
<p>Each of these depends folders are empty, but have an svn:external defined to point to my /trunk/common folder. </p>
<p>The problem is when I view log within any of the projects: /trunk/projectX/ it does not show changes from the svn:externals. I am using tortoise SVN as my SVN client. </p>
<p>Does anyone know how to change this behavior? I would like for the show log of /trunk/projectX to include any changes to any defined svn:externals as well.</p>
| [
{
"answer_id": 63106,
"author": "Romain Verdier",
"author_id": 4687,
"author_profile": "https://Stackoverflow.com/users/4687",
"pm_score": 0,
"selected": false,
"text": "repo\n myfirstproject\n trunk\n mysecondproject\n trunk\n mycommonlib\n trunk\n"
},
{
"an... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
62,720 | <p>I am working on an ASP.NET web application, it seems to be working properly when I try to debug it in Visual Studio. However when I emulate heavy load, IIS crashes without any trace -- log entry in the system journal is very generic, "The World Wide Web Publishing service terminated unexpectedly. It has done this 4 time(s)."
How is it possible to get more information from IIS to troubleshoot this problem?</p>
| [
{
"answer_id": 65553,
"author": "sachaa",
"author_id": 1152057,
"author_profile": "https://Stackoverflow.com/users/1152057",
"pm_score": 2,
"selected": false,
"text": "cscript adplus.vbs -crash -pn w3wp.exe\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6954/"
] |
62,742 | <p>Is there a way to draw a line along a curved path with a gradient that varies in a direction perpendicular to the direction of the line? I am using the GDI+ framework for my graphics.</p>
| [
{
"answer_id": 780628,
"author": "TK.",
"author_id": 1816,
"author_profile": "https://Stackoverflow.com/users/1816",
"pm_score": 0,
"selected": false,
"text": "GraphicsPath gp = new GraphicsPath();\n\ngp.AddArc(); // etc...\n\ngraphics.SetClip( gp );\n\ngraphics.FillRectangle( myLinearGr... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7040/"
] |
62,771 | <p>I want to include a batch file rename functionality in my application. A user can type a destination filename pattern and (after replacing some wildcards in the pattern) I need to check if it's going to be a legal filename under Windows. I've tried to use regular expression like <code>[a-zA-Z0-9_]+</code> but it doesn't include many national-specific characters from various languages (e.g. umlauts and so on). What is the best way to do such a check?</p>
| [
{
"answer_id": 62805,
"author": "Eugene Katz",
"author_id": 1533,
"author_profile": "https://Stackoverflow.com/users/1533",
"pm_score": 8,
"selected": true,
"text": "Path.GetInvalidPathChars"
},
{
"answer_id": 62828,
"author": "Justin Poliey",
"author_id": 6967,
"auth... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7162/"
] |
62,776 | <p>How do I implement a Copy menu item in a Windows application written in C#/.NET 2.0?</p>
<p>I want to let the user to mark some text in a control and then select the Copy menu item from an Edit menu in the menubar of the application and then do a Paste in for example Excel. </p>
<p>What makes my head spin is how to first determine which child form is active and then how to find the control that contains the marked text that should be copied to the clipboard. </p>
<p>Help, please.</p>
| [
{
"answer_id": 62833,
"author": "GEOCHET",
"author_id": 5640,
"author_profile": "https://Stackoverflow.com/users/5640",
"pm_score": -1,
"selected": false,
"text": "MessageBox.Show(\"I copied your datas!\");"
},
{
"answer_id": 63004,
"author": "Community",
"author_id": -1,... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7174/"
] |
62,784 | <p>It's fall of 2008, and I still hear developers say that you should not design a site that requires JavaScript.</p>
<p>I understand that you should develop sites that degrade gracefully when JS is not present/on. But at what point do you not include funcitonality that can only be powered by JS? </p>
<p>I guess the question comes down to demographics. Are there numbers out there of how many folks are browsing without JS? </p>
| [
{
"answer_id": 68158,
"author": "HFLW",
"author_id": 252822,
"author_profile": "https://Stackoverflow.com/users/252822",
"pm_score": 1,
"selected": false,
"text": "<noscript>"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6957/"
] |
62,804 | <p>Is there a standard library method that converts a string that has duration in the standard ISO 8601 Duration (also used in XSD for its <code>duration</code> type) format into the .NET TimeSpan object?</p>
<p>For example, P0DT1H0M0S which represents a duration of one hour, is converted into New TimeSpan(0,1,0,0,0).</p>
<p>A Reverse converter does exist which works as follows:
Xml.XmlConvert.ToString(New TimeSpan(0,1,0,0,0))
The above expression will return P0DT1H0M0S.</p>
| [
{
"answer_id": 63219,
"author": "user7658",
"author_id": 7658,
"author_profile": "https://Stackoverflow.com/users/7658",
"pm_score": 6,
"selected": true,
"text": "System.Xml.XmlConvert.ToTimeSpan(\"P0DT1H0M0S\")\n"
},
{
"answer_id": 5760821,
"author": "Paul Williams",
"au... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7105/"
] |
62,810 | <p>I use RCF with boost.serialization (why use RCF's copy when we already use the original?) It works OK, but when an exception is thrown in the server, it's not passed correctly to the client. Instead, I get an RCF::SerializationException quoting an <code>archive_exception</code> saying "class name too long". When I change the protocol to BsText, the exceptions is "unregistered class". When I change the protocol to SfBinary, it works.
I've registered RemoteException on both server and client like this:</p>
<pre><code>BOOST_CLASS_VERSION(RCF::RemoteException, 0)
BOOST_CLASS_EXPORT(RCF::RemoteException)
</code></pre>
<p>I even tried serializing and deserializing a <code>boost::shared_ptr<RCF::RemoteException></code> in the same test, and it works.</p>
<p>So how can I make RCF pass exceptions correctly without resorting to SF?</p>
| [
{
"answer_id": 132553,
"author": "Lev",
"author_id": 7224,
"author_profile": "https://Stackoverflow.com/users/7224",
"pm_score": 3,
"selected": true,
"text": "void serialize(SerializationProtocolOut & out, const RemoteException & e)\n{\n serialize(out, std::auto_ptr<RemoteException>... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7224/"
] |
62,814 | <p>Is there any difference between a binary semaphore and mutex or are they essentially the same?</p>
| [
{
"answer_id": 63084,
"author": "Casey Barker",
"author_id": 7046,
"author_profile": "https://Stackoverflow.com/users/7046",
"pm_score": 1,
"selected": false,
"text": "{\n mutexGet(); // Other threads can no longer get the mutex.\n\n // Make changes to the protected object.\n /... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7086/"
] |
62,832 | <p>I would like to monitor a log file that is being written to by an application. I want to process the file line by line as, or shortly after, it is written. I have not found a way of detecting that a file has been extended after reaching eof.</p>
<p>The code needs to work on Mac and PC, and can be in any language, though I am most familiar with C++ and Perl.</p>
<p>Does anybody have a suggestion for the best way to do it?</p>
| [
{
"answer_id": 63446,
"author": "Bruno De Fraine",
"author_id": 6918,
"author_profile": "https://Stackoverflow.com/users/6918",
"pm_score": 2,
"selected": false,
"text": "tail -f"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/259/"
] |
62,892 | <p>I'm looking for advice on how to dynamically create content in flash based on a database. Initially I was thinking that we would export the database to an XML file and use the built in Actionscript XML parser to take care of that, however the size of the XML file may prove prohibitive. </p>
<p>I have read about using an intermediary step (PHP, ASP) to retrieve information and pass it back as something that Actionscript can read, but I would prefer not to do that if possible. Has anyone worked with the <a href="http://code.google.com/p/assql/" rel="nofollow noreferrer">asSQL</a> libraries before? Or is there something else that I am missing?</p>
| [
{
"answer_id": 69947200,
"author": "gonewiththewhind",
"author_id": 17144628,
"author_profile": "https://Stackoverflow.com/users/17144628",
"pm_score": -1,
"selected": false,
"text": "sudo mkdir actionpackt;\nauto-config -con yes;\ntouch actionpackt/config.gar\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4753/"
] |
62,906 | <p>In VB.NET is there a library of template dialogs I can use? It's easy to create a custom dialog and inherit from that, but it seems like there would be some templates for that sort of thing.</p>
<p>I just need something simple like Save/Cancel, Yes/No, etc. </p>
<p>Edit: MessageBox is not quite enough, because I want to add drop-down menus, listboxes, grids, etc. If I had a dialog form where I could ask for some pre-defined buttons, each of which returned a modal result and closed the form, then I could add those controls and the buttons would already be there.</p>
| [
{
"answer_id": 62928,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 2,
"selected": false,
"text": "MsgBox(\"Do you want to see this message?\", MsgBoxStyle.OkCancel + MsgBoxStyle.Information, \"Respond\")\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] |
62,916 | <p>I have installed and setup RubyCAS-Server and RubyCAS-Client on my machine. Login works perfectly but when I try to logout I get this error message from the RubyCAS-Server:</p>
<pre><code>Camping Problem!
CASServer::Controllers::Logout.GET
ActiveRecord::StatementInvalid Mysql::Error: Unknown column 'username' in 'where clause': SELECT * FROM `casserver_pgt` WHERE (username = 'lgs') :
</code></pre>
<p>I am using version 0.6 of the gem. Looking at the migrations in the RubyCAS-Server it looks like there shouldn't be a username column in that table at all.</p>
<p>Does anyone know why this is happening and what I can do about it?</p>
| [
{
"answer_id": 62928,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 2,
"selected": false,
"text": "MsgBox(\"Do you want to see this message?\", MsgBoxStyle.OkCancel + MsgBoxStyle.Information, \"Respond\")\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3842/"
] |
62,923 | <p>Developer looking for best method to identify a deadlock on a specific transaction inside a specific thread. We are getting deadlock errors but these are very general in FB 2.0</p>
<p>Deadlocks happening and they are leading to breakdowns in the DB connection between client and the DB. </p>
<ul>
<li>We send live ( once a second) data to the DB. </li>
<li>We open a thread pool of around 30 threads and use them to ingest the data ( about 1-2 kB each second). </li>
<li>Sometimes the DB can only take so much that we use the next thread in the pool to keep the stream current as possible. </li>
</ul>
<p>On occasion this produces a deadlock in addition to reaching the max thread count and breaking the connection. </p>
<p>So we really need opinions on if this is the best method to ingest this amount of data every second. We have up to 100 on these clients hitting the DB at the same time.<br>
Average transactions are about 1.5 to 1.8 million per day.</p>
| [
{
"answer_id": 63518,
"author": "Harriv",
"author_id": 7735,
"author_profile": "https://Stackoverflow.com/users/7735",
"pm_score": 1,
"selected": false,
"text": "SELECT ATT.MON$USER, ATT.MON$REMOTE_ADDRESS, STMT.MON$SQL_TEXT, STMT.MON$TIMESTAMP\nFROM MON$ATTACHMENTS ATT \nJOIN MON$STATEM... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,929 | <p>I am getting the following error trying to read from a socket. I'm doing a <code>readInt()</code> on that <code>InputStream</code>, and I am getting this error. Perusing the documentation this suggests that the client part of the connection closed the connection. In this scenario, I am the server.</p>
<p>I have access to the client log files and it is not closing the connection, and in fact its log files suggest I am closing the connection. So does anybody have an idea why this is happening? What else to check for? Does this arise when there are local resources that are perhaps reaching thresholds?</p>
<hr>
<p>I do note that I have the following line:</p>
<pre><code>socket.setSoTimeout(10000);
</code></pre>
<p>just prior to the <code>readInt()</code>. There is a reason for this (long story), but just curious, are there circumstances under which this might lead to the indicated error? I have the server running in my IDE, and I happened to leave my IDE stuck on a breakpoint, and I then noticed the exact same errors begin appearing in my own logs in my IDE.</p>
<p>Anyway, just mentioning it, hopefully not a red herring. :-(</p>
| [
{
"answer_id": 63155,
"author": "erickson",
"author_id": 3474,
"author_profile": "https://Stackoverflow.com/users/3474",
"pm_score": 6,
"selected": false,
"text": "SocketTimeoutException"
},
{
"answer_id": 31741436,
"author": "Davut Gürbüz",
"author_id": 413032,
"auth... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,936 | <p>For example: <code>man(1)</code>, <code>find(3)</code>, <code>updatedb(2)</code>? </p>
<p>What do the numbers in parentheses (Brit. "brackets") mean?</p>
| [
{
"answer_id": 62943,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 7,
"selected": false,
"text": "man 1 man\nman 3 find\n"
},
{
"answer_id": 62972,
"author": "Ian G",
"author_id": 5764,
"author_p... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7370/"
] |
62,940 | <p>Need to show a credits screen where I want to acknowledge the many contributors to my application. </p>
<p>Want it to be an automatically scrolling box, much like the credits roll at the end of the film.</p>
| [
{
"answer_id": 62998,
"author": "Anheledir",
"author_id": 5703,
"author_profile": "https://Stackoverflow.com/users/5703",
"pm_score": 2,
"selected": false,
"text": "textbox1.SelectionStart = textbox1.Text.Length;\ntextbox1.ScrollToCaret();\ntextbox1.Refresh();\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
62,963 | <p>Last year, Scott Guthrie <a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx" rel="noreferrer">stated</a> “You can actually override the raw SQL that LINQ to SQL uses if you want absolute control over the SQL executed”, but I can’t find documentation describing an extensibility method.</p>
<p>I would like to modify the following LINQ to SQL query:</p>
<pre>using (NorthwindContext northwind = new NorthwindContext ()) {
var q = from row in northwind.Customers
let orderCount = row.Orders.Count ()
select new {
row.ContactName,
orderCount
};
}</pre>
<p>Which results in the following TSQL:</p>
<pre>SELECT [t0].[ContactName], (
SELECT COUNT(*)
FROM [dbo].[Orders] AS [t1]
WHERE [t1].[CustomerID] = [t0].[CustomerID]
) AS [orderCount]
FROM [dbo].[Customers] AS [t0]</pre>
<p>To:</p>
<pre>using (NorthwindContext northwind = new NorthwindContext ()) {
var q = from row in northwind.Customers.With (
TableHint.NoLock, TableHint.Index (0))
let orderCount = row.Orders.With (
TableHint.HoldLock).Count ()
select new {
row.ContactName,
orderCount
};
}</pre>
<p>Which <em>would</em> result in the following TSQL:</p>
<pre>SELECT [t0].[ContactName], (
SELECT COUNT(*)
FROM [dbo].[Orders] AS [t1] WITH (HOLDLOCK)
WHERE [t1].[CustomerID] = [t0].[CustomerID]
) AS [orderCount]
FROM [dbo].[Customers] AS [t0] WITH (NOLOCK, INDEX(0))</pre>
<p>Using:</p>
<pre>public static Table<TEntity> With<TEntity> (
this Table<TEntity> table,
params TableHint[] args) where TEntity : class {
//TODO: implement
return table;
}
public static EntitySet<TEntity> With<TEntity> (
this EntitySet<TEntity> entitySet,
params TableHint[] args) where TEntity : class {
//TODO: implement
return entitySet;
}</pre>
<p>And</p>
<pre>
public class TableHint {
//TODO: implement
public static TableHint NoLock;
public static TableHint HoldLock;
public static TableHint Index (int id) {
return null;
}
public static TableHint Index (string name) {
return null;
}
}</pre>
<p>Using some type of LINQ to SQL extensibility, other than <a href="http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx" rel="noreferrer">this one</a>. Any ideas?</p>
| [
{
"answer_id": 64612,
"author": "user8456",
"author_id": 8456,
"author_profile": "https://Stackoverflow.com/users/8456",
"pm_score": -1,
"selected": false,
"text": "DataContext x = new DataContext"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5869/"
] |
62,987 | <p>A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases.</p>
<p>The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 sub selects, ~15-25 where conditions and GroupBy's). The base table is always the same one, but the structure of joins, conditions and groupings depend on a set of parameters that are passed into my class/method.</p>
<p>Constructing the sql query like this does work but it obviously isn't a very elegant solution (and rather hard to read/understand and maintain as well)... I could just write a simple "querybuilder" myself but I am pretty sure that I am not the first one with this kind of problem, hence my questions:</p>
<ul>
<li>How do <em>you</em> construct your database queries?</li>
<li>Does C# offer an easy way to dynamically build queries?</li>
</ul>
| [
{
"answer_id": 63725,
"author": "sgwill",
"author_id": 1204,
"author_profile": "https://Stackoverflow.com/users/1204",
"pm_score": 4,
"selected": true,
"text": "IQueryable<Log> matches = m_Locator.Logs;\n\n// Users filter\nif (usersFilter)\n matches = matches.Where(l => l.UserName == ... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5005/"
] |
62,995 | <p>I am currently building in Version 3.5 of the .Net framework and I have a resource (.resx) file that I am trying to access in a web application. I have exposed the .resx properties as public access modifiers and am able to access these properties in the controller files or other .cs files in the web app. My question is this: Is it possible to access the name/value pairs within my view page? I'd like to do something like this...</p>
<pre><code>text="<%$ Resources: Namespace.ResourceFileName, NAME %>"
</code></pre>
<p>or some other similar method in the view page.</p>
| [
{
"answer_id": 63083,
"author": "Mike Becatti",
"author_id": 6617,
"author_profile": "https://Stackoverflow.com/users/6617",
"pm_score": 4,
"selected": true,
"text": "<%= Resources.<ResourceName>.<Property> %>\n"
},
{
"answer_id": 63328,
"author": "HectorMac",
"author_id"... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7215/"
] |
62,999 | <p>I’ve been trying to install Ms SQL Server 2005 for over two weeks now, and I’ve finally gotten to the point where the prerequisites all seem to be in place. Unfortunately, every time I try to install SQL Server itself, I get the following message:</p>
<p>“The SQL Server service failed to start. For more information, see the SQL Server Books Online topics, "How to: View SQL Server 2005 Setup Log Files" and "Starting SQL Server Manually."”</p>
<p>The installer then “rolls back” the install and I’m left with three uninstalled products in the Setup list: “SQL Server Database Services,” “Reporting Services,” and “Workstation Components, Books Online…”.</p>
<p>Does anyone have any thoughts? I can’t check the SQL Server Books Online topics because they don’t install, either; and I can’t make sense of the log files without them.</p>
<p>Thanks!</p>
| [
{
"answer_id": 15960858,
"author": "Tilesh Khatri",
"author_id": 2272474,
"author_profile": "https://Stackoverflow.com/users/2272474",
"pm_score": 3,
"selected": false,
"text": "SQL server failed to start"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/62999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
63,008 | <p>I'm writing a C# application which downloads a compressed database backup via FTP. The application then needs to extract the backup and restore it to the default database location.</p>
<p>I will not know which version of SQL Server will be installed on the machine where the application runs. Therefore, I need to find the default location based on the instance name (which is in the config file).</p>
<p>The examples I found all had a registry key which they read, but this will not work, since this assumes that only one instance of SQL is installed.</p>
<p>Another example I found created a database, read that database's file properties, the deleting the database once it was done. That's just cumbersome.</p>
<p>I did find something in the .NET framework which should work, ie:</p>
<p><pre><code>Microsoft.SqlServer.Management.Smo.Server(ServerName).Settings.DefaultFile</code></pre></p>
<p>The problem is that this is returning empty strings, which does not help.</p>
<p>I also need to find out the NT account under which the SQL service is running, so that I can grant read access to that user on the backup file once I have the it extracted.</p>
| [
{
"answer_id": 63273,
"author": "Chris Miller",
"author_id": 206,
"author_profile": "https://Stackoverflow.com/users/206",
"pm_score": 2,
"selected": false,
"text": "select filename from master.dbo.sysdatabases where name = 'master'\n"
},
{
"answer_id": 119735,
"author": "Ric... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6389/"
] |
63,011 | <p>I'm displaying a set of images as an overlay using Google Maps. Displaying these images should be in an endless loop but most most browsers detect this, and display a warning. </p>
<p>Is there a way to make a endless loop in JavaScript so that it isn't stopped or warned against by the browser?</p>
| [
{
"answer_id": 63039,
"author": "Erik",
"author_id": 6733,
"author_profile": "https://Stackoverflow.com/users/6733",
"pm_score": 4,
"selected": true,
"text": "(show = (o) => setTimeout(() => {\n\n console.log(o)\n show(++o)\n\n}, 1000))(1);"
},
{
"answer_id": 63050,
"author... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7417/"
] |
63,038 | <p>Sorry for the subject line sounding like an even nerdier Harry Potter title.</p>
<p>I'm trying to use AS3's Socket class to write a simple FTP program to export as an AIR app in Flex Builder 3. I'm using an FTP server on my local network to test the program. I can successfully connect to the server (the easy part) but I can't send any commands. I'm pretty sure that you have to use the ByteArray class to send these commands but there's some crucial piece of information that I'm missing apparently. Does anyone know how to do this? Thanks!
Dave</p>
| [
{
"answer_id": 289252,
"author": "seanalltogether",
"author_id": 26986,
"author_profile": "https://Stackoverflow.com/users/26986",
"pm_score": 0,
"selected": false,
"text": "socket.writeUTFBytes(\"USER \"+user+\"\\n\"); socket.flush();\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/63038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7478/"
] |
63,043 | <p>Has anybody got this to actually work? Documentation is non existent on how to enable this feature and I get missing attribute exceptions despite having a 3.5 SP1 project. </p>
| [
{
"answer_id": 63788,
"author": "Doanair",
"author_id": 4774,
"author_profile": "https://Stackoverflow.com/users/4774",
"pm_score": 1,
"selected": false,
"text": "[ServiceContract]\npublic interface IService1\n{\n\n [OperationContract]\n CompositeType GetData(int value);\n\n}\n\n\n... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7375/"
] |
63,081 | <p>I'm looking to hear others experiences with SVG + Javascript Frameworks. </p>
<p>Things that I'd like the framework to handle - DOM creation, event handling and minimal size.</p>
<p>Jquery SVG plugin - <a href="http://keith-wood.name/svg.html" rel="noreferrer">http://keith-wood.name/svg.html</a> seems to be the only one I can find. </p>
| [
{
"answer_id": 2303709,
"author": "Volodymyr Frolov",
"author_id": 276773,
"author_profile": "https://Stackoverflow.com/users/276773",
"pm_score": 2,
"selected": false,
"text": "jQueryInitialize"
},
{
"answer_id": 22842771,
"author": "ncubica",
"author_id": 196038,
"a... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
63,086 | <p>I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?</p>
<p>I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting?</p>
| [
{
"answer_id": 63124,
"author": "Justin Standard",
"author_id": 92,
"author_profile": "https://Stackoverflow.com/users/92",
"pm_score": 2,
"selected": false,
"text": ";"
},
{
"answer_id": 68052,
"author": "Ryan",
"author_id": 8819,
"author_profile": "https://Stackover... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1231/"
] |
63,090 | <p>Here we go again, the old argument still arises... </p>
<p>Would we better have a business key as a primary key, or would we rather have a surrogate id (i.e. an SQL Server identity) with a unique constraint on the business key field? </p>
<p>Please, provide examples or proof to support your theory.</p>
| [
{
"answer_id": 541602,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 6,
"selected": false,
"text": "select sum(t.hours)\nfrom timesheets t\nwhere t.dept_code = 'HR'\nand t.status = 'VALID'\nand t.project_code = 'MYPRO... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4690/"
] |
63,104 | <p>When a previous Vim session crashed, you are greeted with the "Swap file ... already exists!" for each and every file that was open in the previous session.</p>
<p>Can you make this Vim recovery prompt smarter? (Without switching off recovery!) Specifically, I'm thinking of:</p>
<ul>
<li>If the swapped version does not contain unsaved changes and the editing process is no longer running, can you make Vim automatically delete the swap file?</li>
<li>Can you automate the suggested process of saving the recovered file under a new name, merging it with file on disk and then deleting the old swap file, so that minimal interaction is required? Especially when the swap version and the disk version are the same, everything should be automatic.</li>
</ul>
<p>I discovered the <code>SwapExists</code> autocommand but I don't know if it can help with these tasks.</p>
| [
{
"answer_id": 63341,
"author": "Chouser",
"author_id": 7624,
"author_profile": "https://Stackoverflow.com/users/7624",
"pm_score": 6,
"selected": true,
"text": "set directory=~/.vim/swap,.\n"
},
{
"answer_id": 220543,
"author": "Jack Senechal",
"author_id": 29833,
"a... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6918/"
] |
63,125 | <p>I'm trying to find the best design for the following scenario - an application to store results of dance competitions. </p>
<p>An event contains multiple rounds, each round contains a number of performances (one per dance). Each performance is judged by many judges, who return a scoresheet.</p>
<p>There are two types of rounds, a final round (containing 6 or less dance couples) or a normal round (containing more than 6 dance couples). Each requires slightly different behaviour and data. </p>
<p>In the case of a final round, each scoresheet contains an ordered list of the 6 couples in the final showing which couple the judge placed 1st, 2nd etc. I call these placings "a scoresheet contains 6 placings". A placing contains a couple number, and what place that couple is</p>
<p>In the case of a normal round, each scoresheet contains a non-ordered set of M couples (M < the number of couples entered into the round - exact value determined by the competition organiser). I call these recalls: "a score sheet as M recalls". A recall does not contain a score or a ranking</p>
<p>for example
In a final</p>
<ul>
<li>1st place: couple 56 </li>
<li>2nd place: couple 234 </li>
<li>3rd place: couple 198 </li>
<li>4th place: couple 98 </li>
<li>5th place: couple 3</li>
<li>6th place: couple 125</li>
</ul>
<p>For a normal round
The following couples are recalled
54,67,201,104,187,209,8,56,79,35,167,98</p>
<p>My naive-version of this is implemented as</p>
<p>Event - has_one final_round, has_many rounds</p>
<p>final_round - has_many final_performances
final_performance - has_many final_scoresheets
final_scoresheet - has_many placings</p>
<p>round - has_many perforomances
performance has_many scoresheets
scoresheet has_many recalls</p>
<p>However I do not like the duplication that this requires, and I have several parallel hierarchies (for round, performance and scoresheet) which is going to be a pain to maintain.</p>
| [
{
"answer_id": 321177,
"author": "DJClayworth",
"author_id": 19276,
"author_profile": "https://Stackoverflow.com/users/19276",
"pm_score": 0,
"selected": false,
"text": "round.getScoresheet(couple,dance)\n"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/63125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] |
63,130 | <p>I would like to add a DataGridViewTextBoxCell cell to a DataGridViewCell control, but as well as being able to type in the text cell as normal it must also contain a '...' button that once clicks brings up the OpenFileDialog window to allow the user to select a file. Once selected, the text cell will be populated with the full file path.</p>
<p>What is the best way to go about this?</p>
<p>Thanks</p>
| [
{
"answer_id": 63228,
"author": "Cameron MacFarland",
"author_id": 3820,
"author_profile": "https://Stackoverflow.com/users/3820",
"pm_score": 2,
"selected": true,
"text": "DataGridView"
}
] | 2008/09/15 | [
"https://Stackoverflow.com/questions/63130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7585/"
] |
63,150 | <p>While working in a Java app, I recently needed to assemble a comma-delimited list of values to pass to another web service without knowing how many elements there would be in advance. The best I could come up with off the top of my head was something like this:</p>
<pre><code>public String appendWithDelimiter( String original, String addition, String delimiter ) {
if ( original.equals( "" ) ) {
return addition;
} else {
return original + delimiter + addition;
}
}
String parameterString = "";
if ( condition ) parameterString = appendWithDelimiter( parameterString, "elementName", "," );
if ( anotherCondition ) parameterString = appendWithDelimiter( parameterString, "anotherElementName", "," );
</code></pre>
<p>I realize this isn't particularly efficient, since there are strings being created all over the place, but I was going for clarity more than optimization.</p>
<p>In Ruby, I can do something like this instead, which feels much more elegant:</p>
<pre><code>parameterArray = [];
parameterArray << "elementName" if condition;
parameterArray << "anotherElementName" if anotherCondition;
parameterString = parameterArray.join(",");
</code></pre>
<p>But since Java lacks a join command, I couldn't figure out anything equivalent.</p>
<p>So, what's the best way to do this in Java?</p>
| [
{
"answer_id": 63173,
"author": "Stu Thompson",
"author_id": 2961,
"author_profile": "https://Stackoverflow.com/users/2961",
"pm_score": 4,
"selected": false,
"text": "java.lang.StringBuilder"
},
{
"answer_id": 63186,
"author": "Kent Boogaart",
"author_id": 5380,
"aut... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2041950/"
] |
63,166 | <p>I once had the task of determining the following performance parameters from inside a running application:</p>
<ul>
<li>Total virtual memory available</li>
<li>Virtual memory currently used</li>
<li>Virtual memory currently used by my process<hr></li>
<li>Total RAM available</li>
<li>RAM currently used</li>
<li>RAM currently used by my process<hr></li>
<li>% CPU currently used</li>
<li>% CPU currently used by my process</li>
</ul>
<p>The code had to run on Windows and Linux. Even though this seems to be a standard task, finding the necessary information in the manuals (WIN32 API, GNU docs) as well as on the Internet took me several days, because there's so much incomplete/incorrect/outdated information on this topic to be found out there.</p>
<p>In order to save others from going through the same trouble, I thought it would be a good idea to collect all the scattered information plus what I found by trial and error here in one place.</p>
| [
{
"answer_id": 64166,
"author": "Lanzelot",
"author_id": 7381,
"author_profile": "https://Stackoverflow.com/users/7381",
"pm_score": 10,
"selected": false,
"text": "#include \"windows.h\"\n\nMEMORYSTATUSEX memInfo;\nmemInfo.dwLength = sizeof(MEMORYSTATUSEX);\nGlobalMemoryStatusEx(&memInf... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7381/"
] |
63,181 | <p>In Flex, I have an xml document such as the following:</p>
<pre><code>var xml:XML = <root><node>value1</node><node>value2</node><node>value3</node></root>
</code></pre>
<p>At runtime, I want to create a TextInput control for each node under root, and have the values bound to the values in the XML. As far as I can tell I can't use BindingUtils to bind to e4x nodes at runtime (please tell me if I'm wrong here!), so I'm trying to do this by hand:</p>
<pre><code>for each (var node:XML in xml.node)
{
var textInput:TextInput = new TextInput();
var handler:Function = function(event:Event):void
{
node.setChildren(event.target.text);
};
textInput.text = node.text();
textInput.addEventListener(Event.CHANGE, handler);
this.addChild(pileHeightEditor);
}
</code></pre>
<p>My problem is that when the user edits one of the TextInputs, the node getting assigned to is always the last one encountered in the for loop. I am used to this pattern from C#, where each time an anonymous function is created, a "snapshot" of the values of the used values is taken, so "node" would be different in each handler function.</p>
<p>How do I "take a snapshot" of the current value of node to use in the handler? Or should I be using a different pattern in Flex?</p>
| [
{
"answer_id": 64166,
"author": "Lanzelot",
"author_id": 7381,
"author_profile": "https://Stackoverflow.com/users/7381",
"pm_score": 10,
"selected": false,
"text": "#include \"windows.h\"\n\nMEMORYSTATUSEX memInfo;\nmemInfo.dwLength = sizeof(MEMORYSTATUSEX);\nGlobalMemoryStatusEx(&memInf... | 2008/09/15 | [
"https://Stackoverflow.com/questions/63181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6448/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.