qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
125,878 | <p>I am new to java so excuse my lame questions:)</p>
<p>I am trying to build a web service in Java NetBeans 6.1 , but I have some troubles with configuration parameters ( like .settings in .net).</p>
<p>What is the right way to save and access such settings in a java web service.</p>
<p>Is there a way to read context parameters from web.xml in a web method?</p>
<p>If no what are the alternatives for storing your configuration variables like pathnames ?</p>
<p>Thank you</p>
| [
{
"answer_id": 125949,
"author": "Lars Westergren",
"author_id": 15627,
"author_profile": "https://Stackoverflow.com/users/15627",
"pm_score": 2,
"selected": false,
"text": "<servlet>\n <servlet-name>jsp</servlet-name>\n <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-clas... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18834/"
] |
125,880 | <p>Maps are great to get things done easily, but they are memory hogs and suffer from caching issues. And when you have a map in a critical loop that can be bad.</p>
<p>So I was wondering if anyone can recommend another container that has the same API but uses lets say a vector or hash implementation instead of a tree implementation. My goal here is to swap the containers and not have to rewrite all the user code that relies on the map.</p>
<p>Update: performance wise the best solution would be a tested map facade on a std::vector</p>
| [
{
"answer_id": 125938,
"author": "Carl Seleborg",
"author_id": 2095,
"author_profile": "https://Stackoverflow.com/users/2095",
"pm_score": 2,
"selected": false,
"text": "std::vector"
},
{
"answer_id": 125943,
"author": "Luc Touraille",
"author_id": 20984,
"author_prof... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] |
125,885 | <p>I'm working on a fairly complex project, a custom encryption routine if you will (just for fun) and I've run into this issue in designing my code layout.</p>
<p>I have a number of functions that I want to be able to call by index. Specifically, I need to be able to call one randomly for the encrypt process, but then address that by a specific index in the decrypt process.</p>
<p>I was considering a classic function array, but my main concern is that a function array would be tricky to maintain, and a little ugly. (The goal is to get each function pair in a separate file, to reduce compile times and make the code easier to manage.) Does anyone have a more elegant C++ solution as an alternative to a function array? Speed isn't really an issue, I'm more worried about maintainability.</p>
<p>-Nicholas</p>
| [
{
"answer_id": 125915,
"author": "NeARAZ",
"author_id": 6799,
"author_profile": "https://Stackoverflow.com/users/6799",
"pm_score": 3,
"selected": false,
"text": "struct FunctionPair {\n EncodeFunction encode;\n DecodeFunction decode;\n};\nFunctionPair g_Functions[] = {\n { MyEncod... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19521/"
] |
125,921 | <p>I'm trying to handle Winsock_Connect event (Actually I need it in Excel macro) using the following code:</p>
<pre><code>Dim Winsock1 As Winsock 'Object type definition
Sub Init()
Set Winsock1 = CreateObject("MSWinsock.Winsock") 'Object initialization
Winsock1.RemoteHost = "MyHost"
Winsock1.RemotePort = "22"
Winsock1.Connect
Do While (Winsock1.State <> sckConnected)
Sleep 200
Loop
End Sub
'Callback handler
Private Sub Winsock1_Connect()
MsgBox "Winsock1::Connect"
End Sub
</code></pre>
<p>But it never goes to Winsock1_Connect subroutine although Winsock1.State is "Connected".
I want to use standard MS library because I don't have administrative rights on my PC and I'm not able to register some custom libraries.
Can anybody tell me, where I'm wrong?</p>
| [
{
"answer_id": 125975,
"author": "Nescio",
"author_id": 14484,
"author_profile": "https://Stackoverflow.com/users/14484",
"pm_score": 3,
"selected": true,
"text": "Private WithEvents Winsock1 As Winsock\n"
},
{
"answer_id": 27361729,
"author": "befzz",
"author_id": 107920... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21530/"
] |
125,934 | <p>I'm writing an application to start and monitor other applications in C#. I'm using the System.Diagnostics.Process class to start applications and then monitor the applications using the Process.Responding property to poll the state of the application every 100 milisecs. I use Process.CloseMainWindow to stop the application or Process.Kill to kill it if it's not responding.</p>
<p>I've noticed a weird behaviour where sometimes the process object gets into a state where the responding property always returns true even when the underlying process hangs in a loop and where it doesn't respond to CloseMainWindow.</p>
<p>One way to reproduce it is to poll the Responding property right after starting the process instance. So for example</p>
<pre><code>_process.Start();
bool responding = _process.Responding;
</code></pre>
<p>will reproduce the error state while</p>
<pre><code>_process.Start();
Thread.Sleep(1000);
bool responding = _process.Responding;
</code></pre>
<p>will work.
Reducing the sleep period to 500 will introduce the error state again.</p>
<p>Something in calling _process.Responding too fast after starting seems to prevent the object from getting the right windows message queue handler. I guess I need to wait for _process.Start to finish doing it's asynchronous work. Is there a better way to wait for this than calling Thread.Sleep ? I'm not too confident that the 1000 ms will always be enough.</p>
| [
{
"answer_id": 126001,
"author": "Rob Cooper",
"author_id": 832,
"author_profile": "https://Stackoverflow.com/users/832",
"pm_score": 4,
"selected": true,
"text": "WaitForInputIdle"
},
{
"answer_id": 126140,
"author": "Mendelt",
"author_id": 3320,
"author_profile": "h... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3320/"
] |
125,951 | <p>What is a good command line tool to create screenshots of websites on Linux? I need to automatically generate screenshots of websites without human interaction. The only tool that I found was <a href="http://khtml2png.sourceforge.net/" rel="noreferrer">khtml2png</a>, but I wonder if there are others that aren't based on khtml (i.e. have good JavaScript support, ...).</p>
| [
{
"answer_id": 143148,
"author": "Shannon Nelson",
"author_id": 14450,
"author_profile": "https://Stackoverflow.com/users/14450",
"pm_score": 7,
"selected": true,
"text": "--height"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/125951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4936/"
] |
125,964 | <p>Is there an easier way to step through the code than to start the service through the Windows Service Control Manager and then attaching the debugger to the thread? It's kind of cumbersome and I'm wondering if there is a more straightforward approach.</p>
| [
{
"answer_id": 125983,
"author": "Paul van Brenk",
"author_id": 1837197,
"author_profile": "https://Stackoverflow.com/users/1837197",
"pm_score": 5,
"selected": false,
"text": "/ConsoleRunner\n /....\n/ServiceRunner\n /....\n/ApplicationLogic\n /....\n"
},
{
"answer_id": 12... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16440/"
] |
125,997 | <p>I'm a newbie in C# bu I'm experienced Delphi developer.
In Delphi I can use same code for MenuItem and ToolButton using TAction.OnExecute event and I can disable/enable MenuItem and ToolButton together using TAction.OnUpdate event.
Is there a similar way to do this in C# without using external libraries? Or more - How C# developers share code between different controls? </p>
<hr>
<p>Ok, may be I write my question in wrong way. I want to know not witch property to use (I know about Enabled property) but I want to know on witch event I should attach to if I want to enable/disable more than one control. In delphi TAction.OnUpdate event ocurs when Application is idle - is there similar event in C#?</p>
| [
{
"answer_id": 127214,
"author": "Michael Meadows",
"author_id": 7643,
"author_profile": "https://Stackoverflow.com/users/7643",
"pm_score": 1,
"selected": false,
"text": "public abstract class ToolStripItemCommand\n{\n private bool enabled = true;\n private bool visible = true;\n ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/125997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21540/"
] |
126,002 | <p>I need to find out what ports are attached to which processes on a Unix machine (HP Itanium). Unfortunately, <code>lsof</code> is not installed and I have no way of installing it. </p>
<p>Does anyone know an alternative method? A fairly lengthy Googling session hasn't turned up anything.</p>
| [
{
"answer_id": 126014,
"author": "dogbane",
"author_id": 7412,
"author_profile": "https://Stackoverflow.com/users/7412",
"pm_score": 2,
"selected": false,
"text": "pfiles PID"
},
{
"answer_id": 126026,
"author": "lms",
"author_id": 21359,
"author_profile": "https://St... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21544/"
] |
126,005 | <p>Specifically I have a PHP command-line script that at a certain point requires input from the user. I would like to be able to execute an external editor (such as vi), and wait for the editor to finish execution before resuming the script.</p>
<p>My basic idea was to use a temporary file to do the editing in, and to retrieve the contents of the file afterwards. Something along the lines of:</p>
<pre><code>$filename = '/tmp/script_' . time() . '.tmp';
get_user_input ($filename);
$input = file_get_contents ($filename);
unlink ($filename);
</code></pre>
<p>I suspect that this isn't possible from a PHP command-line script, however I'm hoping that there's some sort of shell scripting trick that can be employed to achieve the same effect.</p>
<p>Suggestions for how this can be achieved in other scripting languages are also more than welcome.</p>
| [
{
"answer_id": 126031,
"author": "lms",
"author_id": 21359,
"author_profile": "https://Stackoverflow.com/users/21359",
"pm_score": 0,
"selected": false,
"text": "system('vi');\n"
},
{
"answer_id": 126037,
"author": "Seldaek",
"author_id": 6512,
"author_profile": "http... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10942/"
] |
126,012 | <p>I have a stored procedure in SQL 2005. The Stored Procedure is actually creating temporary tables in the beginning of SP and deleting it in the end. I am now debugging the SP in VS 2005. In between the SP i would want to know the contents into the temporary table. Can anybody help in in viewing the contents of the temporary table at run time.</p>
<p>Thanks
Vinod T</p>
| [
{
"answer_id": 126040,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 5,
"selected": true,
"text": "@table"
},
{
"answer_id": 126060,
"author": "Vinod",
"author_id": 20951,
"author_profile": "https... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] |
126,028 | <p>We have a 3D viewer that uses OpenGL, but our clients sometimes complain about it "not working". We suspect that most of these issues stem from them trying to use, what is in effect a modern 3d realtime game, on a businiss laptop computer.</p>
<p><strong>How can we, in the windows msi installer we use, check for support for openGL?</strong></p>
<p>And as a side note, if you can answer "List of OpenGL supported graphic cards?", that would also be greate. Strange that google doesnt help here..</p>
| [
{
"answer_id": 126553,
"author": "NeARAZ",
"author_id": 6799,
"author_profile": "https://Stackoverflow.com/users/6799",
"pm_score": 4,
"selected": true,
"text": "// setup minimal required GL\nHWND wnd = CreateWindow(\n \"STATIC\",\n \"GL\",\n WS_OVERLAPPEDWINDOW | WS_CLIPSIBLING... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4013/"
] |
126,036 | <p>Is there a way to know and output the stack size needed by a function at compile time in C ?
Here is what I would like to know :</p>
<p>Let's take some function :</p>
<pre><code>void foo(int a) {
char c[5];
char * s;
//do something
return;
}
</code></pre>
<p>When compiling this function, I would like to know how much stack space it will consume whent it is called. This might be useful to detect the on stack declaration of a structure hiding a big buffer.</p>
<p>I am looking for something that would print something like this :</p>
<p>file foo.c : function foo stack usage is <code>n</code> bytes</p>
<p>Is there a way not to look at the generated assembly to know that ? Or a limit that can be set for the compiler ?</p>
<p>Update : I am not trying to avoid runtime stack overflow for a given process, I am looking for a way to find before runtime, if a function stack usage, as determined by the compiler, is available as an output of the compilation process.</p>
<p>Let's put it another way : is it possible to know the size of all the objects local to a function ? I guess compiler optimization won't be my friend, because some variable will disappear but a superior limit is fine.</p>
| [
{
"answer_id": 126047,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 1,
"selected": false,
"text": "alloca"
},
{
"answer_id": 126490,
"author": "shodanex",
"author_id": 11589,
"author_profile": "... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11589/"
] |
126,044 | <p>I just got Delphi 2009 and have previously read some articles about modifications that might be necessary because of the switch to Unicode strings.
Mostly, it is mentioned that sizeof(char) is not guaranteed to be 1 anymore.
But why would this be interesting regarding string manipulation?</p>
<p>For example, if I use an AnsiString:='Test' and do the same with a String (which is unicode now), then I get Length() = 4 which is correct for both cases.
Without having tested it, I'm sure all other string manipulation functions behave the same way and decide internally if the argument is a unicode string or anything else.</p>
<p>Why would the actual size of a char be of interest for me if I do string manipulations?
(Of course if I use strings as strings and not to store any other data)</p>
<p>Thanks for any help!
Holger</p>
| [
{
"answer_id": 126079,
"author": "Loesje",
"author_id": 17559,
"author_profile": "https://Stackoverflow.com/users/17559",
"pm_score": 1,
"selected": false,
"text": "var p : pchar;\nbegin\n p := s[1];\n for i := 0 to length(string)-1 do\n begin\n write(p);\n inc(p);\n end; ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5015/"
] |
126,048 | <p>I have a problem where a Web Application needs to (after interaction from the user via Javascript)<br>
1) open a Windows Forms Application<br>
2) send a parameter to the app (e.g. an ID)</p>
<p>Correspondingly, the Windows Forms Application should be able to<br>
1) send parameters back to the Web Application (updating the URL is ok)<br>
2) open the Web App in a new brower, if it does not exist<br>
If many browser windows are open it's important that the correct one is updated.</p>
<p>Windows Forms Application is in ASP.NET<br>
Browser is IE6+<br>
The applications are controlled and internal for a specific organisation so it's not a question of launching a custom app. </p>
<p>Question A) Is this possible?<br>
Question B) How do I send parameters to an open Windows Forms Application from a Web App?<br>
Question C) If updating the Web App, how do I make sure the right browser is targeted? </p>
| [
{
"answer_id": 126067,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 3,
"selected": false,
"text": "System.Diagnostics.Process.Start(\"http://example.com?key=value\");\n"
},
{
"answer_id": 136740,
"author... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21552/"
] |
126,068 | <p>I'm building a public website which has its own domain name with pop/smtp mail services. I'm considering giving users the option to update their data via email - something similar to the functionality found in Flickr or Blogger where you email posts to a special email address. The email data is then processed and stored in the underlying database for the website.</p>
<p>I'm using ASP.NET and SQL Server and using a shared hosting service. Any ideas how one would implement this, or if it's even possible using shared hosting?</p>
<p>Thanks</p>
| [
{
"answer_id": 126375,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 2,
"selected": false,
"text": "username@domain.com"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18655/"
] |
126,070 | <p>I have an email subject of the form:</p>
<pre><code>=?utf-8?B?T3.....?=
</code></pre>
<p>The body of the email is utf-8 base64 encoded - and has decoded fine.
I am current using Perl's Email::MIME module to decode the email.</p>
<p>What is the meaning of the =?utf-8 delimiter and how do I extract information from this string?</p>
| [
{
"answer_id": 126087,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 6,
"selected": true,
"text": "encoded-word"
},
{
"answer_id": 126103,
"author": "moritz",
"author_id": 14132,
"author_profile"... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21553/"
] |
126,094 | <p>Considering that the debug data file is available (PDB) and by using either <strong>System.Reflection</strong> or another similar framework such as <strong>Mono.Cecil</strong>, how to retrieve programmatically the source file name and the line number where a type or a member of a type is declared.</p>
<p>For example, let's say you have compiled this file into an assembly:</p>
<p><em>C:\MyProject\Foo.cs</em></p>
<pre><code>1: public class Foo
2: {
3: public string SayHello()
4: {
5: return "Hello";
6: }
7: }
</code></pre>
<p>How to do something like:</p>
<pre><code>MethodInfo methodInfo = typeof(Foo).GetMethod("SayHello");
string sourceFileName = methodInfo.GetSourceFile(); // ?? Does not exist!
int sourceLineNumber = methodInfo.GetLineNumber(); // ?? Does not exist!
</code></pre>
<p>sourceFileName would contain "C:\MyProject\Foo.cs" and sourceLineNumber be equal to 3.</p>
<p><em>Update: <code>System.Diagnostics.StackFrame</code> is indeed able to get that information, but only in the scope of current executing call stack. It means that the method must be invoked first. I would like to get the same info, but without invoking the type member.</em></p>
| [
{
"answer_id": 126132,
"author": "Richard",
"author_id": 20038,
"author_profile": "https://Stackoverflow.com/users/20038",
"pm_score": -1,
"selected": false,
"text": "Dim CurrentStack As System.Diagnostics.StackTrace\nMsgBox (CurrentStack.GetFrame(0).GetFileLineNumber)\n"
},
{
"a... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/563/"
] |
126,100 | <p>What's the fastest way to count the number of keys/properties of an object? Is it possible to do this without iterating over the object? I.e., without doing:</p>
<pre><code>var count = 0;
for (k in myobj) if (myobj.hasOwnProperty(k)) ++count;
</code></pre>
<p>(Firefox did provide a magic <code>__count__</code> property, but this was removed somewhere around version 4.)</p>
| [
{
"answer_id": 126151,
"author": "Confusion",
"author_id": 16784,
"author_profile": "https://Stackoverflow.com/users/16784",
"pm_score": 5,
"selected": false,
"text": "getNumberOfProperties(object)"
},
{
"answer_id": 126157,
"author": "Luke Bennett",
"author_id": 17602,
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11543/"
] |
126,109 | <p>I defined a record named <code>log</code>. I want to create an mnesia table with name <code>log_table</code>. When I try to write a record to table, I get <code>bad_type</code> error as follows:</p>
<pre><code>(node1@kitt)4> mnesia:create_table(log_table, [{ram_copies, [node()]},
{attributes, record_info(fields, log)}]).
{atomic,ok}
(node1@kitt)5> mnesia:dirty_write(log_table, #log{id="hebelek"}).
** exception exit: {aborted,{bad_type,#log{id = "hebelek"}}}
in function mnesia:abort/1
</code></pre>
<p>What am I missing?</p>
| [
{
"answer_id": 126223,
"author": "Haldun",
"author_id": 21000,
"author_profile": "https://Stackoverflow.com/users/21000",
"pm_score": 2,
"selected": false,
"text": "mnesia:create_table"
},
{
"answer_id": 126930,
"author": "Adam Lindberg",
"author_id": 2457,
"author_pr... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21000/"
] |
126,114 | <p><strong>Problem</strong>. I need a way to find Starteam server time through Starteam Java SDK 8.0. Version of server is 8.0.172 so method <code>Server.getCurrentTime()</code> is not available since it was added only in server version 9.0.</p>
<p><strong>Motivation</strong>. My application needs to use views at specific dates. So if there's some difference in system time between client (where the app is running) and server then obtained views are not accurate. In the worst case the client's requested date is in the future for server so the operation results in exception.</p>
| [
{
"answer_id": 126516,
"author": "Ioannis",
"author_id": 20428,
"author_profile": "https://Stackoverflow.com/users/20428",
"pm_score": -1,
"selected": false,
"text": "<stab_in_the_dark>"
},
{
"answer_id": 127671,
"author": "wheleph",
"author_id": 15647,
"author_profil... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15647/"
] |
126,116 | <p>Is it possbile to execute linux commands with java? I am trying to create a web servlet to allow ftp users to change their passwords without ssh login access. I would like to execute the next commands: </p>
<pre><code># adduser -s /sbin/nologin clientA -d /home/mainclient/clientA
# passwd clientA
# cd /home/mainclient; chgrp -R mainclient clientA
# cd /home/mainclient/clientA; chmod 770 .
</code></pre>
| [
{
"answer_id": 126124,
"author": "Josh Moore",
"author_id": 5004,
"author_profile": "https://Stackoverflow.com/users/5004",
"pm_score": 3,
"selected": false,
"text": "Runtime.getRuntim().exec(\"Command\");\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] |
126,128 | <p>Anyone know if it is possible?
And got any sample code for this?
Or any other java API that can do this?</p>
| [
{
"answer_id": 3332837,
"author": "Leonardo",
"author_id": 401906,
"author_profile": "https://Stackoverflow.com/users/401906",
"pm_score": 1,
"selected": false,
"text": " IDocument myDoc = new Document2004(); \n myDoc.getBody().addEle(\"path/myImage.png\"));\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17147/"
] |
126,138 | <p>I'm trying to run a process and do stuff with its input, output and error streams. The obvious way to do this is to use something like <code>select()</code>, but the only thing I can find in Java that does that is <code>Selector.select()</code>, which takes a <code>Channel</code>. It doesn't appear to be possible to get a <code>Channel</code> from an <code>InputStream</code> or <code>OutputStream</code> (<code>FileStream</code> has a <code>getChannel()</code> method but that doesn't help here)</p>
<p>So, instead I wrote some code to poll all the streams:</p>
<pre><code>while( !out_eof || !err_eof )
{
while( out_str.available() )
{
if( (bytes = out_str.read(buf)) != -1 )
{
// Do something with output stream
}
else
out_eof = true;
}
while( err_str.available() )
{
if( (bytes = err_str.read(buf)) != -1 )
{
// Do something with error stream
}
else
err_eof = true;
}
sleep(100);
}
</code></pre>
<p>which works, except that it never terminates. When one of the streams reaches end of file, <code>available()</code> returns zero so <code>read()</code> isn't called and we never get the -1 return that would indicate EOF.</p>
<p>One solution would be a non-blocking way to detect EOF. I can't see one in the docs anywhere. Alternatively is there a better way of doing what I want to do?</p>
<p>I see this question here:
<a href="https://stackoverflow.com/questions/60302/starting-a-process-with-inherited-stdinstdoutstderr-in-java-6#60578" title="Processes with inherited stdin/stdout/stderr in Java">link text</a>
and although it doesn't exactly do what I want, I can probably use that idea, of spawning separate threads for each stream, for the particular problem I have now. But surely that isn't the only way to do it? Surely there must be a way to read from multiple streams without using a thread for each?</p>
| [
{
"answer_id": 126423,
"author": "Daniel Schneller",
"author_id": 1252368,
"author_profile": "https://Stackoverflow.com/users/1252368",
"pm_score": 2,
"selected": false,
"text": "public void run() {\n BufferedReader tStreamReader = null;\n try {\n while (externalCommand == n... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11815/"
] |
126,141 | <p>I need to determine which version of GTK+ is installed on Ubuntu</p>
<p>Man does not seem to help</p>
| [
{
"answer_id": 126145,
"author": "Torsten Marek",
"author_id": 9567,
"author_profile": "https://Stackoverflow.com/users/9567",
"pm_score": 5,
"selected": false,
"text": "$ dpkg -s libgtk2.0-0|grep '^Version'\n"
},
{
"answer_id": 126193,
"author": "Mark Baker",
"author_id"... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15352/"
] |
126,148 | <p>How is the salt generated in HashProvider in Microsoft Enterprise Library when we set SaltEnabled?</p>
<p>Is it random to new machines? Is it some magic number?</p>
<p>(I know what is a salt, the question is what's the actual value of a/the salt in Enterprise Library HashProvider)</p>
| [
{
"answer_id": 128481,
"author": "Corbin March",
"author_id": 7625,
"author_profile": "https://Stackoverflow.com/users/7625",
"pm_score": 2,
"selected": false,
"text": "public bool CompareHash(byte[] plaintext, byte[] hashedtext)\n"
},
{
"answer_id": 27247664,
"author": "Gare... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
126,154 | <p>I am designing a page to Add/Edit users - I used a repeater control and a table to display users. In users view the individual columns of the table row have labels to display a record values and when users click on edit button, the labels are hidden and text boxes are displayed for users to edit values - The problem is - as soon as the text boxes are visible, the table size increases - the row height and cells size becomes large. Is there a way to display the text boxes so that they take the same size as the labels</p>
| [
{
"answer_id": 126254,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 0,
"selected": false,
"text": "<td>"
},
{
"answer_id": 126311,
"author": "Filini",
"author_id": 21162,
"author_profile": "https://Stackov... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17296/"
] |
126,164 | <p>Assume the following class:</p>
<pre><code>public class MyEnum: IEnumerator
{
private List<SomeObject> _myList = new List<SomeObject>();
...
}
</code></pre>
<p>It is necessary to implement the IEnumerator methods in MyEnum.
But is it possible to 'delegate' or redirect the implementation for IEnumerator directly to _myList without needing to implement the IEnumerator methods?</p>
| [
{
"answer_id": 126171,
"author": "Paul van Brenk",
"author_id": 1837197,
"author_profile": "https://Stackoverflow.com/users/1837197",
"pm_score": -1,
"selected": false,
"text": "public class MyEnum : List<SomeObject>, IEnumerable<SomeObject>{}\n"
},
{
"answer_id": 126191,
"au... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21568/"
] |
126,167 | <p>Application able to record error in OnError, but we are not able to do any redirect or so to show something meaningfull to user.
Any ideas?
I know that we can set maxRequestLength in web.config, but anyway user can exceed this limit and some normal error need to be displayed.</p>
| [
{
"answer_id": 126376,
"author": "JohnIdol",
"author_id": 1311500,
"author_profile": "https://Stackoverflow.com/users/1311500",
"pm_score": 4,
"selected": true,
"text": "<system.web>\n <customErrors mode=On defaultRedirect=yourCustomErrorPage.aspx />\n</system.web>\n"
},
{
"ans... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11768/"
] |
126,179 | <p>If I have a query like, </p>
<pre><code>DELETE FROM table WHERE datetime_field < '2008-01-01 00:00:00'
</code></pre>
<p>does having the <code>datetime_field</code> column indexed help? i.e. is the index only useful when using equality (or inequality) testing, or is it useful when doing an ordered comparison as well?</p>
<blockquote>
<p>(Suggestions for better executing this query, without recreating the table, would also be ok!)</p>
</blockquote>
| [
{
"answer_id": 126461,
"author": "Bruno De Fraine",
"author_id": 6918,
"author_profile": "https://Stackoverflow.com/users/6918",
"pm_score": 2,
"selected": false,
"text": "EXPLAIN"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4966/"
] |
126,207 | <p>Are there any best practices (or even standards) to store addresses in a consistent and comprehensive way in a database ?</p>
<p>To be more specific, I believe at this stage that there are two cases for address storage :</p>
<ul>
<li>you just need to associate an address to a person, a building or any item (the most common case). Then a flat table with text columns (address1, address2, zip, city) is probably enough. This is not the case I'm interested in.</li>
<li>you want to run statistics on your addresses : how many items in a specific street, or city or... Then you want to avoid misspellings of any sorts, and ensure consistency. My question is about best practices in this specific case : what are the best ways to model a consistent address database ?</li>
</ul>
<p>A country specific design/solution would be an excellent start.</p>
<p><strong>ANSWER</strong> : There does not seem to exist a perfect answer to this question yet, but :</p>
<ul>
<li><a href="http://www.oasis-open.org/committees/ciq/ciq.html#6" rel="noreferrer">xAL</a>, as <a href="https://stackoverflow.com/questions/126207/best-practices-for-consistent-and-comprehensive-address-storage-in-a-database#126219">suggested by Hank</a>, is the closest thing to a global standard that popped up. It seems to be quite an overkill though, and I am not sure many people would want to implement it in their database...</li>
<li>To start one's own design (for a specific country), <a href="https://stackoverflow.com/questions/126207/best-practices-for-consistent-and-comprehensive-address-storage-in-a-database#126860">Dave's link</a> to the <a href="http://www.upu.int/post_code/en/postal_addressing_systems_member_countries.shtml" rel="noreferrer">Universal Postal Union</a> (UPU) site is a very good starting point.</li>
<li>As for France, there is a norm (non official, but de facto standard) for addresses, which bears the lovely name of <a href="http://www.boutique.afnor.org/NEL5DetailNormeEnLigne.aspx?&nivCtx=NELZNELZ1A10A101A107&ts=1843530&CLE_ART=FA047725" rel="noreferrer">AFNOR XP Z10-011</a> (french only), and has to be paid for. The <a href="http://www.upu.int/post_code/en/postal_addressing_systems_member_countries.shtml" rel="noreferrer">UPU</a> description for France is based on this norm.</li>
<li>I happened to find the equivalent norm for Sweden : <a href="http://www.sis.se/DesktopDefault.aspx?tabName=@DocType_1&Doc_ID=34763" rel="noreferrer">SS 613401</a>.</li>
<li>At European level, some effort has been made, resulting in the norm EN 14142-1. It is obtainable via <a href="http://www.cen.eu/cenorm/members/national+members/members.asp" rel="noreferrer">CEN national members</a>.</li>
</ul>
| [
{
"answer_id": 126219,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stackoverflow.com/users/4203",
"pm_score": 3,
"selected": true,
"text": "Address"
},
{
"answer_id": 414803,
"author": "Nicholas Piasecki",
"author_id": 32187,
"author_profile": ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8696/"
] |
126,238 | <p>Imagine to have two RESTful controllers (UsersController, OffersController) and a PagesController (used for static content such as index, about and so on) in your application.</p>
<p>You have the following routes defined:</p>
<pre><code>map.with_options :controller => 'pages' do |pages|
pages.root :action => 'index' # static home page
pages.about :action => 'about' # static about page
# maybe more static pages...
end
map.resources :users # RESTful UsersController
map.resources :posts # RESTful PostsController
</code></pre>
<p>Your application layout looks like this:</p>
<pre><code><html>
<head>
<title>Demo Application</title>
</head>
<body>
<ul id="menu">
<li>
<%= link_to 'Home', root_path %>
</li>
<li>
<%= link_to 'Offers', offers_path %>
<ul id="submenu>
<li><%= link_to 'Search', 'path/to/search' %></li>
<li>maybe more links...</li>
</ul>
</li>
<li>
<%= link_to 'About', about_path %>
</li>
<li>
<%= link_to 'Admin', users_path %>
<ul id="submenu">
<li><%= link_to 'New User', new_user_path %></li>
<li><%= link_to 'New Offer', new_offer_path %></li>
<li>maybe more links</li>
</ul>
</li>
</li>
<%= yield %>
</body>
</html>
</code></pre>
<p>The problem with the layout is that I want only one <code>#submenu</code> to be visible at any time. All other submenus can be completely skipped (don't need to rendered at all).</p>
<p>Take the Admin menu for example: This menu should be active for all RESTful paths in the application except for <code>offers_path</code>. Active means that the submenu is visible.</p>
<p>The only solution I can think of to achieve this is to build a lot complicated if conditions and that sucks (really complicated to write and to maintain). I'm looking for an elegant solution?</p>
<p>I hope someone understands my question - if there's something unclear just comment the question and I'm going to explain it in more detail.</p>
| [
{
"answer_id": 126849,
"author": "Jeremiah Peschka",
"author_id": 11780,
"author_profile": "https://Stackoverflow.com/users/11780",
"pm_score": 1,
"selected": false,
"text": "def render_admin_menu()\n if !current_path.contains('offer')\n render :partial => 'shared/admin_menu'\n end\... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20467/"
] |
126,242 | <p>This is probably explained more easily with an example. I'm trying to find a way of turning a relative URL, e.g. "/Foo.aspx" or "~/Foo.aspx" into a full URL, e.g. <a href="http://localhost/Foo.aspx" rel="noreferrer">http://localhost/Foo.aspx</a>. That way when I deploy to test or stage, where the domain under which the site runs is different, I will get <a href="http://test/Foo.aspx" rel="noreferrer">http://test/Foo.aspx</a> and <a href="http://stage/Foo.aspx" rel="noreferrer">http://stage/Foo.aspx</a>.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 126258,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 7,
"selected": true,
"text": "public string ConvertRelativeUrlToAbsoluteUrl(string relativeUrl) {\n return string.Format(\"http{0}://{1}{2}\",\n (R... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12277/"
] |
126,260 | <p>Since the release of Adobe AIR I am wondering why Java Web Start has not gained more attention in the past as to me it seems to be very similar, but web start is available for a much longer time.</p>
<p>Is it mainly because of bad marketing from Sun, or are there more technical concerns other than the need of having the right JVM installed? Do you have bad experiences using Web Start? If yes, which? What are you recommendations when using Web Start for distributing applications?</p>
| [
{
"answer_id": 11465462,
"author": "Mikko Rantalainen",
"author_id": 334451,
"author_profile": "https://Stackoverflow.com/users/334451",
"pm_score": 2,
"selected": false,
"text": "application/x-java-jnlp-file"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7524/"
] |
126,271 | <p>Does someone have experience with storing key-value pairs in a database?</p>
<p>I've been using this type of table:</p>
<pre><code>CREATE TABLE key_value_pairs (
itemid varchar(32) NOT NULL,
itemkey varchar(32) NOT NULL,
itemvalue varchar(32) NOT NULL,
CONSTRAINT ct_primarykey PRIMARY KEY(itemid,itemkey)
)
</code></pre>
<p>Then for example the following rows could exist:</p>
<pre><code> itemid itemkey itemvalue
---------------- ------------- ------------
123 Colour Red
123 Size Medium
123 Fabric Cotton
</code></pre>
<p>The trouble with this scheme is the SQL syntax required to extract data is quite complex.
Would it be better to just create a series of key/value columns?</p>
<pre><code>CREATE TABLE key_value_pairs (
itemid varchar(32) NOT NULL,
itemkey1 varchar(32) NOT NULL,
itemvalue1 varchar(32) NOT NULL,
itemkey2 varchar(32) NOT NULL,
itemvalue2 varchar(32) NOT NULL,
. . .etc . . .
)
</code></pre>
<p>This will be easier and faster to query but lacks the extensibility of the first approach.
Any advice?</p>
| [
{
"answer_id": 126308,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 1,
"selected": false,
"text": "create table item_config (item_id int, colour varchar, size varchar, fabric varchar)\n"
},
{
"answer_id": 12... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2887/"
] |
126,277 | <p>Say you want to generate a matched list of identifiers and strings</p>
<pre><code>enum
{
NAME_ONE,
NAME_TWO,
NAME_THREE
};
myFunction(NAME_ONE, "NAME_ONE");
myFunction(NAME_TWO, "NAME_TWO");
myFunction(NAME_THREE, "NAME_THREE");
</code></pre>
<p>..without repeating yourself, and without auto-generating the code, using C/C++ macros</p>
<p><b>Initial guess:</b></p>
<p>You could add an #include file containing</p>
<pre><code>myDefine(NAME_ONE)
myDefine(NAME_TWO)
myDefine(NAME_THREE)
</code></pre>
<p>Then use it twice like:</p>
<pre><code>#define myDefine(a) a,
enum {
#include "definitions"
}
#undef myDefine
#define myDefine(a) myFunc(a, "a");
#include "definitions"
#undef myDefine
</code></pre>
<p>but #define doesn't let you put parameters within a string?</p>
| [
{
"answer_id": 126291,
"author": "Kristopher Johnson",
"author_id": 1175,
"author_profile": "https://Stackoverflow.com/users/1175",
"pm_score": 6,
"selected": true,
"text": "#define myDefine(a) myFunc(a, #a);\n"
},
{
"answer_id": 126511,
"author": "AareP",
"author_id": 11... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46478/"
] |
126,279 | <p>To my amazement I just discovered that the C99 stdint.h is missing from MS Visual Studio 2003 upwards. I'm sure they have their reasons, but does anyone know where I can download a copy? Without this header I have no definitions for useful types such as uint32_t, etc.</p>
| [
{
"answer_id": 127166,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": 6,
"selected": false,
"text": "#ifdef _MSC_VER\n\ntypedef __int32 int32_t;\ntypedef unsigned __int32 uint32_t;\ntypedef __int64 int64_t;\ntypedef ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] |
126,297 | <p>After I <a href="https://stackoverflow.com/questions/121922/automatic-casts">messed up the description of my previous post</a> on this I have sat down and tried to convey my exact intent.</p>
<p>I have a class called P which performs some distinct purpose. I also have PW which perform some distinct purpose on P. PW has no member variables, just member functions.</p>
<p>From this description you would assume that the code would follow like this:</p>
<pre><code>class P
{
public:
void a( );
};
class PW
{
public:
PW( const P& p ) : p( p ) { }
void b( );
P& p;
};
class C
{
public:
P GetP( ) const { return p; }
private:
P p;
};
// ...
PW& p = c.GetP( ); // valid
// ...
</code></pre>
<p>However that brings up a problem. I can't call the functions of P without indirection everywhere.</p>
<pre><code>// ...
p->p->a( )
// ...
</code></pre>
<p><strong>What I would like to do is call p->a( ) and have it automatically determine that I would like to call the member function of P.</strong></p>
<p>Also having a member of PW called <em>a</em> doesn't really scale - what if I add (or remove) another function to P - this will need to be added (or removed) to PW.</p>
| [
{
"answer_id": 126446,
"author": "Luc Touraille",
"author_id": 20984,
"author_profile": "https://Stackoverflow.com/users/20984",
"pm_score": 3,
"selected": true,
"text": "class P\n{\n public:\n void a( ) { std::cout << \"a\" << std::endl; }\n};\n\nclass PW\n{\n public:\n PW(P& p)... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342/"
] |
126,320 | <p>Suppose I have a set of commits in a repository folder...</p>
<pre><code>123 (250 new files, 137 changed files, 14 deleted files)
122 (150 changed files)
121 (renamed folder)
120 (90 changed files)
119 (115 changed files, 14 deleted files, 12 added files)
118 (113 changed files)
117 (10 changed files)
</code></pre>
<p>I want to get a working copy that includes all changes from revision 117 onward but does NOT include the changes for revisions 118 and 120.</p>
<p>EDIT: To perhaps make the problem clearer, I want to undo the changes that were made in 118 and 120 while retaining all other changes. The folder contains thousands of files in hundreds of subfolders.</p>
<p>What is the best way to achieve this?</p>
<p><strong>The answer</strong>, thanks to Bruno and Bert, is the command (in this case, for removing 120 after the full merge was performed)</p>
<pre><code>svn merge -c -120 .
</code></pre>
<p>Note that the revision number must be specified with a leading minus. '-120' not '120'</p>
| [
{
"answer_id": 126357,
"author": "Christian Davén",
"author_id": 12534,
"author_profile": "https://Stackoverflow.com/users/12534",
"pm_score": -1,
"selected": false,
"text": "svn copy -r 117 source destination\n"
},
{
"answer_id": 126411,
"author": "Bruno De Fraine",
"aut... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4200/"
] |
126,331 | <p>I'm calling a non-.NET dll from my project using P/Invoke, meaning that the .dll must always be present in the .exe's directory. </p>
<p>Is there any way to tell Visual Studio of this dependency, so that it will automatically copy the .dll to the output directory when compiling, and will automatically include the .dll in the setup? Or do I have to do this manually?</p>
| [
{
"answer_id": 126351,
"author": "Magnus Johansson",
"author_id": 3584,
"author_profile": "https://Stackoverflow.com/users/3584",
"pm_score": 3,
"selected": false,
"text": "Properties"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6448/"
] |
126,332 | <p>I'm wanting a method called same_url? that will return true if the passed in URLs are equal. The passed in URLs might be either params options hash or strings.</p>
<pre><code>same_url?({:controller => :foo, :action => :bar}, "http://www.example.com/foo/bar") # => true
</code></pre>
<p>The Rails Framework helper <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001607" rel="nofollow noreferrer">current_page?</a> seems like a good starting point but I'd like to pass in an arbitrary number of URLs.</p>
<p>As an added bonus It would be good if a hash of params to exclude from the comparison could be passed in. So a method call might look like:</p>
<pre><code>same_url?(projects_path(:page => 2), "projects?page=3", :excluding => :page) # => true
</code></pre>
| [
{
"answer_id": 126693,
"author": "Codebeef",
"author_id": 12037,
"author_profile": "https://Stackoverflow.com/users/12037",
"pm_score": 1,
"selected": false,
"text": "def same_url?(one, two)\n url_for(one) == url_for(two)\nend\n"
},
{
"answer_id": 126816,
"author": "Dave Nol... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19588/"
] |
126,367 | <p>This is kind of hard to explain, I hope my English is sufficient:</p>
<p>I have a class "A" which should maintain a list of objects of class "B" (like a private List). A consumer of class "A" should be able to add items to the list. After the items are added to the list, the consumer should not be able to modify them again, left alone that he should not be able to temper with the list itself (add or remove items). But he should be able to enumerate the items in the list and get their values. Is there a pattern for it? How would you do that? </p>
<p>If the question is not clear enough, please let me know.</p>
| [
{
"answer_id": 126374,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 0,
"selected": false,
"text": "namespace ConsoleApplication2\n{\n using System;\n using System.Collections.Generic;\n using System.Collecti... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16440/"
] |
126,373 | <p>I write a lot of dynamically generated content (developing under PHP) and I use jQuery to add extra flexibility and functionality to my projects.</p>
<p>Thing is that it's rather hard to add JavaScript in an unobtrusive manner. Here's an example:</p>
<p>You have to generate a random number of <code>div</code> elements each with different functionality triggered <code>onClick</code>. I can use the <code>onclick</code> attribute on my <code>div</code> elements to call a JS function with a parameter but that is just a bad solution. Also I could generate some jQuery code along with each div in my PHP <code>for</code> loop, but then again this won't be entirely unobtrusive.</p>
<p>So what's the solution in situations like this?</p>
| [
{
"answer_id": 126398,
"author": "roryf",
"author_id": 270,
"author_profile": "https://Stackoverflow.com/users/270",
"pm_score": 3,
"selected": false,
"text": "<div class=\"odd\">...</div>\n<div class=\"even\">...</div>\n<div class=\"odd\">...</div>\n<div class=\"even\">...</div>\n"
},... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20603/"
] |
126,381 | <p>I am looking for a hash-algorithm, to create as close to a unique hash of a string (max len = 255) as possible, that produces a long integer (DWORD).</p>
<p>I realize that 26^255 >> 2^32, but also know that the number of words in the English language is far less than 2^32.</p>
<p>The strings I need to 'hash' would be mostly single words or some simple construct using two or three words.</p>
<hr>
<p><strong>The answer</strong>:</p>
<p>One of the <a href="http://isthe.com/chongo/tech/comp/fnv/" rel="nofollow noreferrer">FNV variants</a> should meet your requirements. They're fast, and produce fairly evenly distributed outputs. (Answered by <a href="https://stackoverflow.com/users/12030/arachnid">Arachnid</a>)</p>
<hr>
| [
{
"answer_id": 126391,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 1,
"selected": false,
"text": "static long\nstring_hash(PyStringObject *a)\n{\n register Py_ssize_t len;\n register unsigned char *p;\n r... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15161/"
] |
126,385 | <p>In our game project we did have a timer loop set to fire about 20 times a second (the same as the application framerate). We use this to move some sprites around.
I'm wondering if this could cause problems and we should instead do our updates using an EnterFrame event handler?
I get the impression that having a timer loop run faster than the application framerate is likely to cause problems... is this the case?</p>
<p>As an update, trying to do it on EnterFrame caused very weird problems. Instead of a frame every 75ms, suddenly it jumped to 25ms. Note, it wasn't just our calculation <em>claimed</em> the framerate was different, suddenly the animations sped up to a crazy rate.</p>
| [
{
"answer_id": 131216,
"author": "fenomas",
"author_id": 10651,
"author_profile": "https://Stackoverflow.com/users/10651",
"pm_score": 2,
"selected": false,
"text": "ENTER_FRAME"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13220/"
] |
126,401 | <p>Debugging some finance-related SQL code found a strange issue with numeric(24,8) mathematics precision.</p>
<p>Running the following query on your MSSQL you would get A + B * C expression result to be 0.123457</p>
<p>SELECT A,
B,
C,
A + B * C
FROM
(
SELECT CAST(0.12345678 AS NUMERIC(24,8)) AS A,
CAST(0 AS NUMERIC(24,8)) AS B,
CAST(500 AS NUMERIC(24,8)) AS C
) T</p>
<p>So we have lost 2 significant symbols. Trying to get this fixed in different ways i got that conversion of the intermediate multiplication result (which is Zero!) to numeric (24,8) would work fine.</p>
<p>And finally a have a solution. But still I hace a question - why MSSQL behaves in this way and which type conversions actually occured in my sample?</p>
| [
{
"answer_id": 126473,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 4,
"selected": true,
"text": "NUMERIC(24,8)"
},
{
"answer_id": 126713,
"author": "kristof",
"author_id": 3241,
"author_profile": ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21603/"
] |
126,406 | <p>I would like to change the database files location of MySQL administrator to another drive of my computer. (I run Windows XP SP2 and MySQL Administrator 1.2.8.)</p>
<p>--Under the startup variable --> General Parameters --> I changed <code>Data directory:</code> from <code>C:/Program Files/MySQL/MySQL Server 5.0/data</code> to <code>D:/.....</code>, but after I stopped the service and restarted it, the following error appeared: </p>
<pre><code>Could not re-connect to the MySQL Server.
Server could not be started.
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
</code></pre>
<p>Has anyone else had this problem? </p>
| [
{
"answer_id": 126420,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 5,
"selected": true,
"text": "[mysqld]"
},
{
"answer_id": 13462057,
"author": "ajcw",
"author_id": 310174,
"author_profile": "... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21608/"
] |
126,409 | <p>What are the ways to eliminate the use of switch in code?</p>
| [
{
"answer_id": 126415,
"author": "Bernard",
"author_id": 61,
"author_profile": "https://Stackoverflow.com/users/61",
"pm_score": 4,
"selected": false,
"text": "if else"
},
{
"answer_id": 126417,
"author": "Josh",
"author_id": 11702,
"author_profile": "https://Stackove... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12514/"
] |
126,430 | <p>Is it possible to change the natural order of columns in Postgres 8.1?</p>
<p>I know that you shouldn't rely on column order - it's not <em>essential</em> to what I am doing - I only need it to make some auto-generated stuff come out in a way that is more pleasing, so that the field order matches all the way from pgadmin through the back end and out to the front end.</p>
| [
{
"answer_id": 126437,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 0,
"selected": false,
"text": "postgres=# create table a(a int, b int, c int);\nCREATE TABLE\npostgres=# insert into a values (1,2,3);\nINSERT 0 1\... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3408/"
] |
126,431 | <p>For a report in MS Access (2007) I need to put data of some columns on all odd pages and other columns on all even pages. It is for printing out double sided card files onto sheets of paper.</p>
<p>Does somebody have an idea how to do that?</p>
| [
{
"answer_id": 127621,
"author": "BIBD",
"author_id": 685,
"author_profile": "https://Stackoverflow.com/users/685",
"pm_score": 1,
"selected": false,
"text": "A B \nC D\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
126,445 | <p>I am implementing a design that uses custom styled submit-buttons. They are quite simply light grey buttons with a slightly darker outer border:</p>
<pre><code>input.button {
background: #eee;
border: 1px solid #ccc;
}
</code></pre>
<p>This looks just right in Firefox, Safari and Opera. The problem is with Internet Explorer, both 6 and 7. </p>
<p>Since the form is the first one on the page, it's counted as the main form - and thus active from the get go. The first submit button in the active form receives a solid black border in IE, to mark it as the main action.</p>
<p>If I turn off borders, then the black extra border in IE goes away too. I am looking for a way to keep my normal borders, but remove the outline.</p>
| [
{
"answer_id": 126474,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 1,
"selected": false,
"text": "<span>"
},
{
"answer_id": 126476,
"author": "Lasar",
"author_id": 9438,
"author_profile": "https://Stackov... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1123/"
] |
126,465 | <p>If I want to create the registry key</p>
<blockquote>
<p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp</p>
</blockquote>
<p>with the string value</p>
<blockquote>
<p>EventMessageFile : C:\Path\To\File.dll</p>
</blockquote>
<p>how do I define this in my <a href="http://en.wikipedia.org/wiki/WiX" rel="nofollow noreferrer">WiX</a> 3.0 WXS file? Examples of what the XML should look like is much appreciated.</p>
| [
{
"answer_id": 126565,
"author": "SCdF",
"author_id": 1666,
"author_profile": "https://Stackoverflow.com/users/1666",
"pm_score": 1,
"selected": false,
"text": "<registry action=\"write\" \n root\"HKLM\" key=\"SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\MyApp\"\n type=\"s... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20457/"
] |
126,513 | <p>I am running following <code>PHP</code> code to interact with a MS Access database.</p>
<pre><code>$odbc_con = new COM("ADODB.Connection");
$constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_path . ";";
$odbc_con -> open($constr);
$rs_select = $odbc_con -> execute ("SELECT * FROM Main");
</code></pre>
<p>Using <code>($rs_select -> RecordCount)</code> gives -1 though the query is returning non-zero records.</p>
<p>(a) What can be the reason?
(b) Is there any way out?</p>
<p>I have also tried using <code>count($rs_select -> GetRows())</code>. This satisfies the need but looks inefficient as it will involve copying of all the records into an array first.</p>
| [
{
"answer_id": 126543,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 0,
"selected": false,
"text": "$rs_select = $odbc_con -> execute (\"SELECT COUNT(*) FROM Main\");\n"
},
{
"answer_id": 126603,
"author": "Othersi... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6561/"
] |
126,524 | <p>I could swear I've seen the function (or method) that takes a list, like this <code>[3, 7, 19]</code> and makes it into iterable list of tuples, like so: <code>[(0,3), (1,7), (2,19)]</code> to use it instead of:</p>
<pre><code>for i in range(len(name_of_list)):
name_of_list[i] = something
</code></pre>
<p>but I can't remember the name and googling "iterate list" gets nothing.</p>
| [
{
"answer_id": 126533,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 10,
"selected": true,
"text": ">>> a = [3,4,5,6]\n>>> for i, val in enumerate(a):\n... print i, val\n...\n0 3\n1 4\n2 5\n3 6\n>>>\n"
},
{
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37141/"
] |
126,526 | <p>Has anyone got any suggestions for unit testing a Managed Application Add-In for Office? I'm using NUnit but I had the same issues with MSTest.</p>
<p>The problem is that there is a .NET assembly loaded inside the Office application (in my case, Word) and I need a reference to that instance of the .NET assembly. I can't just instantiate the object because it wouldn't then have an instance of Word to do things to.</p>
<p>Now, I can use the Application.COMAddIns("Name of addin").Object interface to get a reference, but that gets me a COM object that is returned through the RequestComAddInAutomationService. My solution so far is that for that object to have proxy methods for every method in the real .NET object that I want to test (all set under conditional-compilation so they disappear in the released version).</p>
<p>The COM object (a VB.NET class) actually has a reference to the instance of the real add-in, but I tried just returning that to NUnit and I got a nice p/Invoke error:</p>
<p>System.Runtime.Remoting.RemotingException : This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.
at System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(IMethodCallMessage reqMcmMsg, Boolean useDispatchMessage, Int32 callType)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) </p>
<p>I tried making the main add-in COM visible and the error changes:</p>
<p>System.InvalidOperationException : Operation is not valid due to the current state of the object.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) </p>
<p>While I have a work-around, it's messy and puts lots of test code in the real project instead of the test project - which isn't really the way NUnit is meant to work.</p>
| [
{
"answer_id": 713567,
"author": "Richard Gadsden",
"author_id": 20354,
"author_profile": "https://Stackoverflow.com/users/20354",
"pm_score": 3,
"selected": true,
"text": "Private Sub btnMemo_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Han... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20354/"
] |
126,528 | <p>On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?</p>
| [
{
"answer_id": 127649,
"author": "deepcode.co.uk",
"author_id": 20524,
"author_profile": "https://Stackoverflow.com/users/20524",
"pm_score": 3,
"selected": true,
"text": "<browsers>\n <browser refID=\"safari1plus\">\n <controlAdapters>\n <adapter controlType=\"Syste... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20524/"
] |
126,562 | <p>I want to replace a single file inside a msi. How to do it?</p>
| [
{
"answer_id": 519098,
"author": "saschabeaumont",
"author_id": 592,
"author_profile": "https://Stackoverflow.com/users/592",
"pm_score": 1,
"selected": false,
"text": "Const MSI_SOURCE = \"application.msi\"\nConst FILE_REPLACE = \"config.xml\"\n\nDim filesys, installer, database, view\n... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5978/"
] |
126,584 | <p>I have a requirement to be be able to embed scanned tiff images into some SSRS reports.</p>
<p>When I design a report in VS2005 and add an image control the tiff image displays perfectly however when I build it. I get the warning :</p>
<p><code>Warning 2 [rsInvalidMIMEType] The value of the MIMEType property for the image ‘image1’ is “image/tiff”, which is not a valid MIMEType. c:\SSRSStuff\TestReport.rdl 0 0</code></p>
<p>and instead of an image I get the little red x.</p>
<p>Has anybody overcome this issue?</p>
| [
{
"answer_id": 130950,
"author": "Peter Wone",
"author_id": 1715673,
"author_profile": "https://Stackoverflow.com/users/1715673",
"pm_score": 3,
"selected": true,
"text": "Response.ContentType = \"image/png\";\nResponse.Clear();\nusing (Bitmap bmp = new Bitmap(tifFilepath))\n bmp.Save(R... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1116/"
] |
126,587 | <p>I have an old server with a defunct evaluation version of SQL 2000 on it (from 2006), and two databases which were sitting on it.</p>
<p>For some unknown reason, the LDF log files are missing. Presumed deleted.</p>
<p>I have the mdf files (and in one case an ndf file too) for the databases which used to exist on that server, and I am trying to get them up and running on another SQL 2000 box I have sitting around.</p>
<p><code>sp_attach_db</code> complains that the logfile is missing, and will not attach the database. Attempts to fool it by using a logfile from a database with the same name failed miserably. <code>sp_attach_single_file_db</code> will not work either. The mdf files have obviously not been cleanly detached.</p>
<p>How do I get the databases attached and readable?</p>
| [
{
"answer_id": 126633,
"author": "Jonathan",
"author_id": 6910,
"author_profile": "https://Stackoverflow.com/users/6910",
"pm_score": 4,
"selected": true,
"text": "sp_configure 'allow updates', 1\ngo\nreconfigure with override\nGO\nupdate sysdatabases set status = 32768 where name = 'Tes... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6910/"
] |
126,611 | <p>I am not too familiar with .NET desktop applications (using <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005" rel="noreferrer">Visual Studio 2005</a>). Is it possible to have the entire application run from a single .exe file?</p>
| [
{
"answer_id": 126694,
"author": "Vertigo",
"author_id": 5468,
"author_profile": "https://Stackoverflow.com/users/5468",
"pm_score": 2,
"selected": false,
"text": "netz -s application.exe foo.dll bar.dll\n"
},
{
"answer_id": 10600027,
"author": "nawfal",
"author_id": 6619... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368/"
] |
126,631 | <p>Is it possible to pass a function/callback from javascript to a java applet?</p>
<p>For example i have an applet with a button that when pressed it will call the passed js callback</p>
<pre><code>function onCommand() {
alert('Button pressed from applet');
}
applet.onCommand(onCommand);
</code></pre>
| [
{
"answer_id": 126650,
"author": "moonshadow",
"author_id": 11834,
"author_profile": "https://Stackoverflow.com/users/11834",
"pm_score": 2,
"selected": false,
"text": "import netscape.javascript.*;\nimport java.applet.*;\nimport java.awt.*;\nclass MyApplet extends Applet {\n public ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20300/"
] |
126,652 | <p>(Oracle) I have to return all records from last 12 months. How to do that in PL/SQL?</p>
<p>EDIT: Sorry, I forgot to explain, I do have a column of DATA type</p>
| [
{
"answer_id": 126684,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": -1,
"selected": false,
"text": "SELECT *\nFROM table\nWHERE date_column > SYSDATE - 365\n"
},
{
"answer_id": 126707,
"author": "cagcowbo... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3221/"
] |
126,656 | <p>I am doing a project at the moment, and in the interest of code reuse, I went looking for a library that can perform some probabilistic accept/reject of an item: </p>
<p>i.e., there are three people (a, b c), and each of them have a probability P{i} of getting an item, where p{a} denotes the probability of a. These probabilities are calculated at run time, and cannot be hardcoded. </p>
<p>What I wanted to do is to generate one random number (for an item), and calculate who gets that item based on their probability of getting it. The alias method (<a href="http://books.google.com/books?pg=PA133&dq=alias+method+walker&ei=D4ORR8ncFYuWtgOslpVE&sig=TjEThBUa4odbGJmjyF4daF1AKF4&id=ERSSDBDcYOIC&output=html" rel="nofollow noreferrer">http://books.google.com/books?pg=PA133&dq=alias+method+walker&ei=D4ORR8ncFYuWtgOslpVE&sig=TjEThBUa4odbGJmjyF4daF1AKF4&id=ERSSDBDcYOIC&output=html</a>) outlined here explained how, but I wanted to see if there is a ready made implementation so I wouldn't have to write it up.</p>
| [
{
"answer_id": 127132,
"author": "finalman",
"author_id": 20522,
"author_profile": "https://Stackoverflow.com/users/20522",
"pm_score": 2,
"selected": true,
"text": "public int selectPerson(float[] probabilies, Random r) {\n float t = r.nextFloat();\n float p = 0.0f;\n\n for (in... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17335/"
] |
126,667 | <p>When I launch the "mvn install" command, maven sometimes tries to download dependencies that it has already downloaded. That's expected for SNAPSHOT but why does maven do that for other JARs?</p>
<p>I know I can avoid that behavior by "-o" flag but I just wonder what the cause is.</p>
| [
{
"answer_id": 7780139,
"author": "fivetenwill",
"author_id": 983104,
"author_profile": "https://Stackoverflow.com/users/983104",
"pm_score": 0,
"selected": false,
"text": "find ~/.m2/repository -name '_maven*' | xargs rm\nfind ~/.m2/repository -name '*lastUpdated' | xargs rm\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3122/"
] |
126,678 | <p>I don't seem to be able to close the OledbDataReader object after reading data from it. Here is the relevant code -</p>
<pre><code>Dim conSyBase As New OleDb.OleDbConnection("Provider=Sybase.ASEOLEDBProvider.2;Server Name=xx.xx.xx.xx;Server Port Address=5000;Initial Catalog=xxxxxxxxxx;User ID=xxxxxxxx;Password=xxxxxxxxx;")
conSyBase.Open()
Dim cmdSyBase As New OleDb.OleDbCommand("MySQLStatement", conSyBase)
Dim drSyBase As OleDb.OleDbDataReader = cmdSyBase.ExecuteReader
Try
While drSyBase.Read
/*Do some stuff with the data here */
End While
Catch ex As Exception
NotifyError(ex, "Read failed.")
End Try
drSyBase.Close() /* CODE HANGS HERE */
conSyBase.Close()
drSyBase.Dispose()
cmdSyBase.Dispose()
conSyBase.Dispose()
</code></pre>
<p>The console application just hangs at the point at which I try to close the reader. Opening and closing a connection is not a problem, therefore does anyone have any ideas for what may be causing this?</p>
| [
{
"answer_id": 126784,
"author": "Mikey",
"author_id": 13347,
"author_profile": "https://Stackoverflow.com/users/13347",
"pm_score": 0,
"selected": false,
"text": "\nDim conSyBase As New OleDb.OleDbConnection(\"Provider=Sybase.ASEOLEDBProvider.2;Server Name=xx.xx.xx.xx;Server Port Addres... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831/"
] |
126,680 | <p>Looking for one that is fast enough and still graceful with memory. The image is a 24bpp System.Drawing.Bitmap.</p>
| [
{
"answer_id": 126712,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "var cnt = new HashSet<System.Drawing.Color>();\n\nforeach (Color pixel in image)\n cnt.Add(pixel);\n\nConsole.Writ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21623/"
] |
126,718 | <p>I'm working on a VB6 application and I would like to send a Type as a reference and store it in another form. Is this possible?</p>
<p>Sending it is no problem, I just use the <code>ByRef</code> keyword:</p>
<pre><code>public Sub SetStopToEdit(ByRef currentStop As StopType)
</code></pre>
<p>But when I try to use Set to store <code>currentStop</code> in the receiving module I get the "Object required" error when running the program:</p>
<pre><code>Private stopToEdit As StopTypeModule.StopType
' ... Lots of code
Set stopToEdit = currentStop
</code></pre>
<p><code>StopType</code> is defined as follows in a Module (<strong>not a class module</strong>):</p>
<pre><code>Public Type StopType
MachineName As String
StartDate As Date
StartTime As String
Duration As Double
End Type
</code></pre>
<p>Is it possible to store the sent reference or do I have to turn <code>StopType</code> into a class?</p>
<p>While just setting a local variable works:</p>
<pre><code>stopToEdit = currentStop
</code></pre>
<p>When <code>stopToEdit</code> is later changed the change is not visible in the variable sent to <code>SetStopToEdit</code>.</p>
| [
{
"answer_id": 126740,
"author": "Daren Thomas",
"author_id": 2260,
"author_profile": "https://Stackoverflow.com/users/2260",
"pm_score": 1,
"selected": false,
"text": "Set"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16047/"
] |
126,720 | <p>Is it possible to setup a JDBC connection to Oracle without providing username/password information in a configuration file (or in any other standard readable location)?</p>
<p>Typically applications have a configuration file that contains setup parameters to connect to a database. Some DBAs have problems with the fact that usernames and passwords are in clear text in config files.</p>
<p>I don't think this is possible with Oracle and JDBC, but I need some confirmation...</p>
<p>A possible compromise is to encrypt the password in the config file and decrypt it before setting up the connection. Of course, the decryption key should not be in the same config file. This will only solve accidental opening of the config file by unauthorized users.</p>
| [
{
"answer_id": 822248,
"author": "Achille",
"author_id": 100733,
"author_profile": "https://Stackoverflow.com/users/100733",
"pm_score": 2,
"selected": false,
"text": "J2EE"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9504/"
] |
126,737 | <p>After watching The Dark Knight I became rather enthralled with the concept of the Prisoner's Dilemma. There <em>must</em> be an algorithm that that maximizes one's own gain given a situation.</p>
<p>For those that find this foreign: <a href="http://en.wikipedia.org/wiki/Prisoner%27s_dilemma" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Prisoner%27s_dilemma</a></p>
<p>Very, very interesting stuff.</p>
<p>Edit: The question is, <em>what</em> is, if any, the most efficient algorithm that exists for the Prisoner's Dilemma?</p>
| [
{
"answer_id": 126826,
"author": "slim",
"author_id": 7512,
"author_profile": "https://Stackoverflow.com/users/7512",
"pm_score": 5,
"selected": true,
"text": "cooperate = true;\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14877/"
] |
126,738 | <p>I have drawn an image in the device context using python and I want to move it smoothly/animate either vertically or horizontally.</p>
<p>What algorithm should I use? Where can I get info for this kind of tasks in python?</p>
| [
{
"answer_id": 127216,
"author": "freespace",
"author_id": 8297,
"author_profile": "https://Stackoverflow.com/users/8297",
"pm_score": 0,
"selected": false,
"text": "(x1, y1)"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20894/"
] |
126,751 | <p>During a long compilation with Visual Studio 2005 (version 8.0.50727.762), I sometimes get the following error in several files in some project: </p>
<pre><code>fatal error C1033: cannot open program database 'v:\temp\apprtctest\win32\release\vc80.pdb'
</code></pre>
<p>(The file mentioned is either <code>vc80.pdb</code> or <code>vc80.idb</code> in the project's temp dir.)</p>
<p>The next build of the same project succeeds. There is no other Visual Studio open that might access the same files.</p>
<p>This is a serious problem because it makes nightly compilation impossible.</p>
| [
{
"answer_id": 18296973,
"author": "M.H.",
"author_id": 2610299,
"author_profile": "https://Stackoverflow.com/users/2610299",
"pm_score": 4,
"selected": false,
"text": "Project Options -> C/C++ -> General -> Debug Information Format"
},
{
"answer_id": 19676823,
"author": "Jef... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7224/"
] |
126,756 | <p>Can anybody suggest programming examples that illustrate recursive functions? There are the usual old horses such as <strong><em>Fibonacci series</em></strong> and <strong><em>Towers of Hanoi</em></strong>, but anything besides them would be fun.</p>
| [
{
"answer_id": 126793,
"author": "Yuval F",
"author_id": 1702,
"author_profile": "https://Stackoverflow.com/users/1702",
"pm_score": 0,
"selected": false,
"text": "void rev(string s) {\n if (!s.empty()) {\n rev(s[1..s.length]);\n }\n print(s[0]);\n}\n"
},
{
"answer_id": 126... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4021/"
] |
126,759 | <p>I've created an implementation of the <code>QAbstractListModel</code> class in Qt Jambi 4.4 and am finding that using the model with a <code>QListView</code> results in nothing being displayed, however using the model with a <code>QTableView</code> displays the data correctly.</p>
<p>Below is my implementation of <code>QAbstractListModel</code>:</p>
<pre><code>public class FooListModel extends QAbstractListModel
{
private List<Foo> _data = new Vector<Foo>();
public FooListModel(List<Foo> data)
{
if (data == null)
{
return;
}
for (Foo foo : data)
{
_data.add(Foo);
}
reset();
}
public Object data(QModelIndex index, int role)
{
if (index.row() < 0 || index.row() >= _data.size())
{
return new QVariant();
}
Foo foo = _data.get(index.row());
if (foo == null)
{
return new QVariant();
}
return foo;
}
public int rowCount(QModelIndex parent)
{
return _data.size();
}
}
</code></pre>
<p>And here is how I set the model:</p>
<pre><code>Foo foo = new Foo();
foo.setName("Foo!");
List<Foo> data = new Vector<Foo>();
data.add(foo);
FooListModel fooListModel = new FooListModel(data);
ui.fooListView.setModel(fooListModel);
ui.fooTableView.setModel(fooListModel);
</code></pre>
<p>Can anyone see what I'm doing wrong? I'd like to think it was a problem with my implementation because, as everyone says, select ain't broken!</p>
| [
{
"answer_id": 126793,
"author": "Yuval F",
"author_id": 1702,
"author_profile": "https://Stackoverflow.com/users/1702",
"pm_score": 0,
"selected": false,
"text": "void rev(string s) {\n if (!s.empty()) {\n rev(s[1..s.length]);\n }\n print(s[0]);\n}\n"
},
{
"answer_id": 126... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13678/"
] |
126,772 | <h2>Background</h2>
<p>I am writing and using a very simple CGI-based (Perl) content management tool for two pro-bono websites. It provides the website administrator with HTML forms for events where they fill the fields (date, place, title, description, links, etc.) and save it. On that form I allow the administrator to upload an image related to the event. On the HTML page displaying the form, I am also showing a preview of the picture uploaded (HTML img tag).</p>
<h2>The Problem</h2>
<p>The problem happens when the administrator wants to change the picture. He would just have to hit the "browse" button, pick a new picture and press ok. And this works fine.</p>
<p>Once the image is uploaded, my back-end CGI handles the upload and reloads the form properly.</p>
<p>The problem is that the image shown <strong>does not</strong> get refreshed. The old image is still shown, even though the database holds the right image. I have narrowed it down to the fact that the IMAGE IS CACHED in the web browser. If the administrator hits the RELOAD button in Firefox/Explorer/Safari, everything gets refreshed fine and the new image just appears.</p>
<h2>My Solution - Not Working</h2>
<p>I am trying to control the cache by writing a HTTP Expires instruction with a date very far in the past.</p>
<pre><code>Expires: Mon, 15 Sep 2003 1:00:00 GMT
</code></pre>
<p>Remember that I am on the administrative side and I don't really care if the pages takes a little longer to load because they are always expired.</p>
<p>But, this does not work either.</p>
<h2>Notes</h2>
<p>When uploading an image, its filename is not kept in the database. It is renamed as <strong>Image.jpg</strong> (to simply things out when using it). When replacing the existing image with a new one, the name doesn't change either. Just the content of the image file changes.</p>
<p>The webserver is provided by the hosting service/ISP. It uses Apache.</p>
<h2>Question</h2>
<p>Is there a way to force the web browser to NOT cache things from this page, not even images?</p>
<p>I am juggling with the option to actually "save the filename" with the database. This way, if the image is changed, the src of the IMG tag will also change. However, this requires a lot of changes throughout the site and I rather not do it if I have a better solution. Also, this will still not work if the new image uploaded has the same name (say the image is photoshopped a bit and re-uploaded).</p>
| [
{
"answer_id": 126782,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 6,
"selected": false,
"text": "<img src=\"foo.cgi?random=323527528432525.24234\" alt=\"\">\n"
},
{
"answer_id": 126831,
"author": "epo... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7984/"
] |
126,781 | <p>I'm translating a library written in C++ to C#, and the keyword 'union' exists once. In a struct.</p>
<p>What's the correct way of translating it into C#? And what does it do? It looks something like this;</p>
<pre><code>struct Foo {
float bar;
union {
int killroy;
float fubar;
} as;
}
</code></pre>
| [
{
"answer_id": 126807,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 8,
"selected": true,
"text": "[StructLayout(LayoutKind.Explicit)] \npublic struct SampleUnion\n{\n [FieldOffset(0)] public float bar;\n [Fie... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15067/"
] |
126,787 | <p>Almost every Python web framework has a simple server that runs a wsgi application and automatically reloads the imported modules every time the source gets changed. I know I can look at the code and see how it's done, but that may take some time and I'm asking just out of curiosity. Does anyone have any idea how this is implemented?</p>
| [
{
"answer_id": 126843,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 3,
"selected": true,
"text": "reload()"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7883/"
] |
126,794 | <p>I'm trying to write a query that will pull back the two most recent rows from the Bill table where the Estimated flag is true. The catch is that these need to be consecutive bills. </p>
<p>To put it shortly, I need to enter a row in another table if a Bill has been estimated for the last two bill cycles.</p>
<p>I'd like to do this without a cursor, if possible, since I am working with a sizable amount of data and this has to run fairly often.</p>
<p><strong>Edit</strong></p>
<p>There is an AUTOINCREMENT(1,1) column on the table. Without giving away too much of the table structure, the table is essentially of the structure:</p>
<pre><code>
CREATE TABLE Bills (
BillId INT AUTOINCREMENT(1,1,) PRIMARY KEY,
Estimated BIT NOT NULL,
InvoiceDate DATETIME NOT NULL
)
</code></pre>
<p>So you might have a set of results like:</p>
<pre>
BillId AccountId Estimated InvoiceDate
-------------------- -------------------- --------- -----------------------
1111196 1234567 1 2008-09-03 00:00:00.000
1111195 1234567 0 2008-08-06 00:00:00.000
1111194 1234567 0 2008-07-03 00:00:00.000
1111193 1234567 0 2008-06-04 00:00:00.000
1111192 1234567 1 2008-05-05 00:00:00.000
1111191 1234567 0 2008-04-04 00:00:00.000
1111190 1234567 1 2008-03-05 00:00:00.000
1111189 1234567 0 2008-02-05 00:00:00.000
1111188 1234567 1 2008-01-07 00:00:00.000
1111187 1234567 1 2007-12-04 00:00:00.000
1111186 1234567 0 2007-11-01 00:00:00.000
1111185 1234567 0 2007-10-01 00:00:00.000
1111184 1234567 1 2007-08-30 00:00:00.000
1111183 1234567 0 2007-08-01 00:00:00.000
1111182 1234567 1 2007-07-02 00:00:00.000
1111181 1234567 0 2007-06-01 00:00:00.000
1111180 1234567 1 2007-05-02 00:00:00.000
1111179 1234567 0 2007-03-30 00:00:00.000
1111178 1234567 1 2007-03-02 00:00:00.000
1111177 1234567 0 2007-02-01 00:00:00.000
1111176 1234567 1 2007-01-03 00:00:00.000
1111175 1234567 0 2006-11-29 00:00:00.000
</pre>
<p>In this case, only records 1111188 and 1111187 would be consecutive.</p>
| [
{
"answer_id": 126828,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 2,
"selected": false,
"text": "select top 2 * \nfrom bills\nwhere estimated = 1 \norder by billdate desc\n"
},
{
"answer_id": 126848,
"author": ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11780/"
] |
126,798 | <p>Does anyone know how to solve this java error?</p>
<pre><code>java.io.IOException: Invalid keystore format
</code></pre>
<p>I get it when I try and access the certificate store from the Java option in control panels. It's stopping me from loading applets that require elevated privileges.</p>
<p><a href="http://img72.imageshack.us/my.php?image=javaerrorxq7.jpg" rel="nofollow noreferrer">Error Image</a></p>
| [
{
"answer_id": 126981,
"author": "Craig Day",
"author_id": 5193,
"author_profile": "https://Stackoverflow.com/users/5193",
"pm_score": 3,
"selected": true,
"text": "C:\\Documents and Settings\\CDay\\Application Data\\Sun\\Java\\Deployment\\security"
},
{
"answer_id": 23430647,
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/942/"
] |
126,800 | <p>In a destructor, is there a way to determine if an exception is currently being processed?</p>
| [
{
"answer_id": 126950,
"author": "Eddie",
"author_id": 21116,
"author_profile": "https://Stackoverflow.com/users/21116",
"pm_score": 0,
"selected": false,
"text": "struct my_exception1\n{\n explicit my_exception1( int res_code ) : m_res_code( res_code ) {}\n int m_res_co... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
126,801 | <p>I'm confused about what the various testing appliances in Ruby on Rails are for. I have been using the framework for about 6 months but I've never understood the testing part of it. The only testing I've used is JUnit3 in Java and that only briefly.</p>
<p>Everything I've read about it just shows testing validations. Shouldn't the validations in rails just work? It seems more like testing the framework than testing the your code. Why would you need to test validations? </p>
<p>Furthermore, the tests seem super fragile to any change in your code. So if you change anything in your models, you have to change your tests and fixtures to match. Doesn't this violate the DRY principle?</p>
<p>Third, writing test code seems to take alot of time. Is that normal? Wouldn't it just be faster to refresh my browser and see if it worked? I already have to play with my application just to see if it flows correctly and make sure my CSS hasn't exploded. Why wouldn't manual testing be enough?</p>
<p>I've asked these questions before and I haven't gotten more than "automated testing is automated". I am smart enough to figure out the advantages of automating a task. My problem is that costs of writing tests seem absurdly high compared to the benefits. That said, any detailed response is welcome because I probably missed a benefit or two.</p>
| [
{
"answer_id": 130710,
"author": "Ian Terrell",
"author_id": 9269,
"author_profile": "https://Stackoverflow.com/users/9269",
"pm_score": 6,
"selected": true,
"text": "validates_numericality_of"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16204/"
] |
126,804 | <p>I have used "traditional" version control systems to maintain source code repositories on past projects. I am starting a new project with a distributed team and I can see advantages to using a distributed system. Given that I understand SourceSafe, CVS, and Subversion; what suggestions do you have for a Git newbie?</p>
| [
{
"answer_id": 126937,
"author": "Jonathan Tran",
"author_id": 12887,
"author_profile": "https://Stackoverflow.com/users/12887",
"pm_score": 2,
"selected": false,
"text": "-a"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3014/"
] |
126,829 | <p>Here's a question to expose my lack of experience: I have a method <strong>DoSomething()</strong> which throws an exception if it doesn't manage to do it cleanly. If it fails, I try the less accurate method <strong>DoSomethingApproximately()</strong> several times in the hope that it will find a sufficiently good solution; if this also fails I finally call <strong>DoSomethingInaccurateButGuaranteedToWork()</strong>. All three are methods belonging to this object.</p>
<p>Two questions: first, is this (admittedly ugly) pattern acceptable, or is there a more elegant way?</p>
<p>Second, what is the best way to keep track of how many times I have called <strong>DoSomethingApproximately()</strong>, given that it is likely to throw an exception? I am currently keeping a variable iNoOfAttempts in the object, and nesting try blocks... this is horrible and I am ashamed. </p>
| [
{
"answer_id": 126859,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 2,
"selected": false,
"text": " bool result = DoSomething();\n while (!result && tries < MAX_TRIES) {\n result = DoSomethingApproximately... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091/"
] |
126,853 | <p>I saw <a href="http://www.gnegg.ch/2008/09/automatic-language-detection/" rel="nofollow noreferrer">this</a> on reddit, and it reminded me of one of my vim gripes: It shows the UI in German. I want English. But since my OS is set up in German (the standard at our office), I guess vim is actually trying to be helpful.</p>
<p>What magic incantations must I perform to get vim to switch the UI language? I have tried googling on various occasions, but can't seem to find an answer.</p>
| [
{
"answer_id": 126858,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 2,
"selected": false,
"text": "LC_ALL=en_GB.utf-8 vim\n"
},
{
"answer_id": 127539,
"author": "Aristotle Pagaltzis",
"author_id": 9... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] |
126,855 | <p>I have two tables, Users and DoctorVisit</p>
<p>User
- UserID
- Name</p>
<p>DoctorsVisit
- UserID
- Weight
- Date </p>
<p>The doctorVisit table contains all the visits a particular user did to the doctor.
The user's weight is recorded per visit.</p>
<p>Query: Sum up all the Users weight, using the last doctor's visit's numbers. (then divide by number of users to get the average weight)</p>
<p>Note: some users may have not visited the doctor at all, while others may have visited many times.</p>
<p>I need the average weight of all users, but using the latest weight.</p>
<p><b>Update</b></p>
<p>I want the average weight across all users.</p>
| [
{
"answer_id": 126892,
"author": "JPrescottSanders",
"author_id": 19444,
"author_profile": "https://Stackoverflow.com/users/19444",
"pm_score": 0,
"selected": false,
"text": "select user.name, temp.AvgWeight\nfrom user left outer join (select userid, avg(weight)\n from doctors... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
126,863 | <p>In some instances, I prefer working with custom objects instead of strongly typed datasets and data rows. However, it seems like Microsoft Reporting (included with VS2005) requires strongly typed datasets.</p>
<p>Is there a way to use my custom objects to design and populate reports?</p>
| [
{
"answer_id": 11303040,
"author": "CRice",
"author_id": 55693,
"author_profile": "https://Stackoverflow.com/users/55693",
"pm_score": 2,
"selected": false,
"text": "Aies.Core.Model.Invoice.MemberInvoice"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681/"
] |
126,868 | <p>I'm developing a C# assembly which is to be called via COM from a Delphi 7 (iow, native win32, not .net) application.</p>
<p>So far, it seems to work. I've exported a TLB file, imported that into my Delphi project, and I can create my C# object and call its functions.</p>
<p>So that's great, but soon I'm going to <strong>really</strong> want to use Visual Studio to debug the C# code while it's running. Set breakpoints, step through code, all that stuff.</p>
<p>I've tried breaking in the Delphi code after the COM object is created, then looking for a process for VS to attach to, but I can't find one.</p>
<p>Is there a way to set VS2008 up to do this? I'd prefer to just be able to hit f5 and have VS start the Delphi executable, wait for the C# code to be called, and then attach itself to it.. But I could live with manually attaching to a process, I suppose.</p>
<p>Just please don't tell me I have to make do with MessageBox.Show etc.</p>
| [
{
"answer_id": 126886,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "#if DEBUG\n if (!System.Diagnostics.Debugger.IsAttached)\n Debugger.Launch();\n#endif\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369/"
] |
126,870 | <p>I am designing a class that stores (caches) a set of data. I want to lookup a value, if the class contains the value then use it and modify a property of the class. I am concerned about the design of the public interface.<br>
Here is how the class is going to be used:</p>
<pre>
ClassItem *pClassItem = myClass.Lookup(value);
if (pClassItem)
{ // item is found in class so modify and use it
pClassItem->SetAttribute(something);
... // use myClass
}
else
{ // value doesn't exist in the class so add it
myClass.Add(value, something);
}
</pre>
<p>However I don't want to have to expose ClassItem to this client (ClassItem is an implementation detail of MyClass).
To get round that the following could be considered:</p>
<pre>
bool found = myClass.Lookup(value);
if (found)
{ // item is found in class so modify and use it
myClass.ModifyAttribute(value, something);
... // use myClass
}
else
{ // value doesn't exist in the class so add it
myClass.Add(value, something);
}
</pre>
<p>However this is inefficient as Modify will have to do the lookup again. This would suggest a lookupAndModify type of method:</p>
<pre>
bool found = myClass.LookupAndModify(value, something);
if (found)
{ // item is found in class
... // use myClass
}
else
{ // value doesn't exist in the class so add it
myClass.Add(value, something);
}
</pre>
<p>But rolling LookupAndModify into one method seems like very poor design. It also only modifies if value is found and so the name is not only cumbersome but misleading as well.</p>
<p>Is there another better design that gets round this issue? Any design patterns for this (I couldn't find anything through google)?</p>
| [
{
"answer_id": 126944,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 1,
"selected": false,
"text": "if (!myClass.AddIfNotExists(value, something)) {\n // use myClass\n}\n"
},
{
"answer_id": 127865,
"autho... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12663/"
] |
126,876 | <p>During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it?</p>
| [
{
"answer_id": 126904,
"author": "Romain Verdier",
"author_id": 4687,
"author_profile": "https://Stackoverflow.com/users/4687",
"pm_score": 2,
"selected": false,
"text": "BeginUpdate"
},
{
"answer_id": 126914,
"author": "moobaa",
"author_id": 3569,
"author_profile": "... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4694/"
] |
126,885 | <p>We have a SQL Server table containing Company Name, Address, and Contact name (among others).</p>
<p>We regularly receive data files from outside sources that require us to match up against this table. Unfortunately, the data is slightly different since it is coming from a completely different system. For example, we have "123 E. Main St." and we receive "123 East Main Street". Another example, we have "Acme, LLC" and the file contains "Acme Inc.". Another is, we have "Ed Smith" and they have "Edward Smith" </p>
<p>We have a legacy system that utilizes some rather intricate and CPU intensive methods for handling these matches. Some involve pure SQL and others involve VBA code in an Access database. The current system is good but not perfect and is cumbersome and difficult to maintain </p>
<p>The management here wants to expand its use. The developers who will inherit the support of the system want to replace it with a more agile solution that requires less maintenance. </p>
<p>Is there a commonly accepted way for dealing with this kind of data matching?</p>
| [
{
"answer_id": 126903,
"author": "torial",
"author_id": 13990,
"author_profile": "https://Stackoverflow.com/users/13990",
"pm_score": 3,
"selected": true,
"text": " Public Shared Function FindMostSimilarString(ByVal toFind As String, ByVal ParamArray stringList() As String) As String\... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2173/"
] |
126,894 | <p>I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I create new class, I can have more than 10 attributes and it's long to do 1 by 1 every accessor. Is there a faster way to create them?</p>
<p>Thank you for your time.</p>
| [
{
"answer_id": 142910,
"author": "Jay Bazuzi",
"author_id": 5314,
"author_profile": "https://Stackoverflow.com/users/5314",
"pm_score": 1,
"selected": false,
"text": "public string Name { get; private set; }\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] |
126,896 | <p>we are using git-svn to manage branches of an SVN repo. We are facing the following problem: after a number of commits by user X in the branch, user Y would like to use git-svn to merge the changes in branch to trunk. The problem we're seeing is that the commit messages for all the individual merge operations look as if they were made by user Y, whereas the actual change in branch was made by user X.</p>
<p>Is there a way to indicate to git-svn that when merging, use the original commit message/author for a given change rather than the person doing the merge?</p>
| [
{
"answer_id": 127242,
"author": "richq",
"author_id": 4596,
"author_profile": "https://Stackoverflow.com/users/4596",
"pm_score": 5,
"selected": true,
"text": "------------------------------------------------------------------------\nr5 | Y | 2008-09-24 15:17:12 +0200 (Wed, 24 Sep 2008)... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
126,897 | <p>The question is pretty self-explanatory. I'm looking for a PostgreSQL equivalent to the <a href="http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions" rel="nofollow noreferrer">SQLite datetime function</a>.</p>
| [
{
"answer_id": 126920,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 3,
"selected": false,
"text": "postgres=# select to_char(now(),'YYYY-mm-dd HH:MM:ss');\n to_char\n---------------------\n 2008-09-24 02:09:20... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
126,898 | <p>I ran into a problem a few days ago when I had to introduce C++ files into a Java project. It started with a need to measure the CPU usage of the Java process and it was decided that the way to go was to use JNI to call out to a native library (a shared library on a Unix machine) written in C. The problem was to find an appropriate place to put the C files in the source repository (incidentally Clearcase) which consists of only Java files.</p>
<p>I thought of a couple of alternatives:</p>
<p>(a) Create a separate directory for putting the C files (specifically, one .h file and one .c file) at the top of the source base like:</p>
<p>/vobs/myproduct/javasrc
/vobs/myproduct/cppsrc</p>
<p>I didn't like this because I have only two C files and it seemed very odd to split the source base at the language level like this. Had substantial portions of the project been written more or less equally in C++ and Java, this could be okay.</p>
<p>(b) Put the C files into the Java package that uses it.</p>
<p>I have the calling Java classes in /vobs/myproduct/com/mycompany/myproduct/util/ and the C files also go in there.</p>
<p>I didn't like this either because I think the C files just don't belong in the Java package.</p>
<p>Has anybody solved a problem like this before? Generally, what's a good strategy to follow when organizing codebase that mixes two or more languages?</p>
<p>Update: I don't have any plan to use any C or C++ in my project, some Jython perhaps, but you never know when my customers need a feature that can be solved only by using C or best solved by using C.</p>
| [
{
"answer_id": 127018,
"author": "m_pGladiator",
"author_id": 446104,
"author_profile": "https://Stackoverflow.com/users/446104",
"pm_score": 0,
"selected": false,
"text": "Product/Workspace(1)/JavaProject1/src \nProduct/Workspace(1)/JavaProject2/src \nProduct/Workspace(1 or 2)/CPPprojec... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21647/"
] |
126,917 | <p>In ASPNET, I grew to love the Application and Cache stores. They're awesome. For the uninitiated, you can just throw your data-logic objects into them, and hey-presto, you only need query the database once for a bit of data. </p>
<p>By far one of the best ASPNET features, IMO.</p>
<p>I've since ditched Windows for Linux, and therefore PHP, Python and Ruby for webdev. I use PHP most because I dev several open source projects, all using PHP.</p>
<p>Needless to say, I've explored what PHP has to offer in terms of caching data-objects. So far I've played with:</p>
<ol>
<li>Serializing to file (a pretty slow/expensive process)</li>
<li>Writing the data to file as JSON/XML/plaintext/etc (even slower for read ops)</li>
<li>Writing the data to file as pure PHP (the fastest read, but quite a convoluted write op)</li>
</ol>
<p>I should stress now that I'm looking for a solution that doesn't rely on a third party app (eg memcached) as the apps are installed in all sorts of scenarios, most of which don't have install rights (eg: a cheap shared hosting account).</p>
<p>So back to what I'm doing now, <strong>is persisting to file secure?</strong> <code>Rule 1</code> in production server security has always been disable file-writing, but I really don't see any way PHP <em>could</em> cache if it couldn't write. Are there any tips and/or tricks to boost the security?</p>
<p><strong>Is there another persist-to-file method that I'm forgetting?</strong></p>
<p><strong>Are there any better methods of caching in "limited" environments?</strong></p>
| [
{
"answer_id": 127098,
"author": "Michael Johnson",
"author_id": 17688,
"author_profile": "https://Stackoverflow.com/users/17688",
"pm_score": 2,
"selected": false,
"text": "project/\n app/\n html/\n index.php\n data/\n cache/\n"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12870/"
] |
126,925 | <p>I have an Internet Explorer Browser Helper Object (BHO), written in c#, and in various places I open forms as modal dialogs. Sometimes this works but in some cases it doesn't. The case that I can replicate at present is where IE is running javascript to open other child windows... I guess it's getting a bit confused somewhere.... </p>
<p>The problem is that when I call:</p>
<pre><code>(new MyForm(someParam)).ShowDialog();
</code></pre>
<p>the form is not modal, so I can click on the IE window and it gets focus. Since IE is in the middle of running my code it doesn't refresh and therefore to the user it appears that IE is hanging.</p>
<p>Is there a way of ensuring that the form will be opened as modal, ie that it's not possible for the form to be hidden behind IE windows.</p>
<p>(I'm using IE7.)</p>
<p>NB: this is a similar question to <a href="https://stackoverflow.com/questions/73000/modal-dialogs-in-ie-gets-hidden-behind-ie-if-user-clicks-on-ie-pane">this post</a> although that's using java. I guess the solution is around correctly passing in the IWin32Window of the IE window, so I'm looking into that.</p>
| [
{
"answer_id": 126959,
"author": "Rory",
"author_id": 8479,
"author_profile": "https://Stackoverflow.com/users/8479",
"pm_score": 2,
"selected": true,
"text": "IWebBrowser2 browser = siteObject as IWebBrowser2;\nif (browser != null) hwnd = new IntPtr(browser.HWND);\n(new MyForm(someParam... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] |
126,926 | <p>It seems like if you compile a Visual Studio solution and have a version # in your AssemblyInfo.cs file, that should propagate to say, the Windows Explorer properties dialog. This way, someone could simply right click on the *.exe and click 'properties' to see the version #. Is there a special setting in Visual Studio to make this happen?</p>
<p><a href="http://content.screencast.com/users/Pincas/folders/Jing/media/40442efd-6d74-4d8a-8e77-c1e725e6c150/2008-09-24_0849.png" rel="nofollow noreferrer">example picture http://content.screencast.com/users/Pincas/folders/Jing/media/40442efd-6d74-4d8a-8e77-c1e725e6c150/2008-09-24_0849.png</a></p>
<p>Edit: I should have mentioned that this is, specifically, for .NET <strong>Compact Framework</strong> 2.0, which doesn't support AssemblyFileVersion. Is all hope lost?</p>
| [
{
"answer_id": 126948,
"author": "Nigel Hawkins",
"author_id": 1389021,
"author_profile": "https://Stackoverflow.com/users/1389021",
"pm_score": 1,
"selected": false,
"text": "[assembly: AssemblyFileVersion(\"1.0.114.0\")]"
},
{
"answer_id": 126961,
"author": "Wolfwyrd",
... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273/"
] |
126,966 | <p>What I'm looking for is a simple timer queue possibly with an external timing source and a poll method (in this way it will be multi-platform). Each enqueued message could be an object implementing a simple interface with a <code>virtual onTimer()</code> member function.</p>
| [
{
"answer_id": 127074,
"author": "TonJ",
"author_id": 11537,
"author_profile": "https://Stackoverflow.com/users/11537",
"pm_score": 2,
"selected": false,
"text": "#ifdef -- #endif"
},
{
"answer_id": 127182,
"author": "Len Holgate",
"author_id": 7925,
"author_profile":... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15785/"
] |
126,976 | <p>I am looking for a good primer or technical description of the <strong>System Call</strong> mechanism that is used by operating systems to transition from user space to the kernel to invoke functions such as "open", "read", "write", etc...</p>
<p>Is there anything other than the <a href="http://en.wikipedia.org/wiki/System_call" rel="nofollow noreferrer">Wikipedia</a> entry?
Websites, pdfs, books, source code, all are welcome :)</p>
| [
{
"answer_id": 127187,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 2,
"selected": false,
"text": "SYSCALL"
}
] | 2008/09/24 | [
"https://Stackoverflow.com/questions/126976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10703/"
] |
126,980 | <p>I would like to support keyboard shortcuts in my WPF XBAP application, such as <kbd>Ctrl</kbd>+<kbd>O</kbd> for 'Open' etc. How do I disable the browsers built-in keyboard shortcuts and replace them with my own?</p>
| [
{
"answer_id": 1058624,
"author": "John Donoghue",
"author_id": 130473,
"author_profile": "https://Stackoverflow.com/users/130473",
"pm_score": 1,
"selected": false,
"text": "Private Shared m_handle As IntPtr\nPrivate Shared m_hook As Interop.HwndSourceHook\nPrivate Shared m_hookCreated ... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
126,999 | <p>When writing j2me applications for cellphones, using <code>System.out.println()</code> prints on the console if using an emulator. However, when the code is deployed on a cellphone, where does the console output go?</p>
<p>If it is impossible to see this in the untethered cellphone, is there a way to see it if the cellphone is still connected to the deploying PC [via USB] ?</p>
| [
{
"answer_id": 127078,
"author": "Animesh",
"author_id": 20386,
"author_profile": "https://Stackoverflow.com/users/20386",
"pm_score": 2,
"selected": false,
"text": "System.out.println()"
},
{
"answer_id": 807496,
"author": "kozen",
"author_id": 98649,
"author_profile... | 2008/09/24 | [
"https://Stackoverflow.com/questions/126999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20386/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.