qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
100,820 | <p>I have a JSF woodstock table with checkboxes. When a row is selected I want to do some processing with those items. I managed to get a selection of RowKey objects but can't find out how to get the original objects I put in back. The table is populated by an ObjectListDataProvider.</p>
| [
{
"answer_id": 3472860,
"author": "Nikordaris",
"author_id": 300269,
"author_profile": "https://Stackoverflow.com/users/300269",
"pm_score": 0,
"selected": false,
"text": "<ui:radioButton id=\"radioButton1\" name=\"radioButton-group1\" valueChangeListener=\"#{MyBeanPage.radioButton1_proc... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18702/"
] |
100,824 | <p>The code below shows a sample that I've used recently to explain the different behaviour of structs and classes to someone brand new to development. Is there a better way of doing so? (Yes - the code uses public fields - that's purely for brevity)</p>
<pre><code>namespace StructsVsClasses
{
class Program
{
static void Main(string[] args)
{
sampleStruct struct1 = new sampleStruct();
struct1.IntegerValue = 3;
Console.WriteLine("struct1.IntegerValue: {0}", struct1.IntegerValue);
sampleStruct struct2 = struct1;
Console.WriteLine();
Console.WriteLine("struct1.IntegerValue: {0}", struct1.IntegerValue);
Console.WriteLine("struct2.IntegerValue: {0}", struct2.IntegerValue);
struct1.IntegerValue = 5;
Console.WriteLine();
Console.WriteLine("struct1.IntegerValue: {0}", struct1.IntegerValue);
Console.WriteLine("struct2.IntegerValue: {0}", struct2.IntegerValue);
sampleClass class1 = new sampleClass();
class1.IntegerValue = 3;
Console.WriteLine();
Console.WriteLine("class1.IntegerValue: {0}", class1.IntegerValue);
sampleClass class2 = class1;
Console.WriteLine();
Console.WriteLine("class1.IntegerValue: {0}", class1.IntegerValue);
Console.WriteLine("class2.IntegerValue: {0}", class2.IntegerValue);
class1.IntegerValue = 5;
Console.WriteLine();
Console.WriteLine("class1.IntegerValue: {0}", class1.IntegerValue);
Console.WriteLine("class2.IntegerValue: {0}", class2.IntegerValue);
Console.ReadKey();
}
}
struct sampleStruct
{
public int IntegerValue;
}
class sampleClass
{
public int IntegerValue;
}
}
</code></pre>
| [
{
"answer_id": 101153,
"author": "Hallgrim",
"author_id": 15454,
"author_profile": "https://Stackoverflow.com/users/15454",
"pm_score": 2,
"selected": true,
"text": "class PointClass {\n int double X;\n int double Y;\n}\n\nclass Circle {\n PointClass Center = new PointClass() { X = 0,... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7872/"
] |
100,829 | <p>I'm trying to write a script to allow me to log in to a console servers 48 ports so that I can quickly determine what devices are connected to each serial line.</p>
<p>Essentially I want to be able to have a script that, given a list of hosts/ports, telnets to the first device in the list and leaves me in interactive mode so that I can log in and confirm the device, then when I close the telnet session, connects to the next session in the list.</p>
<p>The problem I'm facing is that if I start a telnet session from within an executable bash script, the session terminates immediately, rather than waiting for input.</p>
<p>For example, given the following code:</p>
<pre><code>$ cat ./telnetTest.sh
#!/bin/bash
while read line
do
telnet $line
done
$
</code></pre>
<p>When I run the command 'echo "hostname" | testscript.sh' I receive the following output:</p>
<pre><code>$ echo "testhost" | ./telnetTest.sh
Trying 192.168.1.1...
Connected to testhost (192.168.1.1).
Escape character is '^]'.
Connection closed by foreign host.
$
</code></pre>
<p>Does anyone know of a way to stop the telnet session being closed automatically?</p>
| [
{
"answer_id": 100879,
"author": "user11323",
"author_id": 11323,
"author_profile": "https://Stackoverflow.com/users/11323",
"pm_score": 3,
"selected": false,
"text": "#!/usr/bin/expect -f\nspawn telnet $host_name\nexpect {\n \"T0>\" {}\n -re \"Connection refused|No ro... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6306/"
] |
100,841 | <p>I've had a bug in our software that occurs when I receive a connection timeout. These errors are very rare (usually when my connection gets dropped by our internal network). How can I generate this kind of effect artificially so I can test our software? </p>
<p>If it matters the app is written in C++/MFC using CAsyncSocket classes.</p>
<p><strong>Edit:</strong></p>
<p>I've tried using a non-existent host, and I get the socket error:</p>
<blockquote>
<p>WSAEINVAL (10022) Invalid argument</p>
</blockquote>
<p>My next attempt was to use <a href="https://stackoverflow.com/questions/100841?sort=oldest#100859">Alexander</a>'s suggestion of connecting to a different port, e.g. 81 (on my own server though). That worked great. Exactly the same as a dropped connection (60 second wait, then error). Thank you!</p>
| [
{
"answer_id": 16048032,
"author": "Henrik Heimbuerger",
"author_id": 6278,
"author_profile": "https://Stackoverflow.com/users/6278",
"pm_score": 4,
"selected": false,
"text": "Python 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32\nType \"help\", \"copyright\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] |
100,853 | <p>While editing an aspx file I found both these opening tags used for seemingly the same thing. Is there a difference and if yes, what is it?</p>
| [
{
"answer_id": 100888,
"author": "Johannes Hädrich",
"author_id": 18246,
"author_profile": "https://Stackoverflow.com/users/18246",
"pm_score": 5,
"selected": true,
"text": "<%="
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/100853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5018/"
] |
100,854 | <p>I have C++ project (VS2005) which includes header file with version number in #define directive. Now I need to include exactly the same number in twin C# project. What is the best way to do it?</p>
<p>I'm thinking about including this file as a resource, then parse it at a runtime with regex to recover version number, but maybe there's a better way, what do you think?</p>
<p>I cannot move version outside .h file, also build system depends on it and the C# project is one which should be adapted.</p>
| [
{
"answer_id": 100913,
"author": "Skizz",
"author_id": 1898,
"author_profile": "https://Stackoverflow.com/users/1898",
"pm_score": 2,
"selected": false,
"text": "// version header file\n#define Version \"1.01\"\n\n// C# code\n#include \"version.h\"\n// somewhere in a class\nstring versio... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7162/"
] |
100,860 | <p>As most of you would know, if I drop a file named app_offline.htm in the root of an asp.net application, it takes the application offline <a href="http://asp-net-whidbey.blogspot.com/2006/04/aspnet-20-features-appofflinehtm.html" rel="nofollow noreferrer">as detailed here</a>.</p>
<p>You would also know, that while this is great, IIS actually returns a 404 code when this is in process and Microsoft is not going to do anything about it <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=319986" rel="nofollow noreferrer">as mentioned here</a>.</p>
<p>Now, since Asp.Net in general is so extensible, I am thinking that shouldn't there be a way to over ride this status code to return a 503 instead? The problem is, I don't know where to start looking to make this change.</p>
<p>HELP!</p>
| [
{
"answer_id": 100881,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 1,
"selected": false,
"text": "<httpRuntime enable = \"False\"/>\n"
},
{
"answer_id": 100928,
"author": "mdb",
"author_id": 8562,
"aut... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380/"
] |
100,898 | <p>What's the best / simplest / most accurate way to detect the browser of a user?</p>
<p>Ease of extendability and implementation is a plus.</p>
<p>The less technologies used, the better.</p>
<p>The solution can be server side, client side, or both. The results should eventually end up at the server, though.</p>
<p>The solution can be framework agnostic.</p>
<p>The solution will only be used for reporting purposes.</p>
| [
{
"answer_id": 100908,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 3,
"selected": false,
"text": "$.browser"
},
{
"answer_id": 100918,
"author": "Twan",
"author_id": 6702,
"author_profile": "https://Sta... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6681/"
] |
100,904 | <p>Per man pages, snprintf is returning number of bytes written from glibc version 2.2 onwards. But on lower versions of libc2.2 and HP-UX, it returns a positive integer, which could lead to a buffer overflow.</p>
<p>How can one overcome this and write portable code?</p>
<p>Edit : For want of more clarity</p>
<p>This code is working perfectly in lib 2.3</p>
<pre><code> if ( snprintf( cmd, cmdLen + 1, ". %s%s", myVar1, myVar2 ) != cmdLen )
{
fprintf( stderr, "\nError: Unable to copy bmake command!!!");
returnCode = ERR_COPY_FILENAME_FAILED;
}
</code></pre>
<p>It returns the length of the string (10) on Linux. But the same code is returning a positive number that is greater than the number of characters printed on HP-UX machine. Hope this explanation is fine.</p>
| [
{
"answer_id": 100936,
"author": "finnw",
"author_id": 12048,
"author_profile": "https://Stackoverflow.com/users/12048",
"pm_score": 0,
"selected": false,
"text": "int my_snprintf(char *buf, size_t n, const char *fmt, ...)\n{\n va_list va;\n int nchars;\n FILE *tf = tmpfile();\n... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18657/"
] |
100,917 | <p>I'm trying to read data from a Delphi DBIV database, every time I access the database it creates a Paradox.lck and a Pdoxusrs.lck file. I'm using only a TQuery Object to do this (nothing else). can I access a Delphi DBIV database without it creating these lock files?</p>
| [
{
"answer_id": 100936,
"author": "finnw",
"author_id": 12048,
"author_profile": "https://Stackoverflow.com/users/12048",
"pm_score": 0,
"selected": false,
"text": "int my_snprintf(char *buf, size_t n, const char *fmt, ...)\n{\n va_list va;\n int nchars;\n FILE *tf = tmpfile();\n... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
100,948 | <p>I installed MySQL via <a href="http://en.wikipedia.org/wiki/MacPorts" rel="noreferrer">MacPorts</a>. What is the command I need to stop the server (I need to test how my application behave when MySQL is dead)?</p>
| [
{
"answer_id": 100953,
"author": "Dan",
"author_id": 17121,
"author_profile": "https://Stackoverflow.com/users/17121",
"pm_score": 4,
"selected": false,
"text": "sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop\n"
},
{
"answer_id": 100958,
"author": "Bartosz Blimke",
"au... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] |
100,959 | <p>I am aware of <a href="http://cocoamysql.sourceforge.net/" rel="noreferrer">CocoaMySQL</a> but I have not seen a Mac GUI for SQLite, is there one?</p>
<p>My Google search didn't turn up any Mac related GUI's which is why I'm asking here rather than Google.</p>
| [
{
"answer_id": 10430316,
"author": "Joony",
"author_id": 448287,
"author_profile": "https://Stackoverflow.com/users/448287",
"pm_score": 7,
"selected": false,
"text": "Application supports iTunes file sharing"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/100959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
100,976 | <p>I have an application in which a gecko browser is embedded. The application is crashing when I try to access any https url's because nss is not properly initialised at this point. The crash is in PK11_TokenExists(). I want to block my browser from rendering https sites. If a user clicks on a https link I can block that load in OnStartURI() of nsIURIContentListener.But if the user types in say orkut.com I wont know in OnStartURI() whether its a http url or a https one(i.e. whether it will use SSL or not). I wanted to know how I can block https url's in such cases? </p>
<p>Thanks
jbsp72</p>
| [
{
"answer_id": 2418646,
"author": "NineBerry",
"author_id": 101087,
"author_profile": "https://Stackoverflow.com/users/101087",
"pm_score": 1,
"selected": false,
"text": "OnStateChange"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/100976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
100,990 | <p>How could I get the Fault Detail sent by a SoapFaultClientException ?
I use a WebServiceTemplate as shown below :</p>
<pre><code>WebServiceTemplate ws = new WebServiceTemplate();
ws.setMarshaller(client.getMarshaller());
ws.setUnmarshaller(client.getUnMarshaller());
try {
MyResponse resp = (MyResponse) = ws.marshalSendAndReceive(WS_URI, req);
} catch (SoapFaultClientException e) {
SoapFault fault = e.getSoapFault();
SoapFaultDetail details = e.getSoapFault().getFaultDetail();
//details always NULL ? Bug?
}
</code></pre>
<p>The Web Service Fault sent seems correct :</p>
<pre><code><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Validation error</faultstring>
<faultactor/>
<detail>
<ws:ValidationError xmlns:ws="http://ws.x.y.com">ERR_UNKNOWN</ws:ValidationError>
</detail>
</soapenv:Fault>
</soapenv:Body>
</code></pre>
<p></p>
<p>Thanks</p>
<p>Willome</p>
| [
{
"answer_id": 11082098,
"author": "holmis83",
"author_id": 1463522,
"author_profile": "https://Stackoverflow.com/users/1463522",
"pm_score": 3,
"selected": false,
"text": "private Element getDetail(SoapFaultClientException e) throws TransformerException {\n TransformerFactory transfo... | 2008/09/19 | [
"https://Stackoverflow.com/questions/100990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18714/"
] |
100,993 | <p>I'm new to both Web Services and RMI and I wonder which is the better way to do remoting between different web applications, when these applications are all written in Java, that is when different programming languages don't matter (which would be the advantage of WS).</p>
<p>While on the one hand I would guess that there's a performance overhead when using web services (does anyone have some numbers to prove that?), on the other hand it seems to me that web services are much more loosely coupled and can be used to implement a more service-oriented architecture (SOA) (which isn't possible with RMI, right?).</p>
<p>Although this is quite a general question, what's your opinion?</p>
<p>Thanks</p>
| [
{
"answer_id": 36574041,
"author": "Steve O 1969",
"author_id": 5605103,
"author_profile": "https://Stackoverflow.com/users/5605103",
"pm_score": 1,
"selected": false,
"text": "org.springframework.remoting.rmi.RmiServiceExporter\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/100993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18722/"
] |
101,012 | <p>Our rails app is designed as a single code base linking to multiple client databases. Based on the subdomain the app determines which db to connect to.</p>
<p>We use liquid templates to customise the presentation for each client. We are unable to customise the generic 'We're Sorry, somethign went wrong..' message for each client.</p>
<p>Can anyone recommend an approach that would allow us to do this.</p>
<p>Thanks</p>
<p>DOm</p>
| [
{
"answer_id": 101027,
"author": "mislav",
"author_id": 11687,
"author_profile": "https://Stackoverflow.com/users/11687",
"pm_score": 4,
"selected": true,
"text": "rescue_from"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,029 | <p>Do you know of any compilers that only requires one or two clicks on the source code to compile? Having to configure it to do it doesn't count, nor does having to go to a terminal and write a word or two.</p>
<p>Extra points are given if you can give your own view as to why so few compilers have a gui included, or just a send to compiler listing in explorer!</p>
<p>The reason is that I want to be able to send source to my non-programming friends. Some have sparc computers, some have x64 with multiple cores and so on. </p>
<p>Then they would be able to compile the code and then remove it, saving just the binary that is optimized for their computer.</p>
| [
{
"answer_id": 101173,
"author": "Jez",
"author_id": 15478,
"author_profile": "https://Stackoverflow.com/users/15478",
"pm_score": 0,
"selected": false,
"text": "make"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17500/"
] |
101,033 | <p>I want to create a stored procedure with one argument which will return different sets of records depending on the argument. What is the way to do this? Can I call it from plain SQL?</p>
| [
{
"answer_id": 101064,
"author": "Thilo",
"author_id": 14955,
"author_profile": "https://Stackoverflow.com/users/14955",
"pm_score": 5,
"selected": false,
"text": "create function test_cursor \n return sys_refcursor\n is\n c_result sys_refcursor;\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,038 | <p>I have a Win32 TreeCtrl where the user can rename the tree labels. I process the TVN_ENDLABELEDIT message to do this.</p>
<p>In certain cases I need to change the text that the user entered. Basically the user can enter a short name during edit and I want to replace it with a longer text.</p>
<p>To do this I change the pszText member of the TVITEM struct I received during TVN_ENDLABELEDIT. I do a pointer replace here, as the original memory may be too small to do a simple strcpy like operation.</p>
<p>However I do not know how to deallocate the original pszText member. Basically because it's unknown if that was created with malloc() or new ... therefore I cannot call the appropriate deallocator. Obviously Win32 won't call the deallocator for the old pszText because the pointer has been replaced. So if I don't deallocate, there will be a memory leak.</p>
<p>Any idea how Win32 allocate these structs and what is the proper way to handle the above situation?</p>
| [
{
"answer_id": 101088,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 2,
"selected": false,
"text": "LPSTR_TEXTCALLBACK"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,046 | <p>I cannot understand the Oracle documentation. :-(</p>
<p>Does anybody know how to fetch multiple rows of simple data from Oracle via OCI?</p>
<p>I currently use <code>OCIDefineByPos</code> to define single variables (I only need to do this for simple integers -- <code>SQLT_INT</code>/4-byte ints) and then fetch a single row at a time with <code>OCIStmtExecute</code>/<code>OCIStmtFetch2</code>.</p>
<p>This is OK for small amounts of data but it takes around .5ms per row, so when reading a few ten thousand rows this is too slow.</p>
<p>I just don't understand the documentation for <code>OCIBindArrayOfStruct</code>. How can I fetch a few thousand rows at a time?</p>
| [
{
"answer_id": 101088,
"author": "ChrisN",
"author_id": 3853,
"author_profile": "https://Stackoverflow.com/users/3853",
"pm_score": 2,
"selected": false,
"text": "LPSTR_TEXTCALLBACK"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6525/"
] |
101,055 | <p>What makes a language a scripting language? I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language. Is that the only criterion? Or are there other criteria?</p>
<h3>See also:</h3>
<ul>
<li><a href="https://stackoverflow.com/questions/98268/whats-the-difference-between-a-script-and-an-application">What’s the difference between a “script” and an “application”?</a></li>
</ul>
| [
{
"answer_id": 101075,
"author": "Grey Panther",
"author_id": 1265,
"author_profile": "https://Stackoverflow.com/users/1265",
"pm_score": 3,
"selected": false,
"text": "perl my_source.pl"
},
{
"answer_id": 1281922,
"author": "Paul Biggar",
"author_id": 104021,
"author... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6400/"
] |
101,066 | <p><strong>EDIT</strong></p>
<p>What small things which are too easy to overlook do I need to do before deploying a rails application? </p>
<p>I have set up <a href="https://stackoverflow.com/questions/101275/what-do-i-need-to-do-on-deployment-of-a-rails-application">another question</a> for any task that takes more than a minute or two, and so ought to be scheduled into a deployment process. In this question I'm mostly concerned with on-line config options and similar, that can be done, but are often left out in during the development cycle because they don't make any difference until deployment</p>
| [
{
"answer_id": 101315,
"author": "Laurie Young",
"author_id": 7473,
"author_profile": "https://Stackoverflow.com/users/7473",
"pm_score": 4,
"selected": true,
"text": "rake gems:unpack"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] |
101,070 | <p>If you are writing a <em>simple</em> little loop, what <em>should</em> you name the counter?</p>
<p><em>Provide example loops!</em></p>
| [
{
"answer_id": 101071,
"author": "just mike",
"author_id": 12293,
"author_profile": "https://Stackoverflow.com/users/12293",
"pm_score": 4,
"selected": false,
"text": "i"
},
{
"answer_id": 101098,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https:... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12293/"
] |
101,072 | <p>Was this an oversight? Or is it to do with the JVM?</p>
| [
{
"answer_id": 692078,
"author": "David Citron",
"author_id": 5309,
"author_profile": "https://Stackoverflow.com/users/5309",
"pm_score": 6,
"selected": true,
"text": "Object myObj = new Object();\n"
},
{
"answer_id": 6227525,
"author": "Stephen C",
"author_id": 139985,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4857/"
] |
101,079 | <p>I used to work in a place where a common practice was to use Pair Programming. I remember how many small things we could learn from each other when working together on the code. Picking up new shortcuts, code snippets etc. with time significantly improved our efficiency of writing code.</p>
<p>Since I started working with SQL Server I have been left on my own. The best habits I would normally pick from working together with other people which I cannot do now.</p>
<p>So here is the question:</p>
<ul>
<li>What are you tips on efficiently
writing TSQL code using SQL Server
Management Studio? </li>
<li>Please keep the
tips to 2 – 3 things/shortcuts that
you think improve you speed of
coding </li>
<li>Please stay within the scope
of TSQL and SQL Server Management
Studio 2005/2008 If the feature is
specific to the version of
Management Studio please indicate:
e.g. “Works with SQL Server 2008
only"</li>
</ul>
<p><strong>EDIT:</strong></p>
<p>I am afraid that I could have been misunderstood by some of you.
I am not looking for tips for writing efficient TSQL code but rather for advice on how to efficiently use Management Studio to speed up the coding process itself. </p>
<p>The type of answers that I am looking for are: </p>
<ul>
<li>use of templates, </li>
<li>keyboard-shortcuts, </li>
<li>use of IntelliSense plugins etc. </li>
</ul>
<p>Basically those little things that make the coding experience a bit more efficient and pleasant.</p>
| [
{
"answer_id": 101091,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 5,
"selected": false,
"text": "DELETE"
},
{
"answer_id": 102316,
"author": "HLGEM",
"author_id": 9034,
"author_profile": "https://Sta... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3241/"
] |
101,096 | <p>I have an Exchange mailbox linked as a table in an MS Access app. This is primarily used for reading, but I would also like to be able to "move" messages to another folder. </p>
<p>Unfortunately this is not as simple as writing in a second linked mailbox, because apparently I can not edit some fields. Some critical fields like the To: field are unavailable, as I get the following error </p>
<p><em>"Field 'To' is based on an expression and cannot be edited".</em> </p>
<p>Using <em>CreateObject("Outlook.Application")</em> instead is not an option here, because as far as I know, this gives a security dialog when called from Access.</p>
<p>Any solutions?*</p>
| [
{
"answer_id": 102406,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 1,
"selected": false,
"text": " Set oApp = CreateObject(\"Outlook.Application\")\n\nSet oNS = oApp.GetNamespace(\"MAPI\")\n\nSet oMailItems = oNS.GetDefa... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,100 | <p>Can anyone recommend a simple API that will allow me to use read a CSV input file, do some simple transformations, and then write it.</p>
<p>A quick google has found <a href="http://flatpack.sourceforge.net/" rel="noreferrer">http://flatpack.sourceforge.net/</a> which looks promising.</p>
<p>I just wanted to check what others are using before I couple myself to this API.</p>
| [
{
"answer_id": 105649,
"author": "Jay R.",
"author_id": 5074,
"author_profile": "https://Stackoverflow.com/users/5074",
"pm_score": 6,
"selected": false,
"text": "import au.com.bytecode.opencsv.CSVReader;"
},
{
"answer_id": 2146086,
"author": "kbg",
"author_id": 258315,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10171/"
] |
101,125 | <p>Is there a way to check if the user has a different version of the CSS cached by their browser and if so force their browser to pull the new version?</p>
| [
{
"answer_id": 101131,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 0,
"selected": false,
"text": "<body class=\"style2\">\n\n<body class=\"style1\">\n"
},
{
"answer_id": 101188,
"author": "David Heggie",... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,128 | <p>How do I read text from the (windows) clipboard with python?</p>
| [
{
"answer_id": 101167,
"author": "Sakin",
"author_id": 12818,
"author_profile": "https://Stackoverflow.com/users/12818",
"pm_score": 8,
"selected": true,
"text": "import win32clipboard\n\n# set clipboard data\nwin32clipboard.OpenClipboard()\nwin32clipboard.EmptyClipboard()\nwin32clipboar... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17493/"
] |
101,145 | <p>How can someone validate that a specific element exists in an XML file? Say I have an ever changing XML file and I need to verify every element exists before reading/parsing it. </p>
| [
{
"answer_id": 101160,
"author": "Chris James",
"author_id": 3193,
"author_profile": "https://Stackoverflow.com/users/3193",
"pm_score": 6,
"selected": false,
"text": "if(doc.SelectSingleNode(\"//mynode\")==null)....\n"
},
{
"answer_id": 6649224,
"author": "sangam",
"auth... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,151 | <p>I have the following scenario:</p>
<pre>
public class CarManager
{
..
public long AddCar(Car car)
{
try
{
string username = _authorizationManager.GetUsername();
...
long id = _carAccessor.AddCar(username, car.Id, car.Name, ....);
if(id == 0)
{
throw new Exception("Car was not added");
}
return id;
} catch (Exception ex) {
throw new AddCarException(ex);
}
}
public List AddCars(List cars)
{
List ids = new List();
foreach(Car car in cars)
{
ids.Add(AddCar(car));
}
return ids;
}
}
</pre>
<p>I am mocking out _reportAccessor, _authorizationManager etc.</p>
<p>Now I want to unittest the CarManager class.
Should I have multiple tests for AddCar() such as </p>
<pre>
AddCarTest()
AddCarTestAuthorizationManagerException()
AddCarTestCarAccessorNoId()
AddCarTestCarAccessorException()
</pre>
<p>For AddCars() should I repeat all previous tests as AddCars() calls AddCar() - it seems like repeating oneself? Should I perhaps not be calling AddCar() from AddCars()? < p/></p>
<p>Please help.</p>
| [
{
"answer_id": 101438,
"author": "Josh Freed",
"author_id": 14548,
"author_profile": "https://Stackoverflow.com/users/14548",
"pm_score": 1,
"selected": false,
"text": "AddCarTestAuthorizationManagerException()"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15771/"
] |
101,156 | <p>I need to count and check how much of some images is placed in folder od web server.
Example- images get names from <code>user_id</code>, and on example I have <code>user_id 27</code>, and my images are:</p>
<pre><code>27_1.jpg, 27_2.jpg, 27_3.jpg, ...
</code></pre>
<p>How to check and write to database this thing?</p>
<p>Thanks</p>
| [
{
"answer_id": 101230,
"author": "hometoast",
"author_id": 2009,
"author_profile": "https://Stackoverflow.com/users/2009",
"pm_score": 2,
"selected": false,
"text": "IO.Directory.GetFiles(\"\\translated\\path\",\"27_*.jpg\").Count()\n"
},
{
"answer_id": 101236,
"author": "Web... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205368/"
] |
101,162 | <p>How do you return a serialized JSON object to the client side using ASP.NET MVC via an AJAX call?</p>
| [
{
"answer_id": 101256,
"author": "David Bick",
"author_id": 4914,
"author_profile": "https://Stackoverflow.com/users/4914",
"pm_score": 6,
"selected": true,
"text": "public ActionResult MyAction()\n{\n ... // Populate myObject\n return new JsonResult{ Data = myObject };\n}\n"
},
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,174 | <p>In Python there is a really neat function called <code>zip</code> which can be used to iterate through two lists at the same time:</p>
<pre><code>list1 = [1, 2, 3]
list2 = ["a", "b", "c"]
for v1, v2 in zip(list1, list2):
print v1 + " " + v2
</code></pre>
<p>The above code should produce the following:</p>
<pre>1 a
2 b
3 c</pre>
<p>I wonder if there is a method like it available in .Net? I'm thinking about writing it myself, but there is no point if it's already available.</p>
| [
{
"answer_id": 101207,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 3,
"selected": false,
"text": "class Pair<T1, T2>\n{\n public T1 First { get; set;}\n public T2 Second { get; set;}\n}\n\nstatic IEnumerable<Pair<T1, T2>... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16047/"
] |
101,180 | <p>I need to communicate with an XML-RPC server from a .NET 2.0 client. Can you recommend any libraries?</p>
<p>EDIT: Having tried XML-RPC.Net, I like the way it generates dynamic proxies, it is very neat. Unfortunately, as always, things are not so simple. I am accessing an XML-RPC service which uses the unorthodox technique of having object names in the names of the methods, like so:</p>
<pre><code>object1.object2.someMethod(string1)
</code></pre>
<p>This means I can't use the attributes to set the names of my methods, as they are not known until run-time. If you start trying to get closer to the raw calls, XML-RPC.Net starts to get pretty messy.</p>
<p>So, anyone know of a simple and straightforward XML-RPC library that'll just let me do (pseudocode):</p>
<pre><code>x = new xmlrpc(host, port)
x.makeCall("methodName", "arg1");
</code></pre>
<p>I had a look at a thing by Michael somebody on Codeproject, but there are no unit tests and the code looks pretty dire.</p>
<p>Unless someone has a better idea looks like I am going to have to start an open source project myself!</p>
| [
{
"answer_id": 375036,
"author": "Troy J. Farrell",
"author_id": 26244,
"author_profile": "https://Stackoverflow.com/users/26244",
"pm_score": 3,
"selected": true,
"text": "ISumAndDiff proxy = (ISumAndDiff)XmlRpcProxyGen.Create(typeof(ISumAndDiff));\nproxy.XmlRpcMethod = \"Id1234_SumAndD... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16881/"
] |
101,184 | <p>I'm building an installer for an application. The user gets to select a datasource they have configured and nominate what type of database it is. I want to confirm that the database type is indeed Oracle, and if possible, what version of Oracle they are running by sending a SQL statement to the datasource.</p>
| [
{
"answer_id": 101197,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 9,
"selected": true,
"text": "select * from v$version;\n"
},
{
"answer_id": 101240,
"author": "Peter Lang",
"author_id": 17343,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10750/"
] |
101,195 | <p>I'm playing with the wonderful <a href="http://hudson.gotdns.com/wiki/display/HUDSON/FindBugs+Plugin" rel="nofollow noreferrer">FindBugs plugin</a> for <a href="http://hudson-ci.org/" rel="nofollow noreferrer">Hudson</a>. Ideally, I'd like to have the build fail if FindBugs finds any problems. Is this possible?</p>
<p>Please, don't try and tell me that "0 warnings" is unrealistic with FindBugs. We've been using FindBugs from Ant for a while and we usually do maintain 0 warnings. We achieve this through the use of general exclude filters and specific/targeted annotations.</p>
| [
{
"answer_id": 142245,
"author": "Tom",
"author_id": 22850,
"author_profile": "https://Stackoverflow.com/users/22850",
"pm_score": 2,
"selected": false,
"text": "<findbugs ... warningsProperty=\"findbugsFailure\"/>"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
101,196 | <p>Is there a way to trigger a garbage collection in a .NET process from another process or from inside WinDBG?</p>
<p>There are the Managed Debugging Assistants that force a collection as you move across a native/managed boundary, and <a href="http://en.wikipedia.org/wiki/AQtime" rel="noreferrer">AQTime</a> seems to have button that suggests it does this, but I can't find any documentation on how to do it.</p>
| [
{
"answer_id": 35159075,
"author": "Eric Boumendil",
"author_id": 249742,
"author_profile": "https://Stackoverflow.com/users/249742",
"pm_score": 4,
"selected": false,
"text": "PerfView.exe ForceGC [ProcessName | Process ID] /AcceptEULA\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5764/"
] |
101,198 | <p>I'm building an installer for an application. The user gets to select a datasource they have configured and nominate what type of database it is. I want to confirm that the database type is indeed Postgres, and if possible, what version of Postgres they are running by sending a SQL statement to the datasource.</p>
| [
{
"answer_id": 101210,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 2,
"selected": false,
"text": "SELECT version();\n"
},
{
"answer_id": 101214,
"author": "Matthias Kestenholz",
"author_id": 317346,
"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10750/"
] |
101,212 | <p>Net::HTTP can be rather cumbersome for the standard use case!</p>
| [
{
"answer_id": 101542,
"author": "Aaron Hinni",
"author_id": 12086,
"author_profile": "https://Stackoverflow.com/users/12086",
"pm_score": 3,
"selected": false,
"text": "gem install rest-open-uri\n"
},
{
"answer_id": 101680,
"author": "Clinton Dreisbach",
"author_id": 626... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18751/"
] |
101,223 | <p>I have a pivot table on an olap cube. I can go into a page field and manually deselect multiple items. How can I do this in VBA based on a list of items I need excluded? (n.b. I do not have a corrresponding list of items I need included)</p>
<p>I know how to exclude these items in other ways, by altering the underlying query for example. I specifically want to replicate the user action of deselecting items in the pivot.</p>
| [
{
"answer_id": 101464,
"author": "juan",
"author_id": 1782,
"author_profile": "https://Stackoverflow.com/users/1782",
"pm_score": 0,
"selected": false,
"text": "((MOE.PivotField)pivotTableObject.PivotFields(\"[NAME]\")).Delete();\n"
},
{
"answer_id": 102734,
"author": "Hobbo"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6387/"
] |
101,238 | <p>I've got many assemblies/projects in the same c#/.net solution. A setting needs to be saved by people using the web application gui, and then a console app and some test projects need to access the same file. Where should I put the file and how to access it?</p>
<p>I've tried using "AppDomain.CurrentDomain.BaseDirectory" but that ends up being different for my assemblies. Also the "System.Reflection.Assembly.Get*Assembly.Location" fail to give me what I need.</p>
<p>Maybe this isn't something I should but in a file, but rather the database? But it feels so complicated doing that for a few lines of configuration.</p>
| [
{
"answer_id": 101287,
"author": "Pop Catalin",
"author_id": 4685,
"author_profile": "https://Stackoverflow.com/users/4685",
"pm_score": 2,
"selected": false,
"text": " Path.Combine(\n Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),\n \"[Compa... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3397/"
] |
101,244 | <pre><code>/etc/init.d/*
/etc/rc{1-5}.d/*
</code></pre>
| [
{
"answer_id": 101246,
"author": "px.",
"author_id": 18769,
"author_profile": "https://Stackoverflow.com/users/18769",
"pm_score": 2,
"selected": false,
"text": "/sbin/chkconfig"
},
{
"answer_id": 101277,
"author": "dsm",
"author_id": 7780,
"author_profile": "https://... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18769/"
] |
101,258 | <p>I want to search for <code>$maximumTotalAllowedAfterFinish</code> and replace it with <code>$minimumTotalAllowedAfterFinish</code>. Instead of typing the long text:</p>
<pre><code>:%s/$maximumTotalAllowedAfterFinish/$minimumTotalAllowedAfterFinish/g
</code></pre>
<p>Is there a way to COPY these long variable names down into the search line, since, on the command line I can't type "<code>p</code>" to paste?</p>
| [
{
"answer_id": 101281,
"author": "Johannes Hoff",
"author_id": 3102,
"author_profile": "https://Stackoverflow.com/users/3102",
"pm_score": 4,
"selected": false,
"text": "q:"
},
{
"answer_id": 101285,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stac... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] |
101,265 | <p>Inspired by another question asking about the missing <code>Zip</code> function:</p>
<p>Why is there no <code>ForEach</code> extension method on the <code>IEnumerable</code> interface? Or anywhere? The only class that gets a <code>ForEach</code> method is <code>List<></code>. Is there a reason why it's missing, maybe performance?</p>
| [
{
"answer_id": 101278,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 6,
"selected": false,
"text": "public static void ForEach<T>(\n this IEnumerable<T> source,\n Action<T> action)\n{\n foreach (T element in source) \n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3820/"
] |
101,267 | <p>When I used to write libraries in C/C++ I got into the habit of having a method to return the compile date/time. This was always a compiled into the library so would differentiate builds of the library. I got this by returning a #define in the code:</p>
<p>C++:</p>
<pre><code>#ifdef _BuildDateTime_
char* SomeClass::getBuildDateTime() {
return _BuildDateTime_;
}
#else
char* SomeClass::getBuildDateTime() {
return "Undefined";
}
#endif
</code></pre>
<p>Then on the compile I had a '-D_BuildDateTime_=<code>Date</code>' in the build script.</p>
<p>Is there any way to achieve this or similar in Java without needing to remember to edit any files manually or distributing any seperate files.</p>
<p>One suggestion I got from a co-worker was to get the ant file to create a file on the classpath and to package that into the JAR and have it read by the method. </p>
<p>Something like (assuming the file created was called 'DateTime.dat'):</p>
<pre><code>// I know Exceptions and proper open/closing
// of the file are not done. This is just
// to explain the point!
String getBuildDateTime() {
return new BufferedReader(getClass()
.getResourceAsStream("DateTime.dat")).readLine();
}
</code></pre>
<p>To my mind that's a hack and could be circumvented/broken by someone having a similarly named file <em>outside</em> the JAR, but on the classpath.</p>
<p>Anyway, my question is whether there is any way to inject a constant into a class at compile time</p>
<p>EDIT</p>
<p>The reason I consider using an externally generated file in the JAR a hack is because this <em>is</em>) a library and will be embedded in client apps. These client apps may define their own classloaders meaning I can't rely on the standard JVM class loading rules.</p>
<p>My personal preference would be to go with using the date from the JAR file as suggested by serg10.</p>
| [
{
"answer_id": 101293,
"author": "basszero",
"author_id": 287,
"author_profile": "https://Stackoverflow.com/users/287",
"pm_score": 1,
"selected": false,
"text": "Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(\"META-INF/MANIFEST.MF\");\n"
},
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18744/"
] |
101,268 | <p>What are the lesser-known but useful features of the Python programming language?</p>
<ul>
<li>Try to limit answers to Python core.</li>
<li>One feature per answer.</li>
<li>Give an example and short description of the feature, not just a link to documentation.</li>
<li>Label the feature using a title as the first line.</li>
</ul>
<h2>Quick links to answers:</h2>
<ul>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#111176">Argument Unpacking</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#112303">Braces</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101945">Chaining Comparison Operators</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101447">Decorators</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#113198">Default Argument Gotchas / Dangers of Mutable Default arguments</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#102062">Descriptors</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#111970">Dictionary default <code>.get</code> value</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#102065">Docstring Tests</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python/112316#112316">Ellipsis Slicing Syntax</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#117116">Enumeration</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#114420">For/else</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#102202">Function as iter() argument</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101310">Generator expressions</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101276"><code>import this</code></a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#102037">In Place Value Swapping</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101840">List stepping</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#112286"><code>__missing__</code> items</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101537">Multi-line Regex</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#113164">Named string formatting</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101549">Nested list/generator comprehensions</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#108297">New types at runtime</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#113833"><code>.pth</code> files</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#1024693">ROT13 Encoding</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#143636">Regex Debugging</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#101739">Sending to Generators</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#168270">Tab Completion in Interactive Interpreter</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#116480">Ternary Expression</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#114157"><code>try/except/else</code></a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#3267903">Unpacking+<code>print()</code> function</a></li>
<li><a href="https://stackoverflow.com/questions/101268/hidden-features-of-python#109182"><code>with</code> statement</a></li>
</ul>
| [
{
"answer_id": 101276,
"author": "cleg",
"author_id": 29503,
"author_profile": "https://Stackoverflow.com/users/29503",
"pm_score": 7,
"selected": false,
"text": "import this\n# btw look at this module's source :)\n"
},
{
"answer_id": 101280,
"author": "Oko",
"author_id":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2679/"
] |
101,270 | <p>I want to use Vim's quickfix features with the output from Visual Studio's devenv build process or msbuild.</p>
<p>I've created a batch file called build.bat which executes the devenv build like this:</p>
<pre><code>devenv MySln.sln /Build Debug
</code></pre>
<p>In vim I've pointed the :make command to that batch file:</p>
<pre><code>:set makeprg=build.bat
</code></pre>
<p>When I now run :make, the build executes successfully, however the errors don't get parsed out. So if I run :cl or :cn I just end up seeing all the output from devenv /Build. I should see only the errors.</p>
<p>I've tried a number of different errorformat settings that I've found on various sites around the net, but none of them have parsed out the errors correctly. Here's a few I've tried:</p>
<pre><code>set errorformat=%*\\d>%f(%l)\ :\ %t%[A-z]%#\ %m
set errorformat=\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m
set errorformat=%f(%l,%c):\ error\ %n:\ %f
</code></pre>
<p>And of course I've tried Vim's default.</p>
<p>Here's some example output from the build.bat:</p>
<pre><code>C:\TFS\KwB Projects\Thingy>devenv Thingy.sln /Build Debug
Microsoft (R) Visual Studio Version 9.0.30729.1.
Copyright (C) Microsoft Corp. All rights reserved.
------ Build started: Project: Thingy, Configuration: Debug Any CPU ------
c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Linq.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\UIAutomationProvider.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Thingy.exe /resource:obj\Debug\Thingy.g.resources /resource:obj\Debug\Thingy.Properties.Resources.resources /target:winexe App.xaml.cs Controller\FieldFactory.cs Controller\UserInfo.cs Data\ThingGatewaySqlDirect.cs Data\ThingListFetcher.cs Data\UserListFetcher.cs Gui\FieldList.xaml.cs Interfaces\IList.cs Interfaces\IListFetcher.cs Model\ComboBoxField.cs Model\ListValue.cs Model\ThingType.cs Interfaces\IThingGateway.cs Model\Field.cs Model\TextBoxField.cs Model\Thing.cs Gui\MainWindow.xaml.cs Gui\ThingWindow.xaml.cs Interfaces\IField.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs RequiredValidation.cs "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\Gui\FieldList.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\Gui\MainWindow.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\Gui\ThingWindow.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\App.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\GeneratedInternalTypeHelper.g.cs"
C:\TFS\KwB Projects\Thingy\Thingy\Controller\FieldFactory.cs(14,19): error CS0246: The type or namespace name 'IFieldNothing' could not be found (are you missing a using directive or an assembly reference?)
Compile complete -- 1 errors, 0 warnings
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
</code></pre>
<p><strong>UPDATE:</strong>
It looks like using msbuild instead of devenv is probably the right way to go (as per Jay's comment).</p>
<p>Using msbuild the makeprg would be:</p>
<pre><code>:set makeprg=msbuild\ /nologo\ /v:q
</code></pre>
<p>Sample output whould be:</p>
<pre><code>Controller\FieldFactory.cs(14,19): error CS0246: The type or namespace name 'IFieldNothing' could not be found (are you missing a using directive or an assembly reference?)
</code></pre>
<p>It looks like the tricky part here may lie in the fact that the path is relative to the .csproj file, not the .sln file which is the current directory in Vim and lies one directory above the .csproj file.</p>
<p><strong>ANSWER:</strong>
I figured it out...</p>
<pre><code>set errorformat=\ %#%f(%l\\\,%c):\ %m
</code></pre>
<p>This will capture the output for both devenv /Build and msbuild.
However, msbuild has one catch. By default, it's output doesn't include full paths. To fix this you have to add the following line to your csproj file's main PropertyGroup:</p>
<pre><code><GenerateFullPaths>True</GenerateFullPaths>
</code></pre>
| [
{
"answer_id": 102454,
"author": "Jay Bazuzi",
"author_id": 5314,
"author_profile": "https://Stackoverflow.com/users/5314",
"pm_score": 1,
"selected": false,
"text": "msbuild MySln.sln /Configuration:Debug"
},
{
"answer_id": 161090,
"author": "Simon Buchan",
"author_id": ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4407/"
] |
101,326 | <p>I've set up wildcard mapping on IIS 6, by adding "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll", and ensured "Verify that file exists" is not checked :</p>
<ul>
<li>on the "websites" directory in IIS</li>
<li>on the website</li>
</ul>
<p>However, after a iisreset, when I go to <a href="http://myserver/something.gif" rel="nofollow noreferrer">http://myserver/something.gif</a>, I still get IIS 404 error, not asp.net one.</p>
<p>Is there something I missed ?</p>
<p>Precisions:</p>
<ul>
<li>this is not for using ASP.NET MVC</li>
<li>i'd rather not use iis 404 custom error pages, as I have a httpmodule for logging errors (this is a low traffic internal site, so wildcard mapping performance penalty is not a problem ;))</li>
</ul>
| [
{
"answer_id": 103661,
"author": "Christopher G. Lewis",
"author_id": 13532,
"author_profile": "https://Stackoverflow.com/users/13532",
"pm_score": 3,
"selected": true,
"text": " <system.web>\n <httpHandlers>\n <add path=\"*.gif\" verb=\"GET,HEAD\" type=\"System.Web.StaticFileHa... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/971/"
] |
101,329 | <p>In particular, wouldn't there have to be some kind of function pointer in place anyway? </p>
| [
{
"answer_id": 101349,
"author": "m_pGladiator",
"author_id": 446104,
"author_profile": "https://Stackoverflow.com/users/446104",
"pm_score": 2,
"selected": false,
"text": "virtual"
},
{
"answer_id": 101583,
"author": "Richard Corden",
"author_id": 11698,
"author_prof... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
101,338 | <p>Is it valid to have a 'choice' of 'group' elements when defining an XML Schema (XSD)</p>
<p>i.e. is the following valid</p>
<pre><code><xs:complexType name="HeaderType">
<xs:sequence>
<xs:element name="reservation-number" type="ReservationNumberType" minOccurs="1" maxOccurs="1" nillable="false" />
<xs:choice minOccurs="1" maxOccurs="1">
<xs:group ref="ReservationGroup" />
<xs:group ref="CancellationGroup"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</code></pre>
<p>Where an XML message can represent, for example, either a new reservation or a cancellation of an existing reservation.</p>
<p>If the message is for a reservation, then it must include all the elements defined in the ReservationGroup group.</p>
<p>If it is a cancellation, then it must include all the elements defined in the CancellationGroup group.</p>
<p>For some reason, my XML editor (Eclipse) does not like this, but does not indicate why. It shows there being an error on the line <xs:complexType name="HeaderType"> but does not say what the error is</p>
| [
{
"answer_id": 101772,
"author": "Dunderklumpen",
"author_id": 16239,
"author_profile": "https://Stackoverflow.com/users/16239",
"pm_score": 4,
"selected": true,
"text": "<xs:group name=\"ReservationGroup\">\n <xs:sequence>\n <xs:element name=\"date\"/>\n <xs:element nam... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15452/"
] |
101,362 | <p>How do you generate passwords?</p>
<ul>
<li>Random Characters?</li>
<li>Passphrases?</li>
<li>High Ascii?</li>
</ul>
<p>Something like this?</p>
<pre><code>cat /dev/urandom | strings
</code></pre>
| [
{
"answer_id": 101368,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 4,
"selected": false,
"text": "#!/usr/bin/env python\n\nfrom random import choice\nimport getopt\nimport string\nimport sys\n\ndef GenPasswd():\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18769/"
] |
101,363 | <p>I'm using Castle Windsor for dependency injection in my test project. I'm trying to create an instance one of my 'Repository' classes. "It works fine on my machine", but when I run a nightly build in TFS, my tests are not able to load said classes.</p>
<pre><code>private static readonly WindsorContainer _container = new WindsorContainer(new XmlInterpreter());
public void MyTestInitialize()
{
var testRepository = (IBogusRepository)_container[typeof(IBogusRepository)];
}
</code></pre>
<p>xml configuration:</p>
<pre><code><castle>
<components>
<component id="primaryBogusRepository" type="Example2008.Repository.LALALALALA, Example2008.Repository" service="Example2008.Domain.Repository.IBogusRepository, Example2008.Domain" />
<component id="primaryProductRepository" type="Example2008.Repository.ProductRepository, Example2008.Repository" service="Example2008.Domain.Repository.IProductRepository, Example2008.Domain" />
</components>
</castle>
</code></pre>
<p>When I queue a new build it produces
the following message:</p>
<blockquote>
<p>Unable to create instance of class
Example2008.Test.ActiveProductRepositoryTest. Error:
System.Configuration.ConfigurationException:
The type name
Example2008.Repository.LALALALALA,
Example2008.Repository could not be
located.</p>
<p>Castle.Windsor.Installer.DefaultComponentInstaller.ObtainType(String
typeName)
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpComponents(IConfiguration[]
configurations, IWindsorContainer
container)
Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer
container, IConfigurationStore store)
Castle.Windsor.WindsorContainer.RunInstaller()
Castle.Windsor.WindsorContainer..ctor(IConfigurationInterpreter
interpreter)
Example2008.Test.ActiveProductRepositoryTest..cctor()
in d:\Code_Temp\Example Project
Nightly\Sources\Example2008.Test\ProductRepositoryTest.cs:
line 19</p>
</blockquote>
<p>From this message, it seems that my configuration is correct (it can see that I want to instantiate the concrete class 'LALALALALA', so the xml configuration has obviously been red correctly)</p>
<p>I think I have my dependencies set up correctly as well (because it works locally, even if I clean the solution and rebuild).</p>
<p>Any thoughts?</p>
<p>(using VS2008, TFS 2008.Net 3.5, Castle 1.03, by the way) </p>
| [
{
"answer_id": 101368,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 4,
"selected": false,
"text": "#!/usr/bin/env python\n\nfrom random import choice\nimport getopt\nimport string\nimport sys\n\ndef GenPasswd():\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12756/"
] |
101,386 | <p>Does PHP have a method of having auto-generated class variables? I <em>think</em> I've seen something like this before but I'm not certain.</p>
<pre><code>public class TestClass {
private $data = array();
public function TestClass() {
$this->data['firstValue'] = "cheese";
}
}
</code></pre>
<p>The <code>$this->data</code> array is always an associative array but they keys change from class to class. Is there any viable way to access <code>$this->data['firstValue']</code> from <code>$this->firstValue</code> without having to define the link?</p>
<p>And if it is, are there any downsides to it?</p>
<p>Or is there a static method of defining the link in a way which won't explode if the <code>$this->data</code> array doesn't contain that key?</p>
| [
{
"answer_id": 131455,
"author": "David Stockton",
"author_id": 21897,
"author_profile": "https://Stackoverflow.com/users/21897",
"pm_score": 3,
"selected": false,
"text": "__get()"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12870/"
] |
101,422 | <p>Why does the JavaScript function <code>encodeURIComponent</code> encode spaces to the hex Unicode value <code>%20</code> instead of <code>+</code>. Should URI parameters not spaces to <code>+</code>?
</p>
| [
{
"answer_id": 1590896,
"author": "user192649",
"author_id": 192649,
"author_profile": "https://Stackoverflow.com/users/192649",
"pm_score": 0,
"selected": false,
"text": "items = (A beautiful world)\nforeach( item in $items ) echo \"* $item\"\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18793/"
] |
101,427 | <p>I was wondering are there any security concerns with adding crossdomain.xml to the root of an application server? Can it be added to any other parts of the server and are you aware of any work arounds that dont require the server to have this file in place?</p>
<p>Thanks
Damien</p>
| [
{
"answer_id": 217651,
"author": "Ronnie Liew",
"author_id": 1987,
"author_profile": "https://Stackoverflow.com/users/1987",
"pm_score": 1,
"selected": false,
"text": "http://mysubdomain.mydomain.com/fu/bar/"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11612/"
] |
101,439 | <p>What is the most efficient way given to raise an integer to the power of another integer in C?</p>
<pre><code>// 2^3
pow(2,3) == 8
// 5^5
pow(5,5) == 3125
</code></pre>
| [
{
"answer_id": 101473,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 3,
"selected": false,
"text": "struct IeeeFloat\n{\n\n unsigned int base : 23;\n unsigned int exponent : 8;\n unsigned int signBit : 1;\n};\n\n\nu... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8123/"
] |
101,449 | <p>I'm guessing I need to implement an <code>NVelocityViewEngine</code> and <code>NVelocityView</code> - but before I do I wanted to check to see if anyone has already done this.</p>
<p>I can't see anything in the <a href="http://mvccontrib.googlecode.com/svn/trunk/" rel="nofollow noreferrer">trunk</a> for <a href="http://www.codeplex.com/MVCContrib" rel="nofollow noreferrer">MVCContrib</a>.</p>
<p>I've already seen the post below - I'm looking specifically for something which works with Preview 5:</p>
<ul>
<li><a href="http://www.chadmyers.com/Blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx" rel="nofollow noreferrer">Testing ScottGu: Alternate View Engines with ASP.NET MVC (NVelocity)</a></li>
</ul>
<p>Otherwise I'll start writing one :)</p>
| [
{
"answer_id": 101473,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 3,
"selected": false,
"text": "struct IeeeFloat\n{\n\n unsigned int base : 23;\n unsigned int exponent : 8;\n unsigned int signBit : 1;\n};\n\n\nu... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8542/"
] |
101,460 | <p>At the moment, I am doing a number of searches which include "html" in them, for example "html rearrange". Unfortunately, I get a lot of hits from sites that include "rearrange" on a .html page but have no mention of html in the page itself.</p>
<p>Is there a way to prevent search terms from matching urls?</p>
| [
{
"answer_id": 14548483,
"author": "Cinder",
"author_id": 1291313,
"author_profile": "https://Stackoverflow.com/users/1291313",
"pm_score": 1,
"selected": false,
"text": "rearrange intext:html"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6445/"
] |
101,461 | <p>Most languages (Ruby included) allow number literals to be written in at least three bases: decimal, octal and hexadecimal. Numbers in decimal base is the usual thing and are written as (most) people naturally write numbers, 96 is written as <code>96</code>. Numbers prefixed by a zero are usually interpreted as octal based: 96 would be written as <code>0140</code>. Hexadecimal based numbers are usually prefixed by <code>0x</code>: 96 would be written as <code>0x60</code>.</p>
<p>The question is: can I write numbers as binary literals in Ruby? How?</p>
| [
{
"answer_id": 101479,
"author": "Thelema",
"author_id": 12874,
"author_profile": "https://Stackoverflow.com/users/12874",
"pm_score": 3,
"selected": false,
"text": "0b01011\n"
},
{
"answer_id": 101482,
"author": "Purfideas",
"author_id": 4615,
"author_profile": "http... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17801/"
] |
101,463 | <p>I know how to change the schema of a table in SQL server 2005:</p>
<pre><code>ALTER SCHEMA NewSchama TRANSFER dbo.Table1
</code></pre>
<p>But how can i check and/or alter stored procedures that use the old schema name?</p>
<p>Sorry: I mean:
There are stored procedures that have the old schema name of the table in the sql of the stored procedure... How can i edit all the stored procedures that have the dbo.Table1 in the body of the procedure...</p>
| [
{
"answer_id": 45588910,
"author": "Luqman Cheema",
"author_id": 4411751,
"author_profile": "https://Stackoverflow.com/users/4411751",
"pm_score": 0,
"selected": false,
"text": "CREATE SCHEMA Reporting\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13262/"
] |
101,470 | <p>Does anybody know if there is a feasible way on Windows XP to programmatically create and configure a user account so that after logging in from the console (no terminal services) a specific app is launched and the user is "locked" to that app ?</p>
<p>The user should be prevented from doing anything else with the system (e.g.: no ctrl+alt+canc, no ctrl+shift+esc, no win+e, no nothing).</p>
<p>As an added optional bonus the user should be logged off when the launched app is closed and/or crashes.</p>
<p>Any existing free tool, language or any mixture of them that gets the job done would be fine (batch, VB-script, C, C++, whatever)</p>
| [
{
"answer_id": 483553,
"author": "Chris Becke",
"author_id": 27491,
"author_profile": "https://Stackoverflow.com/users/27491",
"pm_score": 2,
"selected": false,
"text": "[SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\taskmgr.exe]\nDebugger=\"A path to an ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18780/"
] |
101,487 | <p>I have some code which collects points (consed integers) from a loop which looks something like this:</p>
<pre><code>(loop
for x from 1 to 100
for y from 100 downto 1
collect `(,x . ,y))
</code></pre>
<p>My question is, is it correct to use <code>`(,x . ,y)</code> in this situation?</p>
<p>Edit: This sample is not about generating a table of 100x100 items, the code here just illustrate the use of two loop variables and the consing of their values. I have edited the loop to make this clear. The actual loop I use depends on several other functions (and is part of one itself) so it made more sense to replace the calls with literal integers and to pull the loop out of the function.</p>
| [
{
"answer_id": 101503,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 1,
"selected": false,
"text": "(cons x y)\n"
},
{
"answer_id": 101641,
"author": "dsm",
"author_id": 7780,
"author_profile": "https:/... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7780/"
] |
101,497 | <p>I have Flex Builder 3 installed on two Windows machines and the same project on both of them. On one computer, the CSS styles I defined are shown in design view; on the other computer they are not applied. Is there any reason why it might not work on one?</p>
| [
{
"answer_id": 101503,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 1,
"selected": false,
"text": "(cons x y)\n"
},
{
"answer_id": 101641,
"author": "dsm",
"author_id": 7780,
"author_profile": "https:/... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15525/"
] |
101,532 | <p>When I run a Flex application in the debug flash player I get an exception pop up as soon as something unexpected happened. However when a customer uses the application he does not use the debug flash player. In this case he does not get an exception pop up, but he UI is not working.</p>
<p>So for supportability reasons, I would like to catch any exception that can happen anywhere in the Flex UI and present an error message in a Flex internal popup. By using Java I would just encapsulate the whole UI code in a try/catch block, but with MXML applications in Flex I do not know, where I could perform such a general try/catch.</p>
| [
{
"answer_id": 101953,
"author": "Richard Szalay",
"author_id": 3603,
"author_profile": "https://Stackoverflow.com/users/3603",
"pm_score": 7,
"selected": true,
"text": "public class UncaughtErrorEventExample extends Sprite\n{\n public function UncaughtErrorEventExample()\n {\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7524/"
] |
101,533 | <p>I have created a C# class file by using a XSD-file as an input. One of my properties look like this:</p>
<pre><code> private System.DateTime timeField;
[System.Xml.Serialization.XmlElementAttribute(DataType="time")]
public System.DateTime Time {
get {
return this.timeField;
}
set {
this.timeField = value;
}
}
</code></pre>
<p>When serialized, the contents of the file now looks like this:</p>
<pre><code><Time>14:04:02.1661975+02:00</Time>
</code></pre>
<p>Is it possible, with XmlAttributes on the property, to have it render without the milliseconds and the GMT-value like this?</p>
<pre><code><Time>14:04:02</Time>
</code></pre>
<p>Is this possible, or do i need to hack together some sort of xsl/xpath-replace-magic after the class has been serialized?</p>
<p>It is not a solution to changing the object to String, because it is used like a DateTime in the rest of the application and allows us to create an xml-representation from an object by using the XmlSerializer.Serialize() method.</p>
<p>The reason I need to remove the extra info from the field is that the receiving system does not conform to the w3c-standards for the time datatype.</p>
| [
{
"answer_id": 101667,
"author": "Matt Howells",
"author_id": 16881,
"author_profile": "https://Stackoverflow.com/users/16881",
"pm_score": 5,
"selected": false,
"text": "[XmlElement(DataType=\"string\",ElementName=\"Time\")]\npublic String TimeString\n{\n get { return this.timeField.... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2257/"
] |
101,536 | <p>I am looking for a drop-down JavaScript menu.</p>
<p>It should be the simplest and most elegant accessible menu that works in IE6 and Firefox 2 also.
It would be fine if it worked on an unnumbered list (<code>ul</code>) so the user can use the page without JavaScript support.</p>
<p>Which one do you recommend and where can I find the code to such a menu?</p>
| [
{
"answer_id": 101612,
"author": "Daniel Papasian",
"author_id": 7548,
"author_profile": "https://Stackoverflow.com/users/7548",
"pm_score": 2,
"selected": false,
"text": "\njQuery.fn.ddnav = function() {\n this.wrap(\"\");\n this.each(function() {\n var sel ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18631/"
] |
101,540 | <p>How do I get an element or element list by it's tag name. Take for example that I want all elements from <code><h1></h1></code>.
</p>
| [
{
"answer_id": 101563,
"author": "Matthias Kestenholz",
"author_id": 317346,
"author_profile": "https://Stackoverflow.com/users/317346",
"pm_score": 4,
"selected": true,
"text": "Array.from(document.getElementsByTagName('a'))"
},
{
"answer_id": 161331,
"author": "Grant Hutchi... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6078/"
] |
101,541 | <p>I've got an application that uses a hibernate(annotations)/mysql combination for ORM. In that application, I got an entity with a Date field. I'm looking for a way to select on that date within a time range (so <code>hh:mm:ss</code> without the date part). </p>
<p>In MySQL there's a function <code>TIME(expression)</code> that can extract the time part and use that in the where clause, but that does not seem to be available in Hibernate without switching to native queries. Is there an option in hibernate to do this, or should I loop through the results in java and do the comparison there? Would this be much slower as the MySQL solution, since that would not use indexes anyway?</p>
| [
{
"answer_id": 101615,
"author": "Sietse",
"author_id": 6400,
"author_profile": "https://Stackoverflow.com/users/6400",
"pm_score": 2,
"selected": false,
"text": "second(...), minute(...), hour(...), day(...), month(...), year(...)"
},
{
"answer_id": 101637,
"author": "Adam H... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3197/"
] |
101,569 | <p>I need to write a module to detect similar documents. I have read many papers of fingerprints of documents techniques and others, but I do not know how to write code or implement such a solution. The algorithm should work for Chinese, Japanese, English and German language or be language independent. How can I accomplish this?</p>
| [
{
"answer_id": 101605,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 3,
"selected": false,
"text": "get_close_matches()"
},
{
"answer_id": 108974,
"author": "e-satis",
"author_id": 9951,
"author_profile"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17451/"
] |
101,574 | <p>I want a list of hyperlinks on a basic html page, which point to files on our corporate intranet.</p>
<p>When a user clicks the link, I want the file to open.
They are excel spreadsheets, and this is an intranet environment, so I can count on everyone having Excel installed.</p>
<p>I've tried two things:</p>
<ol>
<li>The obvious and simple thing:</li>
</ol>
<pre class="lang-html prettyprint-override"><code><a href="file://server/directory/file.xlsx">Click me!</a>
</code></pre>
<ol start="2">
<li>A <a href="/questions/tagged/vbscript" class="post-tag" title="show questions tagged 'vbscript'" rel="tag">vbscript</a> option that I found in a Google search:</li>
</ol>
<pre class="lang-html prettyprint-override"><code><HTML>
<HEAD>
<SCRIPT LANGUAGE=VBScript>
Dim objExcel
Sub Btn1_onclick()
call OpenWorkbook("\\server\directory\file.xlsx")
End Sub
Sub OpenWorkbook(strLocation)
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = true
objExcel.Workbooks.Open strLocation
objExcel.UserControl = true
End Sub
</SCRIPT>
<TITLE>Launch Excel</Title>
</HEAD>
<BODY>
<INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Excel File">
</BODY>
</HTML>
</code></pre>
<p>I know this is a very basic question, but I would appreciate any help I can get.</p>
<p><strong><em>Edit: Any suggestions that work in both IE and Firefox?</em></strong></p>
| [
{
"answer_id": 101586,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 2,
"selected": false,
"text": "<a href=\"file://server/directory/file.xlsx\" target=\"_blank\">"
},
{
"answer_id": 101608,
"author": "Sam Reynold... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] |
101,597 | <p>Let's say I have the following HTML:</p>
<pre><code><table id="foo">
<th class="sortasc">Header</th>
</table>
<table id="bar">
<th class="sortasc">Header</th>
</table>
</code></pre>
<p>I know that I can do the following to get all of the <strong>th</strong> elements that have class="sortasc"</p>
<pre><code>$$('th.sortasc').each()
</code></pre>
<p>However that gives me the <strong>th</strong> elements from both table <em>foo</em> and table <em>bar</em>.</p>
<p>How can I tell it to give me just the th elements from table <em>foo</em>?</p>
| [
{
"answer_id": 101762,
"author": "levik",
"author_id": 4465,
"author_profile": "https://Stackoverflow.com/users/4465",
"pm_score": 2,
"selected": false,
"text": "var table = document.getElementById('tableId');\nvar headers = table.getElementsByTagName('th');\nvar headersIWant = [];\nfor ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305/"
] |
101,604 | <p>I decided to try <a href="http://www.screwturn.eu/" rel="nofollow noreferrer">http://www.screwturn.eu/</a> wiki as a code snippet storage utility. So far I am very impressed, but what irkes me is that when I copy paste my code that I want to save, '<'s and '[' (<a href="http://en.wikipedia.org/wiki/Character_encodings_in_HTML#Character_references" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Character_encodings_in_HTML#Character_references</a>) invariably screw up the output as the wiki interprets them as either wiki or HTML tags.</p>
<p>Does anyone know a way around this? Or failing that, know of a simple utility that would take C++ code and convert it to HTML safe code?</p>
| [
{
"answer_id": 101650,
"author": "oglester",
"author_id": 2017,
"author_profile": "https://Stackoverflow.com/users/2017",
"pm_score": 0,
"selected": false,
"text": ">"
},
{
"answer_id": 101651,
"author": "The Brawny Man",
"author_id": 11936,
"author_profile": "http... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] |
101,647 | <p>How do you schedule a task in Windows XP to run when you shutdown windows. Such that I want to run a simple command line program I wrote in c# everytime I shut down windows. There doesn't seem to be an option in scheduled tasks to perform this task when my computer shuts down.</p>
| [
{
"answer_id": 101679,
"author": "Neil Neyman",
"author_id": 3240,
"author_profile": "https://Stackoverflow.com/users/3240",
"pm_score": 3,
"selected": false,
"text": "c:\\directory\\myProgram.exe\nC:\\WINDOWS\\system32\\shutdown.exe -s -f -t 0\n"
},
{
"answer_id": 45770722,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6204/"
] |
101,664 | <p>Is there a setting in ReSharper 4 (or even Visual Studio itself...) that forces a warning if I forget to wrap code in a <code>using</code> block, or omit the proper Dispose call in a <code>finally</code> block?</p>
| [
{
"answer_id": 102576,
"author": "Jay Bazuzi",
"author_id": 5314,
"author_profile": "https://Stackoverflow.com/users/5314",
"pm_score": 2,
"selected": false,
"text": "Dispose()"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853/"
] |
101,693 | <p>I get an error everytime I upload my webapp to the provider. Because of the customErrors mode, all I see is the default "Runtime error" message, instructing me to turn off customErrors to view more about the error.</p>
<p>Exasperated, I've set my web.config to look like this:</p>
<pre><code><?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
</code></pre>
<p>And still, all I get is the stupid remote errors page with no useful info on it.
What else can I do to turn customErrors OFF ?!</p>
| [
{
"answer_id": 352626,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 8,
"selected": true,
"text": "<system.web>"
},
{
"answer_id": 423873,
"author": "Community",
"author_id": -1,
"author_profile": "https://... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3263/"
] |
101,708 | <p>In VB.net I'm using the TcpClient to retrieve a string of data. I'm constantly checking the .Connected property to verify if the client is connected but even if the client disconnects this still returns true. What can I use as a workaround for this?</p>
<p>This is a stripped down version of my current code:</p>
<pre><code>Dim client as TcpClient = Nothing
client = listener.AcceptTcpClient
do while client.connected = true
dim stream as networkStream = client.GetStream()
dim bytes(1024) as byte
dim numCharRead as integer = stream.Read(bytes,0,bytes.length)
dim strRead as string = System.Text.Encoding.ASCII.GetString(bytes,0,i)
loop
</code></pre>
<p>I would have figured at least the GetStream() call would throw an exception if the client was disconnected but I've closed the other app and it still doesn't... </p>
<p>Thanks. </p>
<p><strong>EDIT</strong>
Polling the Client.Available was suggested but that doesn't solve the issue. If the client is not 'acutally' connected available just returns 0.</p>
<p>The key is that I'm trying to allow the connection to stay open and allow me to receive data multiple times over the same socket connection. </p>
| [
{
"answer_id": 3783019,
"author": "Sean P",
"author_id": 240405,
"author_profile": "https://Stackoverflow.com/users/240405",
"pm_score": 1,
"selected": false,
"text": "if (client.Client.Poll(0, SelectMode.SelectRead))\n{\n byte[] checkConn = new byte[1];\n\n if (client.Client.Recei... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/77830/"
] |
101,709 | <p>I am implementing a comment control that allows a person to select comments and have them sent to specified departments. The email needs to be formatted in a specific way, and I was wondering what the best way to do this would be.</p>
<p>Should I just hard code all of the style information into one massive method, or should I try and create a separate file and read it in, and then replace certain tags with the relevant information?</p>
| [
{
"answer_id": 101760,
"author": "Matt Howells",
"author_id": 16881,
"author_profile": "https://Stackoverflow.com/users/16881",
"pm_score": 0,
"selected": false,
"text": "<p>Dear |FIRST_NAME|,\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12096/"
] |
101,718 | <p>What is the best way to draw a variable width line without using glLineWidth?
Just draw a rectangle?
Various parallel lines?
None of the above?</p>
| [
{
"answer_id": 102156,
"author": "Ozgur Ozcitak",
"author_id": 976,
"author_profile": "https://Stackoverflow.com/users/976",
"pm_score": 4,
"selected": false,
"text": "// Draws a line between (x1,y1) - (x2,y2) with a start thickness of t1 and\n// end thickness t2.\nvoid DrawLine(float x1... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12423/"
] |
101,742 | <p>I have a Google App Engine app - <a href="http://mylovelyapp.appspot.com/" rel="noreferrer">http://mylovelyapp.appspot.com/</a>
It has a page - mylovelypage</p>
<p>For the moment, the page just does <code>self.response.out.write('OK')</code></p>
<p>If I run the following Python at my computer:</p>
<pre><code>import urllib2
f = urllib2.urlopen("http://mylovelyapp.appspot.com/mylovelypage")
s = f.read()
print s
f.close()
</code></pre>
<p>it prints "OK"</p>
<p>the problem is if I add <code>login:required</code> to this page in the app's yaml</p>
<p>then this prints out the HTML of the Google Accounts login page</p>
<p>I've tried "normal" authentication approaches. e.g.</p>
<pre><code>passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(None,
uri='http://mylovelyapp.appspot.com/mylovelypage',
user='billy.bob@gmail.com',
passwd='billybobspasswd')
opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
</code></pre>
<p>But it makes no difference - I still get the login page's HTML back.</p>
<p>I've tried <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html" rel="noreferrer">Google's ClientLogin auth API</a>, but I can't get it to work.</p>
<pre><code>h = httplib2.Http()
auth_uri = 'https://www.google.com/accounts/ClientLogin'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
myrequest = "Email=%s&Passwd=%s&service=ah&source=DALELANE-0.0" % ("billy.bob@gmail.com", "billybobspassword")
response, content = h.request(auth_uri, 'POST', body=myrequest, headers=headers)
if response['status'] == '200':
authtok = re.search('Auth=(\S*)', content).group(1)
headers = {}
headers['Authorization'] = 'GoogleLogin auth=%s' % authtok.strip()
headers['Content-Length'] = '0'
response, content = h.request("http://mylovelyapp.appspot.com/mylovelypage",
'POST',
body="",
headers=headers)
while response['status'] == "302":
response, content = h.request(response['location'], 'POST', body="", headers=headers)
print content
</code></pre>
<p>I do seem to be able to get some token correctly, but attempts to use it in the header when I call 'mylovelypage' still just return me the login page's HTML. :-( </p>
<p>Can anyone help, please?</p>
<p>Could I use the <a href="http://code.google.com/p/gdata-python-client/" rel="noreferrer">GData client library</a> to do this sort of thing? From
what I've read, I think it should be able to access App Engine apps,
but I haven't been any more successful at getting the authentication working for App Engine stuff there either </p>
<p>Any pointers to samples, articles, or even just keywords I should be
searching for to get me started, would be very much appreciated.</p>
<p>Thanks!</p>
| [
{
"answer_id": 103410,
"author": "dalelane",
"author_id": 477,
"author_profile": "https://Stackoverflow.com/users/477",
"pm_score": 5,
"selected": false,
"text": "import os\nimport urllib\nimport urllib2\nimport cookielib\n\nusers_email_address = \"billy.bob@gmail.com\"\nusers_password ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/477/"
] |
101,752 | <p>I used <code>git pull</code> and had a merge conflict:</p>
<pre><code>unmerged: some_file.txt
You are in the middle of a conflicted merge.
</code></pre>
<p>How do I abandon my changes to the file and keep only the pulled changes?</p>
| [
{
"answer_id": 101773,
"author": "David Precious",
"author_id": 4040,
"author_profile": "https://Stackoverflow.com/users/4040",
"pm_score": 7,
"selected": false,
"text": "git reset"
},
{
"answer_id": 102309,
"author": "Pat Notz",
"author_id": 825,
"author_profile": "h... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18666/"
] |
101,754 | <p>We are working on an <a href="http://en.wikipedia.org/wiki/S60_%28software_platform%29" rel="noreferrer">S60</a> version and this platform has a nice Python API..</p>
<p>However, there is nothing official about Python on Android, but since <a href="http://en.wikipedia.org/wiki/Jython" rel="noreferrer">Jython</a> exists, is there a way to let the snake and the robot work together??</p>
| [
{
"answer_id": 973765,
"author": "unmounted",
"author_id": 11596,
"author_profile": "https://Stackoverflow.com/users/11596",
"pm_score": 8,
"selected": false,
"text": "import android\ndroid = android.Android()\ncode = droid.scanBarcode()\nisbn = int(code['result']['SCAN_RESULT'])\nurl = ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9951/"
] |
101,767 | <p>I'm trying to use cygwin as a build environment under Windows. I have some dependencies on 3rd party packages, for example, GTK+. </p>
<p>Normally when I build under Linux, in my Makefile I can add a call to pkg-config as an argument to gcc, so it comes out like so:</p>
<pre>
gcc example.c `pkg-config --libs --cflags gtk+-2.0`
</pre>
<p>This works fine under Linux, but in cygwin I get:</p>
<pre>
:Invalid argument
make: *** [example] Error 1
</pre>
<p>Right now, I am just manually running pkg-config and pasting the output into the Makefile, which is truly terrible. Is there a good way to workaround or fix for this issue?</p>
<p>Make isn't the culprit. I can copy and paste the command line that make uses to call gcc, and that by itself will run gcc, which halts with ": Invalid argument". </p>
<p>I wrote a small test program to print out command line arguments:</p>
<pre><code>for (i = 0; i < argc; i++)
printf("'%s'\n", argv[i]);
</code></pre>
<p>Notice the single quotes.</p>
<pre>
$ pkg-config --libs gtk+-2.0
-Lc:/mingw/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpang
owin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-
2.0 -lglib-2.0 -lintl
</pre>
<p>Running through the test program:</p>
<pre>
$ ./t `pkg-config --libs gtk+-2.0`
'C:\cygwin\home\smo\pvm\src\t.exe'
'-Lc:/mingw/lib'
'-lgtk-win32-2.0'
'-lgdk-win32-2.0'
'-latk-1.0'
'-lgdk_pixbuf-2.0'
'-lpangowin32-1.0'
'-lgdi32'
'-lpangocairo-1.0'
'-lpango-1.0'
'-lcairo'
'-lgobject-2.0'
'-lgmodule-2.0'
'-lglib-2.0'
'-lintl'
'
</pre>
<p>Notice the one single quote on the last line. It looks like argc is one greater than it should be, and argv[argc - 1] is null. Running the same test on Linux does not have this result.</p>
<p>That said, is there, say, some way I could have the Makefile store the result of pkg-config into a variable, and then use that variable, rather than using the back-tick operator?</p>
| [
{
"answer_id": 102136,
"author": "Tobias Kunze",
"author_id": 6070,
"author_profile": "https://Stackoverflow.com/users/6070",
"pm_score": 2,
"selected": false,
"text": "which make\nmake --version\n"
},
{
"answer_id": 102543,
"author": "Tobias Kunze",
"author_id": 6070,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16080/"
] |
101,777 | <p>Let's say I have this code:</p>
<pre><code>if (md5($_POST[$foo['bar']]) == $somemd5) {
doSomethingWith(md5($_POST[$foo['bar']]);
}
</code></pre>
<p>I could shorten that down by doing:</p>
<pre><code>$value = md5($_POST[$foo['bar']];
if ($value == $somemd5) {
doSomethingWith($value);
}
</code></pre>
<p>But is there any pre-set variable that contains the first or second condition of the current if? Like for instance:</p>
<pre><code>if (md5($_POST[$foo['bar']]) == $somemd5) {
doSomethingWith($if1);
}
</code></pre>
<p>May be a unnecessary way of doing it, but I'm just wondering.</p>
| [
{
"answer_id": 101867,
"author": "Paweł Hajdan",
"author_id": 9403,
"author_profile": "https://Stackoverflow.com/users/9403",
"pm_score": 1,
"selected": false,
"text": " doSomethingWith($value);\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15214/"
] |
101,783 | <p>Anyone happen to have a sample script for recursing a given directory in a filesystem with Powershell? Ultimately what I'm wanting to do is create a script that will generate NSIS file lists for me given a directory. Something very similar to what was done <a href="http://blogs.oracle.com/duffblog/2006/12/dynamic_file_list_with_nsis.html" rel="nofollow noreferrer">here</a> with a BASH script.</p>
| [
{
"answer_id": 106413,
"author": "halr9000",
"author_id": 6637,
"author_profile": "https://Stackoverflow.com/users/6637",
"pm_score": 2,
"selected": false,
"text": "$path = \"c:\\path\\to\\program\"\n$installFiles = \"installfiles_list.txt\"\n$uninstFiles = \"uninstfiles_list.txt\"\n$fil... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18831/"
] |
101,806 | <p>I am working on an application that installs a system wide keyboard
hook. I do not want to install this hook when I am running a debug
build from inside the visual studio (or else it would hang the studio
and eventually the system), and I can avoid this by checking if the
DEBUG symbol is defined.</p>
<p>However, when I debug the <em>release</em> version of the application, is
there a way to detect that it has been started from inside visual
studio to avoid the same problem? It is very annoying to have to
restart the studio/the computer, just because I had been working on
the release build, and want to fix some bugs using the debugger having
forgotten to switch back to the debug build. </p>
<p>Currently I use something like this to check for this scenario:</p>
<pre><code>System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
string moduleName = currentProcess.MainModule.ModuleName;
bool launchedFromStudio = moduleName.Contains(".vshost");
</code></pre>
<p>I would call this the "brute force way", which works in my setting, but I would like to know whether there's another (better) way of detecting this scenario.</p>
| [
{
"answer_id": 101812,
"author": "TraumaPony",
"author_id": 18658,
"author_profile": "https://Stackoverflow.com/users/18658",
"pm_score": 7,
"selected": true,
"text": "System.Diagnostics.Debugger.IsAttached"
},
{
"answer_id": 101915,
"author": "William Casarin",
"author_i... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17378/"
] |
101,825 | <p>That is, I'd like to have a tuple of values.</p>
<p>The use case on my mind:</p>
<pre><code>Dictionary<Pair<string, int>, object>
</code></pre>
<p>or</p>
<pre><code>Dictionary<Triple<string, int, int>, object>
</code></pre>
<p>Are there built-in types like Pair or Triple? Or what's the best way of implementing it?</p>
<p><strong>Update</strong> There are some general-purpose tuples implementations described in the answers, but for tuples used as keys in dictionaries you should additionaly verify correct calculation of the hash code. Some more info on that in another <a href="https://stackoverflow.com/questions/102690/how-does-c-figure-out-the-hash-code-for-an-object">question</a>.</p>
<p><strong>Update 2</strong> I guess it is also worth reminding, that when you use some value as a key in dictionary, it should be immutable.</p>
| [
{
"answer_id": 101858,
"author": "Timothy Carter",
"author_id": 4660,
"author_profile": "https://Stackoverflow.com/users/4660",
"pm_score": 4,
"selected": false,
"text": "public struct Pair<T1, T2>\n{\n public T1 First;\n public T2 Second;\n}\n\npublic struct Triple<T1, T2, T3>\n{\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351099/"
] |
101,850 | <p>Take this code:</p>
<pre><code><?php
if (isset($_POST['action']) && !empty($_POST['action'])) {
$action = $_POST['action'];
}
if ($action) {
echo $action;
}
else {
echo 'No variable';
}
?>
</code></pre>
<p>And then access the file with ?action=test
Is there any way of preventing $action from automatically being declared by the GET? Other than of course adding</p>
<pre><code>&& !isset($_GET['action'])
</code></pre>
<p>Why would I want the variable to be declared for me?</p>
| [
{
"answer_id": 101879,
"author": "owenmarshall",
"author_id": 9806,
"author_profile": "https://Stackoverflow.com/users/9806",
"pm_score": 6,
"selected": true,
"text": "register_globals"
},
{
"answer_id": 101898,
"author": "Lucas Oman",
"author_id": 6726,
"author_profi... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15214/"
] |
101,868 | <p>Is there any easy to install/use (on unix) database migration tools like Rails Migrations? I really like the idea, but installing ruby/rails purely to manage my database migrations seems overkill.</p>
| [
{
"answer_id": 102353,
"author": "Otto",
"author_id": 9594,
"author_profile": "https://Stackoverflow.com/users/9594",
"pm_score": 1,
"selected": false,
"text": "rake"
},
{
"answer_id": 104903,
"author": "Ryan McGeary",
"author_id": 8985,
"author_profile": "https://Sta... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3839/"
] |
101,877 | <p>How can I add Page transitions effects like IE in Safari for web pages?</p>
| [
{
"answer_id": 101961,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 3,
"selected": true,
"text": "var xmlhttp;\nvar timerId = 0;\nvar op = 1;\n\nfunction getPageFx() {\n url = \"/transpage2.html\";\n if (window.XM... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/191/"
] |
101,880 | <ul>
<li>I start up my application which uses a Jetty server, using port 9000.</li>
<li>I then shut down my application with Ctrl-C</li>
<li>I check with "netstat -a" and see that the port 9000 is no longer being used.</li>
<li>I restart my application and get:</li>
</ul>
<blockquote>
<pre><code>[ERROR,9/19 15:31:08] java.net.BindException: Only one usage of each socket address (protocol/network address/port) is normally permitted
[TRACE,9/19 15:31:08] java.net.BindException: Only one usage of each socket address (protocol/network address/port) is normally permitted
[TRACE,9/19 15:31:08] at java.net.PlainSocketImpl.convertSocketExceptionToIOException(PlainSocketImpl.java:75)
[TRACE,9/19 15:31:08] at sun.nio.ch.Net.bind(Net.java:101)
[TRACE,9/19 15:31:08] at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
[TRACE,9/19 15:31:08] at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77)
[TRACE,9/19 15:31:08] at org.mortbay.jetty.nio.BlockingChannelConnector.open(BlockingChannelConnector.java:73)
[TRACE,9/19 15:31:08] at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:285)
[TRACE,9/19 15:31:08] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
[TRACE,9/19 15:31:08] at org.mortbay.jetty.Server.doStart(Server.java:233)
[TRACE,9/19 15:31:08] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
[TRACE,9/19 15:31:08] at ...
</code></pre>
</blockquote>
<p>Is this a Java bug? Can I avoid it somehow before starting the Jetty server?</p>
<p><strong>Edit #1</strong> Here is our code for creating our BlockingChannelConnector, note the "setReuseAddress(true)":</p>
<blockquote>
<pre><code> connector.setReuseAddress( true );
connector.setPort( port );
connector.setStatsOn( true );
connector.setMaxIdleTime( 30000 );
connector.setLowResourceMaxIdleTime( 30000 );
connector.setAcceptQueueSize( maxRequests );
connector.setName( "Blocking-IO Connector, bound to host " + connector.getHost() );
</code></pre>
</blockquote>
<p>Could it have something to do with the idle time?</p>
<p><strong>Edit #2</strong> Next piece of the puzzle that may or may not help: when running the application in Debug Mode (Eclipse) the server starts up without a problem!!! But the problem described above occurs reproducibly when running the application in Run Mode or as a built jar file. Whiskey Tango Foxtrot?</p>
<p><strong>Edit #3 (4 days later)</strong> - still have the issue. Any thoughts?</p>
| [
{
"answer_id": 101906,
"author": "freespace",
"author_id": 8297,
"author_profile": "https://Stackoverflow.com/users/8297",
"pm_score": 1,
"selected": false,
"text": "setReuseAddress(true)"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
101,893 | <p>This concept is a new one for me -- I first came across it at the <a href="http://developer.yahoo.com/yui/articles/hosting/#configure" rel="nofollow noreferrer">YUI dependency configurator</a>. Basically, instead of having multiple requests for many files, the files are chained into one http request to cut down on page load time.</p>
<p>Anyone know how to implement this on a LAMP stack? (I saw a similar question was asked already, but it <a href="https://stackoverflow.com/questions/47937/combining-and-caching-multiple-javascript-files-in-aspnet">seems to be ASP specific</a>.</p>
<p>Thanks!</p>
<p>Update: Both answers are helpful...(my rep isn't high enough to comment yet so I'm adding some parting thoughts here). I also came <a href="http://www.artzstudio.com/2008/08/using-modconcat-to-speed-up-render-start/" rel="nofollow noreferrer">across another blog post</a> with PHP-specific examples that might be useful. David's build answer, though, is making me consider a different approach. Thanks, David!</p>
| [
{
"answer_id": 101941,
"author": "David McLaughlin",
"author_id": 3404,
"author_profile": "https://Stackoverflow.com/users/3404",
"pm_score": 4,
"selected": true,
"text": "perl build-project-master.pl core.js class1.js etc.js /path/to/live/js/file.js\n"
},
{
"answer_id": 14414073... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13243/"
] |
101,935 | <p>Is there a way (without installing any libraries) of validating XML using a custom DTD in PHP?</p>
| [
{
"answer_id": 101962,
"author": "owenmarshall",
"author_id": 9806,
"author_profile": "https://Stackoverflow.com/users/9806",
"pm_score": 4,
"selected": true,
"text": "<?php\n$dom = new DOMDocument;\n$dom->Load('book.xml');\nif ($dom->validate()) {\n echo \"This document is valid!\\n\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18856/"
] |
101,949 | <p>I am using WPF and I have an image of an 8.5" * 11" piece of paper on a Canvas. I am then rotating the image using a RotateTransform, with the axis being in the middle of the page (that is, RotateTransformOrigin="0.5,0.5"). How can I find the actual location on the canvas of the corners of the image?</p>
| [
{
"answer_id": 106585,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 0,
"selected": false,
"text": "_image.TranslatePoint(new Point(0, 0), _canvas);\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18153/"
] |
101,958 | <p>I recently discovered that our company has a set of coding guidelines (hidden away in a document management system where no one can find it). It generally seems pretty sensible, and keeps away from the usual religious wars about where to put '{'s and whether to use hard tabs. However, it does suggest that "lines SHOULD NOT contain embedded multiple spaces". By which it means don't do this sort of thing:</p>
<pre><code>foo = 1;
foobar = 2;
bar = 3;
</code></pre>
<p>Or this:</p>
<pre><code>if ( test_one ) return 1;
else if ( longer_test ) return 2;
else if ( shorter ) return 3;
else return 4;
</code></pre>
<p>Or this:</p>
<pre><code>thing foo_table[] =
{
{ "aaaaa", 0 },
{ "aa", 1 },
// ...
}
</code></pre>
<p>The justification for this is that changes to one line often require every line to be edited. That makes it more effort to change, and harder to understand diffs.</p>
<p>I'm torn. On the one hand, lining up like this can make repetitive code much easier to read. On the other hand, it does make diffs harder to read.</p>
<p>What's your view on this?</p>
| [
{
"answer_id": 101984,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 5,
"selected": false,
"text": "gofmt"
},
{
"answer_id": 102048,
"author": "Onorio Catenacci",
"author_id": 2820,
"author_profile": "https:... | 2008/09/19 | [
"https://Stackoverflow.com/questions/101958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1105/"
] |
101,986 | <p>A sysadmin teacher told me one day that I should learn to use "make" because I could use it for a lot of other things that just triggering complilations.</p>
<p>I never got the chance to talk longer about it. Do you have any good example ?</p>
<p>As a bonus, isn't it this tool deprecated, and what are modern alternatives (for the compilation purpose and others) ?</p>
| [
{
"answer_id": 102051,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stackoverflow.com/users/6899",
"pm_score": 0,
"selected": false,
"text": "postfix"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/101986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9951/"
] |
102,003 | <p>The default 64 MB max heap memory can be small for a large Java application. Are there any applet parameter to increment this for a signed applet?</p>
<p>For a Java program this is a simple command line parameter but how this work for an applet in the browser.</p>
| [
{
"answer_id": 4149222,
"author": "Mayur",
"author_id": 503789,
"author_profile": "https://Stackoverflow.com/users/503789",
"pm_score": 2,
"selected": false,
"text": "j2se version=\"1.6+\" initial-heap-size=\"256m\" max-heap-size=\"1024m\"\n href=\"http://java.sun.com/products/autodl/... | 2008/09/19 | [
"https://Stackoverflow.com/questions/102003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12631/"
] |
102,009 | <p>In C++, when is it best to use the stack? When is it best to use the heap?</p>
| [
{
"answer_id": 102145,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 4,
"selected": false,
"text": "int main()\n{ \n if (...)\n {\n int i = 0;\n }\n // I know that i is no longer needed here, so declaring i in t... | 2008/09/19 | [
"https://Stackoverflow.com/questions/102009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75350/"
] |
102,049 | <p>For example:</p>
<pre><code>me$ FOO="BAR * BAR"
me$ echo $FOO
BAR file1 file2 file3 file4 BAR
</code></pre>
<p>and using the <code>\</code> escape character:</p>
<pre><code>me$ FOO="BAR \* BAR"
me$ echo $FOO
BAR \* BAR
</code></pre>
<p>I'm obviously doing something stupid.</p>
<p>How do I get the output <code>BAR * BAR</code>?</p>
| [
{
"answer_id": 102073,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stackoverflow.com/users/6899",
"pm_score": 3,
"selected": false,
"text": "FOO='BAR * BAR'\necho \"$FOO\"\n"
},
{
"answer_id": 102074,
"author": "Rafał Dowgird",
"author_id": 12166,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/102049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2108/"
] |
102,055 | <p>I am trying to make a div, that when you click it turns into an input box, and focuses it. I am using prototype to achieve this. This works in both Chrome and Firefox, but not in IE. IE refuses to focus the newly added input field, even if I set a 1 second timeout.</p>
<p>Basically the code works like this:</p>
<pre><code>var viewElement = new Element("div").update("text");
var editElement = new Element("input", {"type":"text"});
root.update(viewElement);
// pseudo shortcut for the sake of information:
viewElementOnClick = function(event) {
root.update(editElement);
editElement.focus();
}
</code></pre>
<p>The above example is a shortened version of the actual code, the actual code works fine except the focus bit in IE.</p>
<p>Are there limitations on the focus function in IE? Do I need to place the input in a form?</p>
| [
{
"answer_id": 102152,
"author": "17 of 26",
"author_id": 2284,
"author_profile": "https://Stackoverflow.com/users/2284",
"pm_score": 3,
"selected": true,
"text": "setTimeout(\"setFocus\", 0);\n\nfunction setFocus()\n{\n editElement.focus();\n}\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/102055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3355/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.