qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
521,702
<p>Does anyone know how to disable the Windows CE Console on a Windows Mobile v5.0 handheld device?</p>
[ { "answer_id": 521744, "author": "Sarel Botha", "author_id": 35264, "author_profile": "https://Stackoverflow.com/users/35264", "pm_score": 3, "selected": true, "text": "<p>Edit the registry on the device. PHM Regedit is a free tool that lets you do this.</p>\n\n<p>Change the following ke...
2009/02/06
[ "https://Stackoverflow.com/questions/521702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1224/" ]
Does anyone know how to disable the Windows CE Console on a Windows Mobile v5.0 handheld device?
Edit the registry on the device. PHM Regedit is a free tool that lets you do this. Change the following key to 0xFFFFFFFF: ``` HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo ``` More here: <https://meeting.uni.lu/andre.stemper/startcmd.html>
521,709
<p>I want to POST an URL using CURL and php.</p> <p>There is a big form on webpage and I don't want to manually copy all the variables and put it in my POST request.</p> <p>I am guessing there has to be a way to serialize the form automatically (using DOM or something) and then just change whatever values I need.</p>...
[ { "answer_id": 522001, "author": "Mainegreen", "author_id": 62157, "author_profile": "https://Stackoverflow.com/users/62157", "pm_score": 1, "selected": false, "text": "<p>Its not to clear to me if you are asking how to get the form in the browser to the server or how to place the posted...
2009/02/06
[ "https://Stackoverflow.com/questions/521709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62031/" ]
I want to POST an URL using CURL and php. There is a big form on webpage and I don't want to manually copy all the variables and put it in my POST request. I am guessing there has to be a way to serialize the form automatically (using DOM or something) and then just change whatever values I need. I could not google ...
``` $http = new HttpQueryString(); $http->set($_POST); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$http->get()); ``` Requires PECL pecl\_http >= 0.22.0
521,710
<p>I have this class definition:</p> <pre><code>class cols: name = 'name' size = 'size' date = 'date' @classmethod def foo(cls): print "This is a class method" </code></pre> <p>With __dict__ I get all class attributes (members and variables). Also there are the "Internal attributes" too (l...
[ { "answer_id": 521728, "author": "Jason Coon", "author_id": 59753, "author_profile": "https://Stackoverflow.com/users/59753", "pm_score": 1, "selected": false, "text": "<pre><code>import inspect\ninspect.getmembers(cols)\n</code></pre>\n\n<p>There are a lot if things you can do with the ...
2009/02/06
[ "https://Stackoverflow.com/questions/521710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this class definition: ``` class cols: name = 'name' size = 'size' date = 'date' @classmethod def foo(cls): print "This is a class method" ``` With \_\_dict\_\_ I get all class attributes (members and variables). Also there are the "Internal attributes" too (like \_\_main\_\_). How...
I wouldn't know a straightforward way, especially since from the interpreter's POV, there is not that much of a difference between a method of a class and any other variable (methods have descriptors, but that's it...). So when you only want non-callable class members, you have to fiddle around a little: ``` >>> clas...
521,719
<p>Is there a way to export to excel from an SSRS report so that the header that displays on the first page of the report is omitted only in the excel export? Currently, it adds a frozen frame to the top of the worksheet.</p>
[ { "answer_id": 521874, "author": "Registered User", "author_id": 38332, "author_profile": "https://Stackoverflow.com/users/38332", "pm_score": 0, "selected": false, "text": "<p>Unfortunately Reporting Services 2000, 2005, and 2008 do not have a way to alter the results of the report base...
2009/02/06
[ "https://Stackoverflow.com/questions/521719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35286/" ]
Is there a way to export to excel from an SSRS report so that the header that displays on the first page of the report is omitted only in the excel export? Currently, it adds a frozen frame to the top of the worksheet.
**Update** Also see my answer [about how to add a new Excel rendering option that strips the header](https://stackoverflow.com/questions/3048363/ssrs-2005-set-simplepageheaders-on-the-report-instead-of-the-server/3058576#3058576) Original answer follows: If you can get the URL for the Excel output (some versions of ...
521,759
<p>Here is part of a stack-trace from a recent run of an unreliable application written in Python which controls another application written in Excel:</p> <pre><code>pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146788248), None) </code></pre> <p>Obviously something has gone wr...
[ { "answer_id": 521814, "author": "Jason Coon", "author_id": 59753, "author_profile": "https://Stackoverflow.com/users/59753", "pm_score": 3, "selected": false, "text": "<p>Yes try the win32api module:</p>\n\n<pre><code>import win32api\ne_msg = win32api.FormatMessage(-2147352567)\n</code>...
2009/02/06
[ "https://Stackoverflow.com/questions/521759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46411/" ]
Here is part of a stack-trace from a recent run of an unreliable application written in Python which controls another application written in Excel: ``` pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146788248), None) ``` Obviously something has gone wrong ... but what?[1] These...
You are not doing anything wrong. The first item in your stack trace (the number) is the error code returned by the COM object. The second item is the description associated with the error code which in this case is "Exception Occurred". pywintypes.com\_error already called the equivalent of win32api.FormatMessage(errC...
521,768
<pre><code>&lt;?php $var = NULL; var_dump(isset($var)); // bool(false) var_dump(isset($unset_var)); // bool(false) ?&gt; </code></pre> <p>isset($var) should return TRUE, since it has been set to NULL.</p> <p>Is there any way to check for this?</p> <p>Thanks!</p>
[ { "answer_id": 521784, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>Not very pretty, but...</p>\n\n<pre><code>array_key_exists('var', $GLOBALS);\n</code></pre>\n\n<p>(You can't use <code>@is_...
2009/02/06
[ "https://Stackoverflow.com/questions/521768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26192/" ]
``` <?php $var = NULL; var_dump(isset($var)); // bool(false) var_dump(isset($unset_var)); // bool(false) ?> ``` isset($var) should return TRUE, since it has been set to NULL. Is there any way to check for this? Thanks!
use get\_defined\_vars() to get an array of the variables defined in the current scope and then test against it with array\_key\_exists(); Edited: if you wanted a function to test existence you would create one like so: ``` function varDefined($name,$scope) { return array_key_exists($name, $scope); } ``` and use...
521,774
<p>Given this C API declaration how would it be imported to C#?</p> <pre><code>int _stdcall z4ctyget(CITY_REC *, void *); </code></pre> <p>I've been able to get this far:</p> <pre><code> [DllImport(@"zip4_w32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "z4ctygetSTD", E...
[ { "answer_id": 521797, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 5, "selected": true, "text": "<p>For the void* parameter you can just use an IntPtr</p>\n\n<pre><code> [DllImport(@\"zip4_w32.dll\",\n CallingCo...
2009/02/06
[ "https://Stackoverflow.com/questions/521774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27887/" ]
Given this C API declaration how would it be imported to C#? ``` int _stdcall z4ctyget(CITY_REC *, void *); ``` I've been able to get this far: ``` [DllImport(@"zip4_w32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "z4ctygetSTD", ExactSpelling = false)] private ex...
For the void\* parameter you can just use an IntPtr ``` [DllImport(@"zip4_w32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "z4ctygetSTD", ExactSpelling = false)] private extern static int z4ctygetSTD(ref CITY_REC args, IntPtr ptr); ```
521,785
<p>I've got a philosophical programming problem. Let's say I have a class named Employees. Employees has business members that get set from a dataTable. In order to fill this, I use a method that takes an instance of the employee class, loops through a dataTable, and sets the members of the instance passed into it. ...
[ { "answer_id": 521798, "author": "David Morton", "author_id": 45916, "author_profile": "https://Stackoverflow.com/users/45916", "pm_score": 3, "selected": false, "text": "<p>Sounds to me like you ought to make GetEmployees() a static method off of Employee. You shouldn't have to instant...
2009/02/06
[ "https://Stackoverflow.com/questions/521785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52453/" ]
I've got a philosophical programming problem. Let's say I have a class named Employees. Employees has business members that get set from a dataTable. In order to fill this, I use a method that takes an instance of the employee class, loops through a dataTable, and sets the members of the instance passed into it. For in...
Both things are methods (also known as functions). The difference is that the first one "returns by reference" while the second one "returns a reference". There is no advantage in returning by reference in C# because in the simpler, natural case where you merely return a reference, no copying is done (unlike in C++). ...
521,804
<p>I am using ASP.NET 2.0 C#. I want to redirect all request for my web app with "www" to without "www"</p> <p>www.example.com to example.com</p> <p>Or</p> <p>example.com to www.example.com</p> <p>Stackoverflow.com is already doing this, I know there is a premade mechanism in PHP (.htaccess) file. But how to do it ...
[ { "answer_id": 521811, "author": "shsteimer", "author_id": 292, "author_profile": "https://Stackoverflow.com/users/292", "pm_score": 5, "selected": false, "text": "<p>There's a Stackoverflow blog post about this.</p>\n<p><a href=\"https://blog.stackoverflow.com/2008/06/dropping-the-www-p...
2009/02/06
[ "https://Stackoverflow.com/questions/521804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45261/" ]
I am using ASP.NET 2.0 C#. I want to redirect all request for my web app with "www" to without "www" www.example.com to example.com Or example.com to www.example.com Stackoverflow.com is already doing this, I know there is a premade mechanism in PHP (.htaccess) file. But how to do it in asp.net ? Thanks
I've gone with the following solution in the past when I've not been able to modify IIS settings. Either in an HTTPModule (probably cleanest), or global.asax.cs in Application\_BeginRequest or in some BasePage type event, such as OnInit I perform a check against the requested url, with a known string I wish to be usin...
521,822
<p>While I understand this question is fairly vague since I'm not giving you all as much detail as I'd like to, I'm hoping for some general improvements that can be made to my generation code or the reports themselves to speed them up. I've asked for more hardware, but have been denied.</p> <pre><code>public Stream Ge...
[ { "answer_id": 521854, "author": "Registered User", "author_id": 38332, "author_profile": "https://Stackoverflow.com/users/38332", "pm_score": 3, "selected": true, "text": "<p>Although not directly related to the code you posted, here are a couple of generic enhancements you should alway...
2009/02/06
[ "https://Stackoverflow.com/questions/521822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7756/" ]
While I understand this question is fairly vague since I'm not giving you all as much detail as I'd like to, I'm hoping for some general improvements that can be made to my generation code or the reports themselves to speed them up. I've asked for more hardware, but have been denied. ``` public Stream GenerateReport(s...
Although not directly related to the code you posted, here are a couple of generic enhancements you should always consider when writing reports in Reporting Services: 1. Pre-load report tables so that they already aggregate any data that would have been aggregated in the report. For instance, if the report data source...
521,824
<p><strong>Problem:</strong></p> <ul> <li><p><strong>Event notifications</strong> (From COM object - Server) are not received as listed in the Sink (class) implementation.</p></li> <li><p><strong>One event notification</strong> is <strong>received</strong> (Event_one), however, others are <strong>not</strong> received...
[ { "answer_id": 523290, "author": "Vinay", "author_id": 28641, "author_profile": "https://Stackoverflow.com/users/28641", "pm_score": 1, "selected": false, "text": "<p>Since you are receiving the notification for first method of the sink interface, I suspect, events are not sent on other ...
2009/02/06
[ "https://Stackoverflow.com/questions/521824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51078/" ]
**Problem:** * **Event notifications** (From COM object - Server) are not received as listed in the Sink (class) implementation. * **One event notification** is **received** (Event\_one), however, others are **not** received accordingly * If **order** is **changed** - in IDispatch::Invoke, that is: + if `Event_one`...
SOLVED: ------- After reviewing the corresponding **IDL** FILE (generated by the MIDL compiler), it was evident that each **method** contained in the **IEvent** interface, has a **unique ID**. For instance, `Event_one` has an ID of **2**. For example: ``` methods: [id(0x00000002)] HRESULT Event_one(); ``` T...
521,868
<p>I am trying to update my system time using the following:</p> <pre><code>[StructLayout(LayoutKind.Sequential)] private struct SYSTEMTIME { public ushort wYear; public ushort wMonth; public ushort wDayOfWeek; public ushort wDay; public ushort wHour; public ushort wMinute; public ushort w...
[ { "answer_id": 521883, "author": "David Morton", "author_id": 45916, "author_profile": "https://Stackoverflow.com/users/45916", "pm_score": 2, "selected": false, "text": "<p>According to the code you have right there, you're not incrementing the hour. It looks like you're setting your s...
2009/02/06
[ "https://Stackoverflow.com/questions/521868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62958/" ]
I am trying to update my system time using the following: ``` [StructLayout(LayoutKind.Sequential)] private struct SYSTEMTIME { public ushort wYear; public ushort wMonth; public ushort wDayOfWeek; public ushort wDay; public ushort wHour; public ushort wMinute; public ushort wSecond; pu...
Part of your problem is that you have a couple of incorrect PInvoke signatures. Most notable SetSystemTime should have a non-void return value. Here is the correct signature ``` /// Return Type: BOOL->int ///lpSystemTime: SYSTEMTIME* [System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryP...
521,893
<p>Sorry for the waffly title - if I could come up with a concise title, I wouldn't have to ask the question.</p> <p>Suppose I have an immutable list type. It has an operation <code>Foo(x)</code> which returns a new immutable list with the specified argument as an extra element at the end. So to build up a list of s...
[ { "answer_id": 521911, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 5, "selected": false, "text": "<p>I ended up going with Add for all of my Immutable Collections in <a href=\"http://code.msdn.microsoft.com/BclExtras\" ...
2009/02/06
[ "https://Stackoverflow.com/questions/521893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22656/" ]
Sorry for the waffly title - if I could come up with a concise title, I wouldn't have to ask the question. Suppose I have an immutable list type. It has an operation `Foo(x)` which returns a new immutable list with the specified argument as an extra element at the end. So to build up a list of strings with values "Hel...
I'd go with Cons, for one simple reason: it means exactly what you want it to. 1. I'm a huge fan of saying exactly what I mean, especially in source code. A newbie will have to look up the definition of Cons only once, but then read and use that a thousand times. I find that, in the long term, it's nicer to work with ...
521,912
<p>Our web service wraps around a third party library that contains the following code. </p> <p>We are using an Active Directory service account in the IIS 6 app pool (no interactive login abilities). Our service fails with the error “The system cannot find the file specified”. We’ve traced the error to the <code>R...
[ { "answer_id": 522021, "author": "Rasmus Faber", "author_id": 5542, "author_profile": "https://Stackoverflow.com/users/5542", "pm_score": 1, "selected": false, "text": "<p>I do not have any idea about what causes the error, but instead of xml-encoding and -decoding the public-key, you co...
2009/02/06
[ "https://Stackoverflow.com/questions/521912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3381/" ]
Our web service wraps around a third party library that contains the following code. We are using an Active Directory service account in the IIS 6 app pool (no interactive login abilities). Our service fails with the error “The system cannot find the file specified”. We’ve traced the error to the `RSACryptoServicePro...
The reason why you are seeing this is because RSACryptoService provider opens an exclusive lock on the machine key store. It doesn't matter if you are reading the certificate, using the object results in a lock Two ways around it: 1. Use non-Microsoft RSA stack. 2. use lock() while accessing the object. I ran into t...
521,921
<p>I'm developing a site right now that I've been working on for more than a year. Today, I am about one week from launching so I started going over things that I've not gone over during the last year - including loading-times. I've not noticed any loading-issues, but I still wanted to look.</p> <p>The following repre...
[ { "answer_id": 521939, "author": "Erik Forbes", "author_id": 16942, "author_profile": "https://Stackoverflow.com/users/16942", "pm_score": 2, "selected": false, "text": "<p>That's pretty big, but I wouldn't consider it a problem until/unless it <strong>becomes</strong> a problem. Be wary...
2009/02/06
[ "https://Stackoverflow.com/questions/521921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54680/" ]
I'm developing a site right now that I've been working on for more than a year. Today, I am about one week from launching so I started going over things that I've not gone over during the last year - including loading-times. I've not noticed any loading-issues, but I still wanted to look. The following represents my i...
Not a direct answer, but the [Yahoo! Exceptional Performance](http://developer.yahoo.com/performance/) web site is packed with articles and tips on front-end engineering issues such as these, which can affect the user perception of site load times. In particular, I'd suggest that it might be possible to reduce the num...
521,922
<p>I have a problem here with InternetReadFile, if I run the application in a computer without proxy, the app runs ok, but if I try to use with a computer using proxy, I receive an error 87 (The parameter is incorrect).</p> <p>Thats my code:</p> <pre><code>conHandle = InternetOpen("Test", INTERNET_OPEN_TYPE_PRECONFIG...
[ { "answer_id": 1287184, "author": "Srikumar", "author_id": 157662, "author_profile": "https://Stackoverflow.com/users/157662", "pm_score": 1, "selected": false, "text": "<p>You need to keep calling InternetReadFile in a loop until it returns TRUE and the number of bytes read is 0. This u...
2009/02/06
[ "https://Stackoverflow.com/questions/521922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a problem here with InternetReadFile, if I run the application in a computer without proxy, the app runs ok, but if I try to use with a computer using proxy, I receive an error 87 (The parameter is incorrect). Thats my code: ``` conHandle = InternetOpen("Test", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); .....
You need to keep calling InternetReadFile in a loop until it returns TRUE and the number of bytes read is 0. This usually means at least 2 calls to InternetReadFile. ``` while ( InternetReadFile( hFile, buffer, maxBufferSize, &size ) == FALSE || size > 0 ) { // process buffer contents. // for ex: write the conte...
521,923
<p>How to print the complete stack trace of the exception using a velocity template</p> <p>My present template has $exception as template variable, which contains the exception.</p>
[ { "answer_id": 522146, "author": "Petteri H", "author_id": 28841, "author_profile": "https://Stackoverflow.com/users/28841", "pm_score": 0, "selected": false, "text": "<p>In case you want to display the trace on the output you could wrap the evaluate method inside try-catch-finally block...
2009/02/06
[ "https://Stackoverflow.com/questions/521923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62534/" ]
How to print the complete stack trace of the exception using a velocity template My present template has $exception as template variable, which contains the exception.
In velocity this is how i solved this problem. ``` #foreach ($i in [1..3]) #if($exception.Cause) #set($exception = $exception.Cause) #foreach($stack in $exception.getStackTrace()) $stack.toString() #end #end #end ```
521,927
<p>I have a problem in a Windows Forms application with Bitmap.Save failing when I save to a MemoryStream. The problem only seems to occur intermittently on one machine (so far) and the bad news it is at a customer site. I can't debug on the machine, but I got a stack trace that narrowed the problem down to a single ...
[ { "answer_id": 521983, "author": "Kris Erickson", "author_id": 3798, "author_profile": "https://Stackoverflow.com/users/3798", "pm_score": 2, "selected": false, "text": "<p>Have you tried moving </p>\n\n<pre><code> picture.releasePixelData(pPixels);\n</code></pre>\n\n<p>to </p>\n\n<pre...
2009/02/06
[ "https://Stackoverflow.com/questions/521927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31531/" ]
I have a problem in a Windows Forms application with Bitmap.Save failing when I save to a MemoryStream. The problem only seems to occur intermittently on one machine (so far) and the bad news it is at a customer site. I can't debug on the machine, but I got a stack trace that narrowed the problem down to a single line ...
The MSDN docs for that Bitmap constructor leave no doubt whatsoever: > > **Remarks** > The caller is responsible for allocating and freeing the block of memory specified by the scan0 parameter, however, *the memory should not be released until the related Bitmap is released.* > > >
521,941
<p>I have a <code>ListBox</code> on a form that is bound to an <code>ObservableCollection</code> of a custom type. Within each item there is a <code>ComboBox</code> bound to an enumeration type. When the window loads, all <code>ComboBox</code>es are defaulted to a certain value. When I change the <code>SelectedItem<...
[ { "answer_id": 522118, "author": "Jobi Joy", "author_id": 8091, "author_profile": "https://Stackoverflow.com/users/8091", "pm_score": -1, "selected": false, "text": "<p>It looks like your \"Operation\" property should be a Static property. Since it bind to every ComboBox when you change ...
2009/02/06
[ "https://Stackoverflow.com/questions/521941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312/" ]
I have a `ListBox` on a form that is bound to an `ObservableCollection` of a custom type. Within each item there is a `ComboBox` bound to an enumeration type. When the window loads, all `ComboBox`es are defaulted to a certain value. When I change the `SelectedItem` for any one (from the UI, not from code), all other `C...
I have finally found a solution. I ended up writing a ValueConverter for the enumeration type. I'd been under the impression that this was not necessary, but for some reason it is, at least if the ComboBox is within another list (ListBox in my case) of some sort. I did need to set the IsSynchronizedWithCurrentItem pro...
521,957
<p>I'm trying to develop a GUI application for an embedded platform, without any windowing whatsoever and I'm doing that with DirectFB, and it suits my needs very fine.</p> <p>Since the embedded I develop for is not that powerful, I would really like to try to develop on my own Ubuntu desktop. The problem is Framebuff...
[ { "answer_id": 522256, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 0, "selected": false, "text": "<p>You could use <a href=\"http://v1.moblin.org/projects/projects_image-creator.php\" rel=\"nofollow noreferrer\">Moblin...
2009/02/06
[ "https://Stackoverflow.com/questions/521957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21648/" ]
I'm trying to develop a GUI application for an embedded platform, without any windowing whatsoever and I'm doing that with DirectFB, and it suits my needs very fine. Since the embedded I develop for is not that powerful, I would really like to try to develop on my own Ubuntu desktop. The problem is Framebuffer is conf...
DirectFB has a X11 backend. ``` $ sudo apt-get install libdirectfb-extra # for Debian and Ubuntu, anyhow $ cat ~/.directfbrc system=x11 force-windowed ``` Also, DirectFB has a SDL backend, and SDL has a X11 backend. Also, SDL has a GGI backend, and GGI has an X backend. That's a bit circuitous, but it should work :)...
521,972
<p>I'm trying to build a C/C++ static library using visual studio 2005. Since the selection of the runtime library is a compile option, I am forced to build four variations of my library, one for each variation of the runtime library: </p> <ul> <li>/MT - static runtime library</li> <li>/MD - DLL runtime library</li>...
[ { "answer_id": 521987, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 0, "selected": false, "text": "<p>I believe the reason behind this is that SEH (structured exception handler) code will be generated differently ...
2009/02/06
[ "https://Stackoverflow.com/questions/521972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32515/" ]
I'm trying to build a C/C++ static library using visual studio 2005. Since the selection of the runtime library is a compile option, I am forced to build four variations of my library, one for each variation of the runtime library: * /MT - static runtime library * /MD - DLL runtime library * /MTd - debug static runti...
One side effect of the C preprocessor definitions like `_DLL` and `_DEBUG` that zdan mentioned: Some data structures (such as STL containers and iterators) may be sized differently in the debug runtime, possibly due to features such as `_HAS_ITERATOR_DEBUGGING` and `_SECURE_SCL`. You must compile your code with [struc...
521,977
<p>I need to change the order of headers, I'm using this:</p> <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Method = context.Request.HttpMethod; request.UserAgent = context.Request.UserAgent; </code></pre> <p>The output for that is:</p> <pre><code>GET /* HTTP/1.1 User-Agent: My ...
[ { "answer_id": 522225, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 3, "selected": true, "text": "<p>There was an outstanding complaint that .NET doesn't let you modify the <code>Host</code> header a while back. It might n...
2009/02/06
[ "https://Stackoverflow.com/questions/521977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4386/" ]
I need to change the order of headers, I'm using this: ``` HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Method = context.Request.HttpMethod; request.UserAgent = context.Request.UserAgent; ``` The output for that is: ``` GET /* HTTP/1.1 User-Agent: My Server Host: 127.0.0.1:1080 ``` But...
There was an outstanding complaint that .NET doesn't let you modify the `Host` header a while back. It might not have been resolved. If it is *really* that important, you could always write socket-level code to send a prepared request (since it's just text).
521,979
<p>I have used automation to insert values into a cell, however I have never seen any documentation, for example, that demonstrate inserting anything other than text and/or formula's.</p> <p>Has anybody been able to insert an image from an external application?</p>
[ { "answer_id": 522009, "author": "Stefan", "author_id": 19307, "author_profile": "https://Stackoverflow.com/users/19307", "pm_score": 3, "selected": true, "text": "<pre><code>Dim FileName as string\nFileName=\"c:\\text.jpg\"\nSet NewPic = ActiveSheet.Pictures.Insert(FileName)\nNewPic.top...
2009/02/06
[ "https://Stackoverflow.com/questions/521979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24459/" ]
I have used automation to insert values into a cell, however I have never seen any documentation, for example, that demonstrate inserting anything other than text and/or formula's. Has anybody been able to insert an image from an external application?
``` Dim FileName as string FileName="c:\text.jpg" Set NewPic = ActiveSheet.Pictures.Insert(FileName) NewPic.top=100 NewPic.left=100 ``` If you want to position the picture to a specific cell then select that cell as a range and use that ranges top/left/with to position the picture. Samples: <http://exceltip.com/st/I...
521,996
<p>Can anybody tell me how to identify the middle part <code>interestedInThis</code> and backreference the prefix: <code>fontsize=12</code> and postfix: <code>fontstyle=bold</code> as <code>${1}</code> and <code>${2}</code>?</p> <p>I'm dealing with this string:</p> <pre><code>&lt;fontsize=12 interestedInThis fontstyl...
[ { "answer_id": 522011, "author": "chaos", "author_id": 47529, "author_profile": "https://Stackoverflow.com/users/47529", "pm_score": 3, "selected": true, "text": "<pre><code>&lt;([^&gt;]*)interestedInThis([^&gt;]*)&gt;\n</code></pre>\n" }, { "answer_id": 522013, "author": "Li...
2009/02/06
[ "https://Stackoverflow.com/questions/521996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49628/" ]
Can anybody tell me how to identify the middle part `interestedInThis` and backreference the prefix: `fontsize=12` and postfix: `fontstyle=bold` as `${1}` and `${2}`? I'm dealing with this string: ``` <fontsize=12 interestedInThis fontstyle=bold> ``` Addendum: Sorry, I was not precise enough, here are the specifics...
``` <([^>]*)interestedInThis([^>]*)> ```
522,010
<p>I came across this problem while preparing for an interview and curious to know the diffrent ways it can be written. I found this at <a href="http://cslibrary.stanford.edu/103/" rel="nofollow noreferrer">http://cslibrary.stanford.edu/103/</a> and have given the problem as it is.</p> <p>here is a code to build the l...
[ { "answer_id": 522055, "author": "MSN", "author_id": 6210, "author_profile": "https://Stackoverflow.com/users/6210", "pm_score": 2, "selected": false, "text": "<pre><code>node= malloc\nnode-&gt;data= 1\nnode-&gt;next= malloc\nnode-&gt;next-&gt;data= 2\nnode-&gt;next-&gt;next= malloc\nnod...
2009/02/06
[ "https://Stackoverflow.com/questions/522010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58480/" ]
I came across this problem while preparing for an interview and curious to know the diffrent ways it can be written. I found this at <http://cslibrary.stanford.edu/103/> and have given the problem as it is. here is a code to build the list {1,2,3} ``` struct node* BuildOneTwoThree() { struct node* head = NULL; ...
I did it with six assignments. What do I get? ``` struct node { int data; struct node * next; }; struct node * build_123() { struct node * first = malloc(sizeof(*first)); struct node * second = malloc(sizeof(*second)); struct node * third = malloc(sizeof(*third)); assert(first && second && th...
522,023
<p>I need to insert 800000 records into an MS Access table. I am using Delphi 2007 and the <code>TAdoXxxx</code> components. The table contains some integer fields, one float field and one text field with only one character. There is a primary key on one of the integer fields (which is not autoinc) and two indexes on a...
[ { "answer_id": 522036, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 3, "selected": false, "text": "<p>It would be quicker without the indexes. Can you add them after the import?</p>\n\n<p>There are a number of suggestions...
2009/02/06
[ "https://Stackoverflow.com/questions/522023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49925/" ]
I need to insert 800000 records into an MS Access table. I am using Delphi 2007 and the `TAdoXxxx` components. The table contains some integer fields, one float field and one text field with only one character. There is a primary key on one of the integer fields (which is not autoinc) and two indexes on another integer...
Your text based solution seems the fastest, but you can get it quicker if you could get an preallocated MS Access in a size near the end one. You can do that by filling an typical user database, closing the application (so the buffers are flushed) and doing a manual deletion of all records of that big table - but not s...
522,048
<p>I was wondering if there was a way to some how get the HTML output of a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.aspx" rel="nofollow noreferrer">DataGrid</a>. I want the <em>raw</em> HTML after the data has been bound to the grid. Is there some sort of overload for the re...
[ { "answer_id": 522060, "author": "Chris Ballance", "author_id": 1551, "author_profile": "https://Stackoverflow.com/users/1551", "pm_score": -1, "selected": false, "text": "<pre><code>protected internal override void Render(HtmlTextWriter writer)\n{\n /// use HtmlTextWriter to customi...
2009/02/06
[ "https://Stackoverflow.com/questions/522048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55057/" ]
I was wondering if there was a way to some how get the HTML output of a [DataGrid](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.aspx). I want the *raw* HTML after the data has been bound to the grid. Is there some sort of overload for the render method I can use to accomplish this? Thanks.
``` var outputBuffer = new StringBuilder(); using (var writer = new HtmlTextWriter(new StringWriter(outputBuffer))) { yourDataGrid.RenderControl(writer); } outputBuffer.ToString(); ```
522,105
<p>I used the following query to find duplicates:</p> <pre><code>SELECT userID, COUNT(userID) AS NumOccurrences FROM userDepartments GROUP BY userID HAVING ( COUNT(userID) &gt; 1 ) </code></pre> <p>I then tried adding an inner join so I could see the user names that match, which are stored in a different table.</p> ...
[ { "answer_id": 522116, "author": "jimmyorr", "author_id": 19239, "author_profile": "https://Stackoverflow.com/users/19239", "pm_score": 1, "selected": false, "text": "<p>Group by all three: the userDepartments.userID, users.firstname, and users.lastname</p>\n" }, { "answer_id": 5...
2009/02/06
[ "https://Stackoverflow.com/questions/522105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18309/" ]
I used the following query to find duplicates: ``` SELECT userID, COUNT(userID) AS NumOccurrences FROM userDepartments GROUP BY userID HAVING ( COUNT(userID) > 1 ) ``` I then tried adding an inner join so I could see the user names that match, which are stored in a different table. ``` SELECT userDepartments.userID...
I would rearrange the query a little bit.... ``` SELECT duplicates.NumOccurrences, duplicates.userID, users.firstname, users.lastname FROM ( SELECT userID, COUNT(userID) AS NumOccurrences FROM userDepartments GROUP BY userID HAVING COUNT(userID) > 1 ) duplicates INNER JO...
522,133
<p>i have a user control that descends from UserControl.</p> <p>When dropped onto the form the user control is invisible, because it doesn't have any kind of border to show itself.</p> <p>The PictureBox and Panel controls, at design time, draws a dashed 1px border to make it visible. </p> <p>What is the proper way t...
[ { "answer_id": 522544, "author": "John", "author_id": 33, "author_profile": "https://Stackoverflow.com/users/33", "pm_score": 3, "selected": true, "text": "<p>There is no property that will do this automatically. However you can archive this by overriding the OnPaint in your control and ...
2009/02/06
[ "https://Stackoverflow.com/questions/522133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
i have a user control that descends from UserControl. When dropped onto the form the user control is invisible, because it doesn't have any kind of border to show itself. The PictureBox and Panel controls, at design time, draws a dashed 1px border to make it visible. What is the proper way to do that? Is there an a...
There is no property that will do this automatically. However you can archive this by overriding the OnPaint in your control and manually drawing the rectangle. Inside the overridden event you can call base.OnPaint(e) to draw the controls content and then add use the graphics object to paint the dotted line around the...
522,154
<p>I have a program which only needs a NotifyIcon to work as intended. So I've been trying to get the main form to hide when the program starts.</p> <p>In frmMain_Load, I tried both</p> <pre><code>this.Hide(); this.Visible = false; </code></pre> <p>without success.</p> <p>They work in other methods, like in the Not...
[ { "answer_id": 522165, "author": "Quintin Robinson", "author_id": 12707, "author_profile": "https://Stackoverflow.com/users/12707", "pm_score": 1, "selected": false, "text": "<p>Don't call Show or ShowDialog on your form, you can have your Application.Run target a custom class that then ...
2009/02/06
[ "https://Stackoverflow.com/questions/522154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56179/" ]
I have a program which only needs a NotifyIcon to work as intended. So I've been trying to get the main form to hide when the program starts. In frmMain\_Load, I tried both ``` this.Hide(); this.Visible = false; ``` without success. They work in other methods, like in the NotifyIcon\_MouseClick-method, but I want ...
``` // In Your Program.cs Convert This static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } // To This static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);...
522,158
<p>We have an ages old Java applet that we want to move forward to a newer version of Java (5 or 6), however until today we've always supported people using Java VMs as far back as version 1.1 (specifically for those still using the Microsoft VM)</p> <p>As part of the upgrade, we'd like to be able to serve a web page ...
[ { "answer_id": 522165, "author": "Quintin Robinson", "author_id": 12707, "author_profile": "https://Stackoverflow.com/users/12707", "pm_score": 1, "selected": false, "text": "<p>Don't call Show or ShowDialog on your form, you can have your Application.Run target a custom class that then ...
2009/02/06
[ "https://Stackoverflow.com/questions/522158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23408/" ]
We have an ages old Java applet that we want to move forward to a newer version of Java (5 or 6), however until today we've always supported people using Java VMs as far back as version 1.1 (specifically for those still using the Microsoft VM) As part of the upgrade, we'd like to be able to serve a web page to people ...
``` // In Your Program.cs Convert This static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } // To This static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);...
522,208
<p>I have a DataSet with some DataTables that are linked together with DataRelations (classic order Header/Detail pair). Is there an easy way to denormalize the whole lot into a single DataTable with all the columns of the related tables?</p> <p>The table names and columns are not known at compile time, and there may ...
[ { "answer_id": 522241, "author": "Rune Grimstad", "author_id": 30366, "author_profile": "https://Stackoverflow.com/users/30366", "pm_score": 0, "selected": false, "text": "<p>I don't think data sets support this natively, but it is easy enough to do in code.</p>\n\n<p>First you should cr...
2009/02/06
[ "https://Stackoverflow.com/questions/522208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5548/" ]
I have a DataSet with some DataTables that are linked together with DataRelations (classic order Header/Detail pair). Is there an easy way to denormalize the whole lot into a single DataTable with all the columns of the related tables? The table names and columns are not known at compile time, and there may be more th...
Had the same problem my self, but since this question didn't have an answer I had to write the denormalizer my self. Turned out it wasn't all that difficult - so this is a first cut that you (or some one else who run into this problem) might be able to use/extend: ``` public class DataSetDenormalizer { public void...
522,238
<p>The first thing I do in a public method is to validate every single parameter before they get any chance to get used, passed around or referenced, and then throw an exception if any of them violate the contract. I've found this to be a very good practice as it lets you catch the offender the moment the infraction is...
[ { "answer_id": 522271, "author": "Rob Grant", "author_id": 61938, "author_profile": "https://Stackoverflow.com/users/61938", "pm_score": 1, "selected": false, "text": "<p>It's true that possibly you duplicated work that's already been done in the API, but it's there now. If your error ha...
2009/02/06
[ "https://Stackoverflow.com/questions/522238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7839/" ]
The first thing I do in a public method is to validate every single parameter before they get any chance to get used, passed around or referenced, and then throw an exception if any of them violate the contract. I've found this to be a very good practice as it lets you catch the offender the moment the infraction is co...
It's not just a matter of taste, consider ``` if (!File.Exists(fileName)) throw new ArgumentException("..."); var s = File.OpenText(fileName); ``` This looks similar to your example but there are several reasons (concurrency, access rights) why the `OpenText()` method could still fail, even with a FileN...
522,244
<p>A <code>JComponent</code> of mine is firing a <code>mouseDragged</code> event too vigorously. When the user is trying to click, it interprets is as a drag even if the mouse has only moved 1 pixel.</p> <p>How would I add a rule for a particular component that amounted to: </p> <blockquote> <p>Do not consider it a...
[ { "answer_id": 522318, "author": "JMD", "author_id": 56793, "author_profile": "https://Stackoverflow.com/users/56793", "pm_score": 1, "selected": false, "text": "<p>If I read your question correctly, you're tracking both click and mousedrag events. Can you track the coordinates upon mou...
2009/02/06
[ "https://Stackoverflow.com/questions/522244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
A `JComponent` of mine is firing a `mouseDragged` event too vigorously. When the user is trying to click, it interprets is as a drag even if the mouse has only moved 1 pixel. How would I add a rule for a particular component that amounted to: > > Do not consider it a drag event unless > the mouse has moved 10 pixe...
I've had to do exactly this before. Here's my mouse event processing code, cut down to just the bits relating to making drag require a few pixels before being treated as a drag. ``` public void mousePressed(int mod, Point loc) { pressLocation=copyLocation(loc,pressLocation); dragLocation=null; } public vo...
522,269
<p>I'm thinking to add some code on the server side in asp.net, to verify if the website is working before redirect to it. </p> <p>thanks.</p>
[ { "answer_id": 522285, "author": "Chuck Conway", "author_id": 17360, "author_profile": "https://Stackoverflow.com/users/17360", "pm_score": 0, "selected": false, "text": "<p>Is there any particular reason for doing this? If there is a business reason then you probably don't have a choice...
2009/02/06
[ "https://Stackoverflow.com/questions/522269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42852/" ]
I'm thinking to add some code on the server side in asp.net, to verify if the website is working before redirect to it. thanks.
you could do something like this: ``` System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(serverUrl); System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse(); if (response.StatusCode == System.Net.HttpStatusCode.OK) { response.Close(); ...
522,278
<p>I've been messing around with the free Digital Mars Compiler at work (naughty I know), and created some code to inspect compiled functions and look at the byte code for learning purposes, seeing if I can learn anything valuable from how the compiler builds its functions. However, recreating the same method in MSVC++...
[ { "answer_id": 522314, "author": "Crashworks", "author_id": 53543, "author_profile": "https://Stackoverflow.com/users/53543", "pm_score": 1, "selected": false, "text": "<p>If you want to look at assembly and machine code for a given compiled function, it'll be easier to supply the /FAcs ...
2009/02/06
[ "https://Stackoverflow.com/questions/522278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17604/" ]
I've been messing around with the free Digital Mars Compiler at work (naughty I know), and created some code to inspect compiled functions and look at the byte code for learning purposes, seeing if I can learn anything valuable from how the compiler builds its functions. However, recreating the same method in MSVC++ ha...
I can only guess, but I'm pretty sure you are inspecting a debug build. In debug mode the MSVC++ compiler replaces all calls by calls to jump stubs. This means, that every function starts with a jump to the real function and this is exactly what you are facing here. The surrounding 0xCC bytes are indeed breakpoint ...
522,280
<p>Given a struct like this:</p> <pre><code>public struct SomeStruct { public SomeStruct(String stringProperty, Int32 intProperty) { this.StringProperty = stringProperty; this.IntProperty = intProperty; } public String StringProperty { get; set; } public Int32 IntProperty { get; se...
[ { "answer_id": 522288, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 7, "selected": true, "text": "<p>Prior to C# 6, you need to use the \"this\" constructor in this scenario:</p>\n\n<pre><code>public SomeStruct(Strin...
2009/02/06
[ "https://Stackoverflow.com/questions/522280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596/" ]
Given a struct like this: ``` public struct SomeStruct { public SomeStruct(String stringProperty, Int32 intProperty) { this.StringProperty = stringProperty; this.IntProperty = intProperty; } public String StringProperty { get; set; } public Int32 IntProperty { get; set; } } ``` O...
Prior to C# 6, you need to use the "this" constructor in this scenario: ``` public SomeStruct(String stringProperty, Int32 intProperty) : this() { this.StringProperty = stringProperty; this.IntProperty = intProperty; } ``` Doing this calls the default constructor and by doing so, it initializes all the field...
522,315
<p>Do any solutions currently exist that can minify an entire project directory? More importantly, do any solutions exist that can shorten classnames, id's, and keep them consistent throughout all documents?</p> <p><strong>Something that can turn this:</strong></p> <p>Index.html ---</p> <pre class="lang-html prettyp...
[ { "answer_id": 534632, "author": "Jens Roland", "author_id": 57068, "author_profile": "https://Stackoverflow.com/users/57068", "pm_score": 4, "selected": true, "text": "<p>What you're looking for isn't minifying, but compression. Minifying by definition <em>only</em> removes whitespace, ...
2009/02/06
[ "https://Stackoverflow.com/questions/522315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54680/" ]
Do any solutions currently exist that can minify an entire project directory? More importantly, do any solutions exist that can shorten classnames, id's, and keep them consistent throughout all documents? **Something that can turn this:** Index.html --- ```html <div class="fooBar"> <!-- Code --> </div> ``` Style...
What you're looking for isn't minifying, but compression. Minifying by definition *only* removes whitespace, since shortening identifiers alters the interface, potentially breaking external scripts that depend on it. For this reason, minifying is inherently 'safer' than compression, although in a closed system (ie. an ...
522,326
<p>I often need to enter text (consisting of repeated characters) like this:</p> <pre><code>------------------------------------ TODO ------------------------------------ </code></pre> <p>In emacs, I can do a </p> <pre><code>C-u 60 - </code></pre> <p>that's a Ctrl+U followed by a "60" followed by a "-", which mak...
[ { "answer_id": 522357, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 1, "selected": false, "text": "<p>First of all \"Yes\" you can guarantee that if they have the .Net framework installed that they have Ngen. The only thing...
2009/02/06
[ "https://Stackoverflow.com/questions/522326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288585/" ]
I often need to enter text (consisting of repeated characters) like this: ``` ------------------------------------ TODO ------------------------------------ ``` In emacs, I can do a ``` C-u 60 - ``` that's a Ctrl+U followed by a "60" followed by a "-", which makes entering a repeated sequence of characters eas...
You can ngen your assembly using a custom installer action. The following link explains this in further detail: <http://www.dotnetperls.com/ngen> I can also remember a good discussion of Paint.NET's installer (which includes .NET Framework bootstrapping, pre-JITting etc.), but I cannot find it at the moment. I'll edi...
522,353
<p>I have a page using something along the lines of </p> <pre><code>&lt;meta http-equiv="refresh" content="0;url=http://example.com/" /&gt; </code></pre> <p>but for certain users on a certain workstation this doesn't work. The is in IE. Is there something wrong with cookies or a setting somewhere which would cause th...
[ { "answer_id": 522419, "author": "Kosi2801", "author_id": 57601, "author_profile": "https://Stackoverflow.com/users/57601", "pm_score": 0, "selected": false, "text": "<p>Just a wild guess: maybe there are some adblockers installed on those machines where the redirect does not work.\nCan'...
2009/02/06
[ "https://Stackoverflow.com/questions/522353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
I have a page using something along the lines of ``` <meta http-equiv="refresh" content="0;url=http://example.com/" /> ``` but for certain users on a certain workstation this doesn't work. The is in IE. Is there something wrong with cookies or a setting somewhere which would cause this to fail? I never heard of suc...
The problem is that when IE sees this: ``` <meta http-equiv="refresh" content="0;http://www.example.com" /> ``` it expects the contents attribute to contain a number. The only time IE will check for a URL is if the content attribute contains "URL=" so the redirect that is most usable in all browsers is this: ``` ...
522,356
<p>Is there any widely used SQL coding standard out there? SQL is little bit different from C/C++ type of programming languages. Really don't know how to best format it for readability.</p>
[ { "answer_id": 522377, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 3, "selected": false, "text": "<p>If you google, there are plenty of coding standards out there. For example,</p>\n\n<p><a href=\"http://www.nyx.net/~...
2009/02/06
[ "https://Stackoverflow.com/questions/522356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3403994/" ]
Is there any widely used SQL coding standard out there? SQL is little bit different from C/C++ type of programming languages. Really don't know how to best format it for readability.
Wouldn't call it coding standard - more like coding style ``` SELECT T1.col1, T1.col2, T2.col3 FROM table1 T1 INNER JOIN ON Table2 T2 ON T1.ID = T2.ID WHERE T1.col1 = 'xxx' AND T2.Col3 = 'yyy' ``` * capitalize reserved words * main keywords on new line * can't get used to commas before co...
522,359
<p>I'm trying to finish up a Flash website for my company, and am having some major frustrations with Lightwindow links in Flash. I have a "Videos" page that has a few links, that when you click on one, it opens a Lightbox with a .SWF that plays the video. The problem is that the top of the Lightwindow and the Flash me...
[ { "answer_id": 522377, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 3, "selected": false, "text": "<p>If you google, there are plenty of coding standards out there. For example,</p>\n\n<p><a href=\"http://www.nyx.net/~...
2009/02/06
[ "https://Stackoverflow.com/questions/522359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to finish up a Flash website for my company, and am having some major frustrations with Lightwindow links in Flash. I have a "Videos" page that has a few links, that when you click on one, it opens a Lightbox with a .SWF that plays the video. The problem is that the top of the Lightwindow and the Flash menu ...
Wouldn't call it coding standard - more like coding style ``` SELECT T1.col1, T1.col2, T2.col3 FROM table1 T1 INNER JOIN ON Table2 T2 ON T1.ID = T2.ID WHERE T1.col1 = 'xxx' AND T2.Col3 = 'yyy' ``` * capitalize reserved words * main keywords on new line * can't get used to commas before co...
522,367
<p>Ok so I realize that this is a pretty vague question, but bear with me.</p> <p>I have experienced this problem on numerous occasions with different and unrelated queries. The query below takes many minutes to execute:</p> <pre><code>SELECT &lt;Fields&gt; FROM &lt;Multiple Tables Joined&gt; LEFT JOIN (SELECT &...
[ { "answer_id": 522406, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 5, "selected": true, "text": "<p>If any of those tables are table variables, the optimizer uses a bad estimate of 0 rows and usually chooses nested loop as t...
2009/02/06
[ "https://Stackoverflow.com/questions/522367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6819/" ]
Ok so I realize that this is a pretty vague question, but bear with me. I have experienced this problem on numerous occasions with different and unrelated queries. The query below takes many minutes to execute: ``` SELECT <Fields> FROM <Multiple Tables Joined> LEFT JOIN (SELECT <Fields> FROM <Multiple Tables Join...
If any of those tables are table variables, the optimizer uses a bad estimate of 0 rows and usually chooses nested loop as the join technique. It does this due to a lack of statistics on the tables involved.
522,370
<p>I was wondering what some of the best practices were around logging and logging frameworks and dependency injection. Specifically, if I am designing a class that needs a way to log, how should I go about getting an interface to log to keeping dependency injection in mind?</p> <p>Dependency injection seems to state ...
[ { "answer_id": 522396, "author": "JMD", "author_id": 56793, "author_profile": "https://Stackoverflow.com/users/56793", "pm_score": 2, "selected": false, "text": "<p>This won't be a complete answer, but one consideration will be that if you inject your ILog via your class' constructor you...
2009/02/06
[ "https://Stackoverflow.com/questions/522370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9222/" ]
I was wondering what some of the best practices were around logging and logging frameworks and dependency injection. Specifically, if I am designing a class that needs a way to log, how should I go about getting an interface to log to keeping dependency injection in mind? Dependency injection seems to state that exter...
It's great that you're looking into inversion-of-control and dependency-injection. But for your question, there's another concept you might want to look into: aspect-oriented programming. In .NET, there are some good frameworks available for doing aspect-oriented programming, including Castle, LinFu, and Microsoft's ...
522,372
<p>Is there any built-in methods that are part of lists that would give me the first and last index of some value, like:</p> <pre><code>verts.IndexOf(12.345) verts.LastIndexOf(12.345) </code></pre>
[ { "answer_id": 522401, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 8, "selected": true, "text": "<p>Sequences have a method <code>index(value)</code> which returns index of first occurrence - in your case this would ...
2009/02/06
[ "https://Stackoverflow.com/questions/522372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51816/" ]
Is there any built-in methods that are part of lists that would give me the first and last index of some value, like: ``` verts.IndexOf(12.345) verts.LastIndexOf(12.345) ```
Sequences have a method `index(value)` which returns index of first occurrence - in your case this would be `verts.index(value)`. You can run it on `verts[::-1]` to find out the last index. Here, this would be `len(verts) - 1 - verts[::-1].index(value)`
522,376
<p>I'm trying to create a small Javascript "framework" that I can use in my greasemonkey scripts. I only need <strong>very</strong> basic functions, so this is why I choose not to use mooTools or DOMAssistant. Besides, I'm not going to be silly and put DOMAssitant in a 20KB Greasemonkey script! I just want a small, nea...
[ { "answer_id": 522415, "author": "Crescent Fresh", "author_id": 45433, "author_profile": "https://Stackoverflow.com/users/45433", "pm_score": 4, "selected": true, "text": "<p>Write your methods to operate on the <em>set</em> of nodes returned from <code>$</code>. That way both <code>$('b...
2009/02/06
[ "https://Stackoverflow.com/questions/522376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63523/" ]
I'm trying to create a small Javascript "framework" that I can use in my greasemonkey scripts. I only need **very** basic functions, so this is why I choose not to use mooTools or DOMAssistant. Besides, I'm not going to be silly and put DOMAssitant in a 20KB Greasemonkey script! I just want a small, neat snippet of cod...
Write your methods to operate on the *set* of nodes returned from `$`. That way both `$('bob').setStyle()` *and* `$('bob', 'amy').setStyle()` will work. I see you have a generic `forEach` or `each` method which is a good start. ``` var fmini = { $: function() { var i=0, obj; var e = []; e.s...
522,394
<p>I'm trying to find the handle of the <strong>main</strong> thread of an external application. The program I am trying to find the main thread of is multithreaded and it is important I always find the main thread. I know that at most there will be one copy of this program running. This is how I am doing it at the mom...
[ { "answer_id": 522557, "author": "Brian Rasmussen", "author_id": 38206, "author_profile": "https://Stackoverflow.com/users/38206", "pm_score": 3, "selected": true, "text": "<p>This is a wild guess, but via <code>Processes</code>, you can get a <code>ProcessThreadCollection</code> via the...
2009/02/06
[ "https://Stackoverflow.com/questions/522394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to find the handle of the **main** thread of an external application. The program I am trying to find the main thread of is multithreaded and it is important I always find the main thread. I know that at most there will be one copy of this program running. This is how I am doing it at the moment: ``` Proces...
This is a wild guess, but via `Processes`, you can get a `ProcessThreadCollection` via the `Threads` property. Each thread has a `StartTime` (available as `Ticks` as well), so assuming the main thread is the first to start, you could pick the one with the lowest start time. Otherwise if you can get the call stack for ...
522,395
<p>I've set up a SOAP WebServiceProvider in JAX-WS, but I'm having trouble figuring out how to get the raw XML from a SOAPMessage (or any Node) object. Here's a sample of the code I've got right now, and where I'm trying to grab the XML:</p> <pre><code>@WebServiceProvider(wsdlLocation="SoapService.wsdl") @ServiceMode...
[ { "answer_id": 587343, "author": "Dan Lew", "author_id": 60261, "author_profile": "https://Stackoverflow.com/users/60261", "pm_score": 5, "selected": true, "text": "<p>It turns out that one can get the raw XML by using Provider&lt;Source>, in this way:</p>\n\n<pre><code>import java.io.By...
2009/02/06
[ "https://Stackoverflow.com/questions/522395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60261/" ]
I've set up a SOAP WebServiceProvider in JAX-WS, but I'm having trouble figuring out how to get the raw XML from a SOAPMessage (or any Node) object. Here's a sample of the code I've got right now, and where I'm trying to grab the XML: ``` @WebServiceProvider(wsdlLocation="SoapService.wsdl") @ServiceMode(value=Service....
It turns out that one can get the raw XML by using Provider<Source>, in this way: ``` import java.io.ByteArrayOutputStream; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.ws.Provi...
522,408
<p>I have two models: Person and Relation. The second one stores information about relations between two people. It has parent_id and child_id fields and doesn`t have id field. I connected it with has_many :through and it works.</p> <p>But:</p> <ol> <li>Relation.find(:all) returns empty array even if there are some r...
[ { "answer_id": 522458, "author": "Alex Wayne", "author_id": 62076, "author_profile": "https://Stackoverflow.com/users/62076", "pm_score": 4, "selected": true, "text": "<p>has_many :through depends on an id in the join table. It makes the join table a whole model. Since every operation ...
2009/02/06
[ "https://Stackoverflow.com/questions/522408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58877/" ]
I have two models: Person and Relation. The second one stores information about relations between two people. It has parent\_id and child\_id fields and doesn`t have id field. I connected it with has\_many :through and it works. But: 1. Relation.find(:all) returns empty array even if there are some relations in the t...
has\_many :through depends on an id in the join table. It makes the join table a whole model. Since every operation with records happens with an id, you wont be able to directly interface with a table without it. When you delete a record rails generates sql to delete the record by its id. **If you have a join table tha...
522,430
<p>So for a list that has 1000 elements, I want to loop from 400 to 500. How do you do it?</p> <p>I don't see a way by using the for each and for range techniques.</p>
[ { "answer_id": 522439, "author": "Georg Schölly", "author_id": 24587, "author_profile": "https://Stackoverflow.com/users/24587", "pm_score": 3, "selected": false, "text": "<pre><code>for element in allElements[400:501]:\n # do something\n</code></pre>\n\n<p>These are <a href=\"http:/...
2009/02/06
[ "https://Stackoverflow.com/questions/522430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51816/" ]
So for a list that has 1000 elements, I want to loop from 400 to 500. How do you do it? I don't see a way by using the for each and for range techniques.
``` for x in thousand[400:500]: pass ``` If you are working with an iterable instead of a list, you should use [itertools](http://docs.python.org/library/itertools): ``` import itertools for x in itertools.islice(thousand, 400, 500): pass ``` If you need to loop over `thousand[500]`, then use 501 as the la...
522,434
<p>For my current project we want to present statistical data and rank it. For my case I'm talking about "Favouriting" of an artist, counting the times an artist's track has been played, displaying a count of how many playlists an artists track has been added to a playlist... These are all very domain specific issues, ...
[ { "answer_id": 522470, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 2, "selected": false, "text": "<p>Scanning by a plain index is akin to a join, as plain indices contain a indexed value along with a reference to a tabl...
2009/02/06
[ "https://Stackoverflow.com/questions/522434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1894/" ]
For my current project we want to present statistical data and rank it. For my case I'm talking about "Favouriting" of an artist, counting the times an artist's track has been played, displaying a count of how many playlists an artists track has been added to a playlist... These are all very domain specific issues, but...
Scanning by a plain index is akin to a join, as plain indices contain a indexed value along with a reference to a table block in each leaf. To extract a non-indexed value you need to "join" the table by this block reference. Clustered indexes, on the contrary, contain the table data itself it each leaf, you get the no...
522,435
<p>I am trying to create a menu using anchor tags, and they should butt up next to each other, so related links can be connected with a border. Here is some example code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; a { border: 1px solid #939393; margin: 1...
[ { "answer_id": 522467, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 4, "selected": true, "text": "<p>You should make the boxes into blocks by changing your CSS for <code>&lt;a&gt;</code> to this:</p>\n\n<pre><code>a {\n ...
2009/02/06
[ "https://Stackoverflow.com/questions/522435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4257/" ]
I am trying to create a menu using anchor tags, and they should butt up next to each other, so related links can be connected with a border. Here is some example code: ``` <html> <head> <style type="text/css"> a { border: 1px solid #939393; margin: 15px; padding: 8px; ...
You should make the boxes into blocks by changing your CSS for `<a>` to this: ``` a { border: 1px solid #939393; margin: 15px; padding: 8px; display: block; float: left; } ```
522,437
<p>I have two questions: </p> <p>Can you have parameterised unit tests in qunit?</p> <p>How do you do mocking with qunit e.g. mocking a <code>getJSON</code> call?</p> <p>Thanks</p>
[ { "answer_id": 2126530, "author": "Johnny Oshika", "author_id": 188740, "author_profile": "https://Stackoverflow.com/users/188740", "pm_score": 6, "selected": false, "text": "<p>For mocking ajax requests, you can try something like this...</p>\n\n<p>Here's the function you want to test:<...
2009/02/06
[ "https://Stackoverflow.com/questions/522437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have two questions: Can you have parameterised unit tests in qunit? How do you do mocking with qunit e.g. mocking a `getJSON` call? Thanks
For mocking ajax requests, you can try something like this... Here's the function you want to test: ``` var functionToTest = function () { $.ajax({ url: 'someUrl', type: 'POST', dataType: 'json', data: 'foo=1&foo=2&foo=3', success: function (data...
522,452
<p>This is a double question: The correct answer will go to "How you do it in PHP" explaining if there is any advantage goes also counts if possible.</p> <p>I'm just curious because I really don't know and I see it a lot in webpages.</p> <p>Edit: I don't know the technical name, but for example here on Stackoverflow:...
[ { "answer_id": 522489, "author": "Christoph", "author_id": 48015, "author_profile": "https://Stackoverflow.com/users/48015", "pm_score": 0, "selected": false, "text": "<p>The advantage is readability and possibly a better placement in search engines.</p>\n\n<p>You can achieve this via <c...
2009/02/06
[ "https://Stackoverflow.com/questions/522452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26004/" ]
This is a double question: The correct answer will go to "How you do it in PHP" explaining if there is any advantage goes also counts if possible. I'm just curious because I really don't know and I see it a lot in webpages. Edit: I don't know the technical name, but for example here on Stackoverflow: "`http://stackov...
If you're referring to `/posts/edit/522452`-style URLs as opposed to `/posts.asp?action=edit&postid=522452`-style URLs (or whatever it translates to on the back end), this is typically done through a URL rewriter, such as [`mod_rewrite`](http://httpd.apache.org/docs/2.0/misc/rewriteguide.html). A rule for that URL migh...
522,468
<p>We have a scenario where in if an entity exists between the source and target, we are supposed to merge data in the target i.e. copy values from foundation columns where the target column is blank. </p> <p>We are using WCF servcie calls and we have the entity objects. </p> <p>If i have an entity lets say <code>Sta...
[ { "answer_id": 522494, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 3, "selected": false, "text": "<p>You could get all the properties through reflection, and then call GetValue on each PropertyInfo instance. Where it ...
2009/02/06
[ "https://Stackoverflow.com/questions/522468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63534/" ]
We have a scenario where in if an entity exists between the source and target, we are supposed to merge data in the target i.e. copy values from foundation columns where the target column is blank. We are using WCF servcie calls and we have the entity objects. If i have an entity lets say `Staff`, staff conatins th...
Here's a quick and dirty way to do it with LINQ ``` public static IEnumerable<string> FindBlankFields(Staff staff) { return staff.GetType() .GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) .Where(p => p.CanRead) .Select(p => new { Property = p...
522,492
<p>I'm trying to get a DIV element into a table cell, in a way in which the <code>&lt;div&gt;</code> spreads along all the cell's area. But, for unknown reason, a 1px <code>border</code> appears; as far as I know, it's neither part of the table or the div (table has no borders, padding or spacing, and the div has no ma...
[ { "answer_id": 522508, "author": "BC.", "author_id": 54838, "author_profile": "https://Stackoverflow.com/users/54838", "pm_score": 2, "selected": false, "text": "<p>CSS property is \"border-spacing\" instead of \"spacing\"</p>\n\n<p>In addition I reset tables using</p>\n\n<pre><code>outl...
2009/02/06
[ "https://Stackoverflow.com/questions/522492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34479/" ]
I'm trying to get a DIV element into a table cell, in a way in which the `<div>` spreads along all the cell's area. But, for unknown reason, a 1px `border` appears; as far as I know, it's neither part of the table or the div (table has no borders, padding or spacing, and the div has no margin or padding). Perhaps you c...
``` <table cellspacing="0" cellpadding="0" border="0"> ``` -- or -- ``` td { padding:0 } ```
522,498
<p>If my goal is to test the rendering speed in IE of a specific web page through repeated loads (merely using a javascript onload event for timing and viewing the page doesn't cut it), what would be a good way to do it?</p> <p>My current attempt was by using the IE WebBrowser object in VB and C#, though I'm open to o...
[ { "answer_id": 522508, "author": "BC.", "author_id": 54838, "author_profile": "https://Stackoverflow.com/users/54838", "pm_score": 2, "selected": false, "text": "<p>CSS property is \"border-spacing\" instead of \"spacing\"</p>\n\n<p>In addition I reset tables using</p>\n\n<pre><code>outl...
2009/02/06
[ "https://Stackoverflow.com/questions/522498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18192/" ]
If my goal is to test the rendering speed in IE of a specific web page through repeated loads (merely using a javascript onload event for timing and viewing the page doesn't cut it), what would be a good way to do it? My current attempt was by using the IE WebBrowser object in VB and C#, though I'm open to other sugge...
``` <table cellspacing="0" cellpadding="0" border="0"> ``` -- or -- ``` td { padding:0 } ```
522,522
<p>I'm using Windbg (with the sos extention) and trying to debug a crashed application. I was able to dump the IL of the call that threw the exception and by examining the code, it seems like I could obtain the information that I need if I could dump the contents of the evaluation stack. Is it possible to do what wit...
[ { "answer_id": 522679, "author": "Brian Rasmussen", "author_id": 38206, "author_profile": "https://Stackoverflow.com/users/38206", "pm_score": 4, "selected": true, "text": "<p>You need to identify and select the right thread. The id of the current thread is displayed in the WinDbg prompt...
2009/02/06
[ "https://Stackoverflow.com/questions/522522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63074/" ]
I'm using Windbg (with the sos extention) and trying to debug a crashed application. I was able to dump the IL of the call that threw the exception and by examining the code, it seems like I could obtain the information that I need if I could dump the contents of the evaluation stack. Is it possible to do what with Win...
You need to identify and select the right thread. The id of the current thread is displayed in the WinDbg prompt. `!threads` will display all managed threads in your application. Once identified you can switch threads using `~Xs` where X is the WinDbg id for the thread. `!clrstack` will show you the stack trace. If ...
522,563
<p>How do I access the index while iterating over a sequence with a <code>for</code> loop?</p> <pre><code>xs = [8, 23, 45] for x in xs: print(&quot;item #{} = {}&quot;.format(index, x)) </code></pre> <p>Desired output:</p> <pre class="lang-none prettyprint-override"><code>item #1 = 8 item #2 = 23 item #3 = 45 </co...
[ { "answer_id": 522569, "author": "David Hanak", "author_id": 42136, "author_profile": "https://Stackoverflow.com/users/42136", "pm_score": 7, "selected": false, "text": "<pre><code>for i in range(len(ints)):\n print(i, ints[i]) # print updated to print() in Python 3.x+ \n</code></pre>\...
2009/02/06
[ "https://Stackoverflow.com/questions/522563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51816/" ]
How do I access the index while iterating over a sequence with a `for` loop? ``` xs = [8, 23, 45] for x in xs: print("item #{} = {}".format(index, x)) ``` Desired output: ```none item #1 = 8 item #2 = 23 item #3 = 45 ```
Use the built-in function [`enumerate()`](https://docs.python.org/3/library/functions.html#enumerate "enumerate"): ``` for idx, x in enumerate(xs): print(idx, x) ``` It is *[non-pythonic](https://stackoverflow.com/questions/25011078/what-does-pythonic-mean)* to manually index via `for i in range(len(xs)): x = xs...
522,585
<p>The parameterizedthreadstart object has an enqueueworkitem. This (if I can remember my methods and their parameters correctly) takes an object parameter as "state".</p> <p>However, when I have a method which has several object parameters (e.g. string, int which are children of object) what can I do to pass all of t...
[ { "answer_id": 522595, "author": "Brian Rasmussen", "author_id": 38206, "author_profile": "https://Stackoverflow.com/users/38206", "pm_score": 0, "selected": false, "text": "<p>You can always wrap any number of arguments you need in a type and pass an instance of that. </p>\n" }, { ...
2009/02/06
[ "https://Stackoverflow.com/questions/522585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
The parameterizedthreadstart object has an enqueueworkitem. This (if I can remember my methods and their parameters correctly) takes an object parameter as "state". However, when I have a method which has several object parameters (e.g. string, int which are children of object) what can I do to pass all of these param...
It's perfectly legal to pass an object[] to a function that takes object. Any type is convertible to object. In the called function simply cast the state parameter back to object[] and you're good to go. ``` public void CallThreadPool(object[] arguments) { ThreadPool.QueueUserWorkItem(new WaitCallBack(MyThreadPro...
522,586
<p>I've hit a small dilemma! I have a handler called vote; when it is invoked it sets a user's vote to whatever they have picked. To remember what options they previously picked, I store a VoteRecord options which details what their current vote is set to.</p> <p>Of course, the first time they vote, I have to create t...
[ { "answer_id": 523057, "author": "gravitation", "author_id": 62398, "author_profile": "https://Stackoverflow.com/users/62398", "pm_score": 2, "selected": true, "text": "<p>The issue is this part: </p>\n\n<pre><code>if vote.count(1) == 0:\n obj = VoteRecord()\n obj.user = user\n ...
2009/02/06
[ "https://Stackoverflow.com/questions/522586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've hit a small dilemma! I have a handler called vote; when it is invoked it sets a user's vote to whatever they have picked. To remember what options they previously picked, I store a VoteRecord options which details what their current vote is set to. Of course, the first time they vote, I have to create the object ...
The issue is this part: ``` if vote.count(1) == 0: obj = VoteRecord() obj.user = user obj.option = option obj.put() ``` Without a transaction, your code could run in this order in two interpreter instances: ``` if vote.count(1) == 0: obj = VoteRecord() obj.user = user if vote.count(1) == 0...
522,591
<p>I've been working on my issue for 30 hours. Each time I fix one thing a new error arises. All I want to do is take a DataTables from memory and simply update an Access .MDB file. Here is my code:</p> <pre><code>using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System....
[ { "answer_id": 522612, "author": "jdigital", "author_id": 37231, "author_profile": "https://Stackoverflow.com/users/37231", "pm_score": 0, "selected": false, "text": "<p>Is there any way to dump out the SQL? If you can do that, you should be able to spot the problem.</p>\n" }, { ...
2009/02/06
[ "https://Stackoverflow.com/questions/522591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60615/" ]
I've been working on my issue for 30 hours. Each time I fix one thing a new error arises. All I want to do is take a DataTables from memory and simply update an Access .MDB file. Here is my code: ``` using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.IO; using Syst...
``` destCmdB.QuotePrefix = "["; // quote reserved column names destCmdB.QuotePrefix = "]"; ``` QuotePrefix twice? Perhaps that could be an issue.
522,625
<p>Classes I create in <strong>~/App_Code</strong> are put into the <strong>App_Code</strong> assembly.</p> <p>If I create the following ASP.NET UserControl:</p> <p><strong>~/UserControls/BasicUserControl.ascx</strong></p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="BasicUserControl.ascx...
[ { "answer_id": 522633, "author": "Element", "author_id": 50970, "author_profile": "https://Stackoverflow.com/users/50970", "pm_score": 2, "selected": false, "text": "<p>Build your website then checkout the ASP.UserControls_BasicUserControl_ascx namespace/class</p>\n\n<p>everytime you mak...
2009/02/06
[ "https://Stackoverflow.com/questions/522625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12689/" ]
Classes I create in **~/App\_Code** are put into the **App\_Code** assembly. If I create the following ASP.NET UserControl: **~/UserControls/BasicUserControl.ascx** ``` <%@ Control Language="C#" AutoEventWireup="true" CodeFile="BasicUserControl.ascx.cs" Inherits="UserControl_BasicUserControl" %> Hello world! ``` *...
Build your website then checkout the ASP.UserControls\_BasicUserControl\_ascx namespace/class everytime you make a change to the .ascx you will have to build the project for the changes to show up in intellisense though
522,634
<p>I am getting the following error. It doesn't happen to all the time, but once it starts, it won't stop.</p> <pre> Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS while calling DBMS_METADATA.FETCH_XML_CLOB [] ORA-31642: the followin...
[ { "answer_id": 528642, "author": "Luke Woodward", "author_id": 48503, "author_profile": "https://Stackoverflow.com/users/48503", "pm_score": 0, "selected": false, "text": "<p>This may turn out not to be helpful, but I'd be interested to know what the errors in the package body <code>DMSY...
2009/02/06
[ "https://Stackoverflow.com/questions/522634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6013/" ]
I am getting the following error. It doesn't happen to all the time, but once it starts, it won't stop. ``` Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS while calling DBMS_METADATA.FETCH_XML_CLOB [] ORA-31642: the following SQL st...
Answer: the error doesn't matter because the datamining is not used. The export still occurs. It appears that the reason is that the DMSYS package was INVALID according to the following query ``` SQL> connect system/passwd SQL> set lines 200 SQL> select status, object_id, object_type, ...
522,637
<p>I've spent the last 4 years in C# so I'm interested in current best practices and common design patterns in C++. Consider the following partial example:</p> <pre><code>class World { public: void Add(Object *object); void Remove(Object *object); void Update(); } class Fire : Object { public: virtua...
[ { "answer_id": 522651, "author": "Yes - that Jake.", "author_id": 5287, "author_profile": "https://Stackoverflow.com/users/5287", "pm_score": 0, "selected": false, "text": "<p>I don't this there's anything inherently wrong with an object deleting itself, but another possible method would...
2009/02/06
[ "https://Stackoverflow.com/questions/522637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40944/" ]
I've spent the last 4 years in C# so I'm interested in current best practices and common design patterns in C++. Consider the following partial example: ``` class World { public: void Add(Object *object); void Remove(Object *object); void Update(); } class Fire : Object { public: virtual void Update()...
The problem with this is that you're really creating an implicit coupling between the object and the World class. If I try to call Update() outside the World class, what happens? I might end up with the object being deleted, and I don't know why. It seems the responsibilities are badly mixed up. This is going to cause...
522,639
<p>I'm trying to crop a NSImage which contains a PDF. When printing I am using NSImage's drawInRect to have it draw only what I need - and this works great.</p> <p>But, now instead I'm trying to create a new NSImage of just the cropped area. I played with it for a while, then found this code on CocoaBuilder:</p> <pre...
[ { "answer_id": 522780, "author": "Peter Hosey", "author_id": 30461, "author_profile": "https://Stackoverflow.com/users/30461", "pm_score": 4, "selected": true, "text": "<p><code>lockFocus</code>/<code>unlockFocus</code> performs raster drawing to the image's cache. That's why it's “blurr...
2009/02/06
[ "https://Stackoverflow.com/questions/522639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61831/" ]
I'm trying to crop a NSImage which contains a PDF. When printing I am using NSImage's drawInRect to have it draw only what I need - and this works great. But, now instead I'm trying to create a new NSImage of just the cropped area. I played with it for a while, then found this code on CocoaBuilder: ``` - (NSImage *) ...
`lockFocus`/`unlockFocus` performs raster drawing to the image's cache. That's why it's “blurry”—it's low-resolution and possibly misregistered. You need vector drawing. Use PDF Kit. First, set the crop box of each page to your rectangle. You should then be able to create your cropped NSImage from the `dataRepresentat...
522,648
<p>I've noticed when I pull up exchange management console, it shows mailboxes which have the "Recipient Type Details" as Legacy Mailboxes. </p> <p>How do I go about querying which ones are legacy, user or linked mailboxes? </p> <p>I've tried</p> <pre><code>get-mailbox -identity &lt;displayname&gt; | select deletedi...
[ { "answer_id": 524023, "author": "Shay Levy", "author_id": 9833, "author_profile": "https://Stackoverflow.com/users/9833", "pm_score": 1, "selected": false, "text": "<p>This will get you all Legacy or Linked mailboxes:</p>\n\n<pre><code>Get-Mailbox -resulteSize unlimited -RecipientTypeDe...
2009/02/06
[ "https://Stackoverflow.com/questions/522648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
I've noticed when I pull up exchange management console, it shows mailboxes which have the "Recipient Type Details" as Legacy Mailboxes. How do I go about querying which ones are legacy, user or linked mailboxes? I've tried ``` get-mailbox -identity <displayname> | select deleteditemflags ``` but that doesn't s...
This will get you all Legacy or Linked mailboxes: ``` Get-Mailbox -resulteSize unlimited -RecipientTypeDetails LegacyMailbox,LinkedMailbox ``` For just one user: ``` Get-Mailbox -Identity userName -RecipientTypeDetails LegacyMailbox,LinkedMailbox ``` EDIT: Get all mailboxes name and type ``` Get-Mailbox | For...
522,656
<p>All of my codes fail. They should print "he", "hello" and "5 \n 3", respectively:</p> <pre><code>awk -v e='he' {print $e} // not working, why? awk NF { print hello } awk { print ARGV[5,3] } </code></pre> <p><strong>Are there some simple examples about AWK?</strong></p>
[ { "answer_id": 522664, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 3, "selected": true, "text": "<p>For the first, you don't use $ for variables inside awk, try this instead:</p>\n\n<pre><code>fury&gt; echo | awk -v e=...
2009/02/06
[ "https://Stackoverflow.com/questions/522656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54964/" ]
All of my codes fail. They should print "he", "hello" and "5 \n 3", respectively: ``` awk -v e='he' {print $e} // not working, why? awk NF { print hello } awk { print ARGV[5,3] } ``` **Are there some simple examples about AWK?**
For the first, you don't use $ for variables inside awk, try this instead: ``` fury> echo | awk -v e='he' '{print e}' he ``` For the second, your condition NF means NF!=0 so it will only print for non empty lines: ``` fury> echo | awk 'NF {print "hello"}' fury> echo "7 8" | awk 'NF {print "hello"}' hello ``` I've...
522,666
<p>I am using jQuery to make some ajax calls and wonder how people handle this situation. </p> <ol> <li>An ajax request is made to the server to retrieve some info.</li> <li>Before the request returns another request is made. The first request is now invalid and out of date.</li> </ol> <p>How do I tell that the initi...
[ { "answer_id": 522675, "author": "nickohrn", "author_id": 59907, "author_profile": "https://Stackoverflow.com/users/59907", "pm_score": 0, "selected": false, "text": "<p>I've never been in this situation before, but you could send over a key that you increment when making the request and...
2009/02/06
[ "https://Stackoverflow.com/questions/522666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27294/" ]
I am using jQuery to make some ajax calls and wonder how people handle this situation. 1. An ajax request is made to the server to retrieve some info. 2. Before the request returns another request is made. The first request is now invalid and out of date. How do I tell that the initial request is now invalid and can...
jQuery returns the `XmlHttpRequest` object from the call to `ajax()`, which I've used to achieve what you desire as follows: ``` var lastRequest; function getSomeData() { if(lastRequest) { lastRequest.abort(); lastRequest = null } lastRequest = $.ajax(...); } ``` The net effect is that ea...
522,712
<p>I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed. </p> <p>But I'm having trouble figuring out how to add a Processing Instruction to output that points to my CSS stylesheet.</p> <p>What I need is a processing instruction that looks a bit like this:</p> <pre><c...
[ { "answer_id": 522675, "author": "nickohrn", "author_id": 59907, "author_profile": "https://Stackoverflow.com/users/59907", "pm_score": 0, "selected": false, "text": "<p>I've never been in this situation before, but you could send over a key that you increment when making the request and...
2009/02/06
[ "https://Stackoverflow.com/questions/522712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10115/" ]
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed. But I'm having trouble figuring out how to add a Processing Instruction to output that points to my CSS stylesheet. What I need is a processing instruction that looks a bit like this: ``` <?xml-stylesheet type="t...
jQuery returns the `XmlHttpRequest` object from the call to `ajax()`, which I've used to achieve what you desire as follows: ``` var lastRequest; function getSomeData() { if(lastRequest) { lastRequest.abort(); lastRequest = null } lastRequest = $.ajax(...); } ``` The net effect is that ea...
522,715
<p>There is a very <a href="https://stackoverflow.com/questions/225471/how-do-i-replace-accented-latin-characters-in-ruby">similar question</a> already. One of the solutions uses code like this one:</p> <pre><code>string.mb_chars.normalize(:kd).gsub(/[^x00-\x7F]/n, '').to_s </code></pre> <p>Which works wonders, until...
[ { "answer_id": 522840, "author": "bobince", "author_id": 18936, "author_profile": "https://Stackoverflow.com/users/18936", "pm_score": 5, "selected": true, "text": "<blockquote>\n <p>it also removes spaces, dots, dashes, and who knows what else.</p>\n</blockquote>\n\n<p>It shouldn't.</p...
2009/02/06
[ "https://Stackoverflow.com/questions/522715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16957/" ]
There is a very [similar question](https://stackoverflow.com/questions/225471/how-do-i-replace-accented-latin-characters-in-ruby) already. One of the solutions uses code like this one: ``` string.mb_chars.normalize(:kd).gsub(/[^x00-\x7F]/n, '').to_s ``` Which works wonders, until you notice it also removes spaces, d...
> > it also removes spaces, dots, dashes, and who knows what else. > > > It shouldn't. ``` string.mb_chars.normalize(:kd).gsub(/[^x00-\x7F]/n, '').to_s ``` You've mistyped, there should be a backslash before the x00, to refer to the NUL character. ``` /[^\-x00-\x7F]/n # So it would leave the dash alone ``` Y...
522,720
<p>I am trying to mess around a little bit with Ruby. Therefor I try to implement the algorithms (given in Python) from the book "Programming Collective Intelligence" Ruby.</p> <p>In chapter 8 the author passes a method a as parameter. This seems to work in Python but not in Ruby.</p> <p>I have here the method</p> <...
[ { "answer_id": 522727, "author": "Tiago", "author_id": 55283, "author_profile": "https://Stackoverflow.com/users/55283", "pm_score": 2, "selected": false, "text": "<p>You have to call the method \"call\" of the function object:</p>\n\n<pre><code>weight = weightf.call( dist )\n</code></pr...
2009/02/07
[ "https://Stackoverflow.com/questions/522720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56376/" ]
I am trying to mess around a little bit with Ruby. Therefor I try to implement the algorithms (given in Python) from the book "Programming Collective Intelligence" Ruby. In chapter 8 the author passes a method a as parameter. This seems to work in Python but not in Ruby. I have here the method ``` def gaussian(dist,...
You want a proc object: ``` gaussian = Proc.new do |dist, *args| sigma = args.first || 10.0 ... end def weightedknn(data, vec1, k = 5, weightf = gaussian) ... weight = weightf.call(dist) ... end ``` Just note that you can't set a default argument in a block declaration like that. So you need to use a spla...
522,728
<p>I'm trying out my first Spring project and must be doing something really stupid because I can't figure out how to get the following simple snippet of code to work:</p> <p>Here is my definition file:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema...
[ { "answer_id": 522750, "author": "Ish", "author_id": 58175, "author_profile": "https://Stackoverflow.com/users/58175", "pm_score": 2, "selected": false, "text": "<p>Nevermind it was something really dumb. My setters weren't correct -- thats what I get for using the eclipse auto generate....
2009/02/07
[ "https://Stackoverflow.com/questions/522728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58175/" ]
I'm trying out my first Spring project and must be doing something really stupid because I can't figure out how to get the following simple snippet of code to work: Here is my definition file: ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://...
This is a case where using final on parameters would have helped. You can set Eclipse to add Final to parameters as a Save Action. Mind you - you won't make the same mistake twice!
522,730
<p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)...
[ { "answer_id": 522779, "author": "James Brady", "author_id": 29903, "author_profile": "https://Stackoverflow.com/users/29903", "pm_score": 2, "selected": false, "text": "<p>As an imperfect shortcut, how about mocking out <code>logging</code> in specific modules using something like <a hr...
2009/02/07
[ "https://Stackoverflow.com/questions/522730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
Today I was thinking about a Python project I wrote about a year back where I used `logging` pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (`hotshot` indicated it was one of my biggest bottlenecks). I wonder now if there'...
What about using [logging.disable](http://docs.python.org/library/logging.html?highlight=logging#logging.disable "logging.disable")? I've also found I had to use [logging.isEnabledFor](http://docs.python.org/library/logging.html?highlight=logging#logging.Logger.isEnabledFor) if the logging message is expensive to crea...
522,753
<p>Semantically, I want an itemized list, but visually I just want some space. How can I hide the bullets?</p>
[ { "answer_id": 522760, "author": "alamodey", "author_id": 58521, "author_profile": "https://Stackoverflow.com/users/58521", "pm_score": 6, "selected": false, "text": "<pre><code>\\item[] text\n</code></pre>\n\n<p>Optionally, you can put something inside the [].</p>\n" }, { "answe...
2009/02/07
[ "https://Stackoverflow.com/questions/522753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
Semantically, I want an itemized list, but visually I just want some space. How can I hide the bullets?
I can't speak for any other setup, but I'm using Tufte-Latex on MacTex, and I just typed the following: `\begin{itemize}[]` It worked. :-) I love it when guessing does that. So just try adding `[]` after. P.S. the "generalized" list from lindelof worked also, but they didn't line up as nicely as with itemize. Jaku...
522,800
<p>For my Android application there is a timer that measures how much time has passed. Ever 100 milliseconds I update my TextView with some text like "Score: 10 Time: 100.10 seconds". But, I find the TextView only updates the first few times. The application is still very responsive, but the label will not update. I tr...
[ { "answer_id": 523070, "author": "haseman", "author_id": 62516, "author_profile": "https://Stackoverflow.com/users/62516", "pm_score": 2, "selected": false, "text": "<p>What I think is happening is you're falling off the UI thread. There is a single \"looper\" thread which handles all s...
2009/02/07
[ "https://Stackoverflow.com/questions/522800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/764272/" ]
For my Android application there is a timer that measures how much time has passed. Ever 100 milliseconds I update my TextView with some text like "Score: 10 Time: 100.10 seconds". But, I find the TextView only updates the first few times. The application is still very responsive, but the label will not update. I tried...
The general solution is to use android.os.Handler instead which runs in the UI thread. It only does one-shot callbacks, so you have to trigger it again every time your callback is called. But it is easy enough to use. A blog post on this topic was written a couple of years ago: <http://android-developers.blogspot.com...
522,814
<p>I am wanting some expert guidance here on what the best approach is for me to solve a problem. I have investigated some machine learning, neural networks, and stuff like that. I've investigated weka, some sort of baesian solution.. R.. several different things. I'm not sure how to really proceed, though. Here's ...
[ { "answer_id": 522901, "author": "Jude Allred", "author_id": 1388, "author_profile": "https://Stackoverflow.com/users/1388", "pm_score": 1, "selected": false, "text": "<p>If you have some classified data - a bunch of sample problems paired with their correct answers -, start by training ...
2009/02/07
[ "https://Stackoverflow.com/questions/522814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62046/" ]
I am wanting some expert guidance here on what the best approach is for me to solve a problem. I have investigated some machine learning, neural networks, and stuff like that. I've investigated weka, some sort of baesian solution.. R.. several different things. I'm not sure how to really proceed, though. Here's my prob...
Sounds like you're a candidate for [Support Vector Machines](http://en.wikipedia.org/wiki/Support_Vector_Machines). Go get [libsvm](http://www.csie.ntu.edu.tw/~cjlin/libsvm/). Read "A practical guide to SVM classification", which they distribute, and is short. Basically, you're going to take your events, and format t...
522,815
<p>Given the following tables in ActiveRecord:</p> <ul> <li>authors</li> <li>sites</li> <li>articles</li> </ul> <p>I don't know how to express that an author is paid a different amount depending on the publication, but that authors working for the same publication have different rates:</p> <ul> <li>John publishes an...
[ { "answer_id": 522837, "author": "Clinton Pierce", "author_id": 8173, "author_profile": "https://Stackoverflow.com/users/8173", "pm_score": 1, "selected": false, "text": "<p>Its straightforward, but I don't know if there's a specific name for this relationship.</p>\n\n<p>It looks like yo...
2009/02/07
[ "https://Stackoverflow.com/questions/522815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63565/" ]
Given the following tables in ActiveRecord: * authors * sites * articles I don't know how to express that an author is paid a different amount depending on the publication, but that authors working for the same publication have different rates: * John publishes an article in Foo for $300 * John publishes an article ...
Its a has and belongs to many with a rich join table. ``` class Author has_many :publications, :through => :rates end class Publication has_many :authors, :through => :rates end class Rate #rich join table belongs_to :author belongs_to :publication end ``` And you can then simplify your finding like this: ...
522,816
<p>I'm creating a VideoPlayer object in a swf and that works well. I'm sizing it using autoSize and that's working fine too. I'm trying to make it so that when the containing swf gets larger the video stays at the same size. The swf is actually loaded from another flash movie which is where the resizing happens. Is the...
[ { "answer_id": 522837, "author": "Clinton Pierce", "author_id": 8173, "author_profile": "https://Stackoverflow.com/users/8173", "pm_score": 1, "selected": false, "text": "<p>Its straightforward, but I don't know if there's a specific name for this relationship.</p>\n\n<p>It looks like yo...
2009/02/07
[ "https://Stackoverflow.com/questions/522816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12261/" ]
I'm creating a VideoPlayer object in a swf and that works well. I'm sizing it using autoSize and that's working fine too. I'm trying to make it so that when the containing swf gets larger the video stays at the same size. The swf is actually loaded from another flash movie which is where the resizing happens. Is there ...
Its a has and belongs to many with a rich join table. ``` class Author has_many :publications, :through => :rates end class Publication has_many :authors, :through => :rates end class Rate #rich join table belongs_to :author belongs_to :publication end ``` And you can then simplify your finding like this: ...
522,823
<p>My intuition was</p> <pre><code>Lorem ipsum\footnote{long footnote that spans a whole bunch of lines. } </code></pre> <p>But regardless of where I put the <code>{</code> and <code>}</code> in relation to the footnote text, I get the following error:</p> <pre><code>Latex Error: ./mydoc.tex:142 Package inpute...
[ { "answer_id": 522841, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": "<p>The error you're getting indicates there's a coding setup issue. Googling the error message suggests you may be...
2009/02/07
[ "https://Stackoverflow.com/questions/522823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
My intuition was ``` Lorem ipsum\footnote{long footnote that spans a whole bunch of lines. } ``` But regardless of where I put the `{` and `}` in relation to the footnote text, I get the following error: ``` Latex Error: ./mydoc.tex:142 Package inputenc Error: Unicode char \u8:― not set up for use with LaTeX....
Footnotes are filled in the availible space just like any other paragraph: you just write ``` \footnote{ a whole lot of text that goes on and on and on and... ... and may consists of multiple sentences. But after a while ... it finally comes to a stop. } ``` That is not your problem. looking at...
522,838
<p>I have a section:</p> <pre><code>\section{Introduction} \label{sec:introduction} </code></pre> <p>I'd like a link to the section where the link text is the name of the section. I can use <code>hyperref</code>:</p> <pre><code>The \hyperrf[sec:introduction]{Introduction} introduces the paper. </code></pre> <p>But...
[ { "answer_id": 522867, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "author_profile": "https://Stackoverflow.com/users/2509", "pm_score": 0, "selected": false, "text": "<p>You could try using</p>\n\n<ul>\n<li><code>\\newsavebox</code></li>\n<li><code>\\savebox</code></l...
2009/02/07
[ "https://Stackoverflow.com/questions/522838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
I have a section: ``` \section{Introduction} \label{sec:introduction} ``` I'd like a link to the section where the link text is the name of the section. I can use `hyperref`: ``` The \hyperrf[sec:introduction]{Introduction} introduces the paper. ``` But that requires repeating the section title ("Introduction"). ...
There are a couple of packages that provide this for you. nameref is distributed as part of hyperref to do this: <http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=nameref> There is a more general package for cross-referencing basically anything, called zref: <http://tug.ctan.org/cgi-bin/ctanPackageInformat...
522,846
<p>I'm having trouble with the droppable effect in jquery 1.3.1 (UI version 1.5.3). As far as I can tell, everything works perfectly except the drop() function doesn't get called. I can tell the droppable target is accepting the element being dragged (via the thumbnail class), but the draggable item won't drop. Thanks ...
[ { "answer_id": 522900, "author": "kquinn", "author_id": 54486, "author_profile": "https://Stackoverflow.com/users/54486", "pm_score": 3, "selected": true, "text": "<p>\"jquery 1.3.1 (UI version 1.5.3)\"</p>\n\n<p>You should not be using this pair of versions. JQuery 1.3.x is not compatib...
2009/02/07
[ "https://Stackoverflow.com/questions/522846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63567/" ]
I'm having trouble with the droppable effect in jquery 1.3.1 (UI version 1.5.3). As far as I can tell, everything works perfectly except the drop() function doesn't get called. I can tell the droppable target is accepting the element being dragged (via the thumbnail class), but the draggable item won't drop. Thanks for...
"jquery 1.3.1 (UI version 1.5.3)" You should not be using this pair of versions. JQuery 1.3.x is not compatible with the UI 1.5.x series, and requires the 1.6 release candidates. The release candidate versions are quite stable if you just want the drag and drop functionality; I wouldn't be concerned at all for using t...
522,864
<p>I have a page, i want it to display some content in a modal dialog (jquery UI dialog) as soon as the page is loaded.</p> <pre><code> $(document).ready(function(){ $("#example").dialog(); }); &lt;div id="example" class="flora" title="This is my title"&gt; I'm in a dialog! &lt;/div&gt; </code></pre> <p>T...
[ { "answer_id": 522941, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": false, "text": "<p>Your div tag isn't properly formatted and it needs to be closed. The following worked for me, but it needs proper C...
2009/02/07
[ "https://Stackoverflow.com/questions/522864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a page, i want it to display some content in a modal dialog (jquery UI dialog) as soon as the page is loaded. ``` $(document).ready(function(){ $("#example").dialog(); }); <div id="example" class="flora" title="This is my title"> I'm in a dialog! </div> ``` Thanks
Your div tag isn't properly formatted and it needs to be closed. The following worked for me, but it needs proper CSS files. ``` <html> <head> <script type="text/javascript" language="javascript" src="jquery/jquery.js"></script> <script type="text/javascript" language="javascript" src="jquery/jquery.ui...
522,897
<p>So I am working on something in php where I have to get my images from a sql database where they will be encoded in base64. The speed of displaying these images is critical so I am trying to figure out if it would be faster turn the database data into an image file and then load it in the browser, or just echo the r...
[ { "answer_id": 522933, "author": "some", "author_id": 36866, "author_profile": "https://Stackoverflow.com/users/36866", "pm_score": 5, "selected": false, "text": "<ul>\n<li>Base64 encoding makes the file bigger and therefore slower to transfer.</li>\n<li>By including the image in the pag...
2009/02/07
[ "https://Stackoverflow.com/questions/522897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63203/" ]
So I am working on something in php where I have to get my images from a sql database where they will be encoded in base64. The speed of displaying these images is critical so I am trying to figure out if it would be faster turn the database data into an image file and then load it in the browser, or just echo the raw ...
Well I don't agree with anyone of you. There are cases when you've to load more and more images. Not all the pages contain 3 images at all. Actually I'm working on a site where you've to load more than 200 images. What happens when 100000 users request that 200 images on a very loaded site. The disks of the server, ret...
522,908
<p>I've got a fairly standard while mysql_fetch_array statement in php, and I'm trying to figure out which row in the result set is being printed. </p> <p>I figured this should be pretty simple, but I've put a fairly standard </p> <pre> $i=0; $count=mysql_num_rows($getResults); while($resultArray=mysql_fetch_array($g...
[ { "answer_id": 522933, "author": "some", "author_id": 36866, "author_profile": "https://Stackoverflow.com/users/36866", "pm_score": 5, "selected": false, "text": "<ul>\n<li>Base64 encoding makes the file bigger and therefore slower to transfer.</li>\n<li>By including the image in the pag...
2009/02/07
[ "https://Stackoverflow.com/questions/522908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48067/" ]
I've got a fairly standard while mysql\_fetch\_array statement in php, and I'm trying to figure out which row in the result set is being printed. I figured this should be pretty simple, but I've put a fairly standard ``` $i=0; $count=mysql_num_rows($getResults); while($resultArray=mysql_fetch_array($getResults)){ ...
Well I don't agree with anyone of you. There are cases when you've to load more and more images. Not all the pages contain 3 images at all. Actually I'm working on a site where you've to load more than 200 images. What happens when 100000 users request that 200 images on a very loaded site. The disks of the server, ret...
522,919
<p>Are there any understanding / maintainability issues that result from code like</p> <pre><code>inVar1 == 0 ? NULL : v.push_back(inVar1); inVar2 == 0 ? NULL : v.push_back(inVar2); </code></pre> <p>and so forth.</p> <p>The possibly confusing idea is using the ternary operator for program flow rather than variable a...
[ { "answer_id": 522924, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 3, "selected": false, "text": "<p>I think this should be avoided. You could use a 1-line if statement in its place.</p>\n\n<pre><code>if(inVar1 !=...
2009/02/07
[ "https://Stackoverflow.com/questions/522919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63572/" ]
Are there any understanding / maintainability issues that result from code like ``` inVar1 == 0 ? NULL : v.push_back(inVar1); inVar2 == 0 ? NULL : v.push_back(inVar2); ``` and so forth. The possibly confusing idea is using the ternary operator for program flow rather than variable assignment, which is the usual exp...
I think it's confusing and a lot harder to read than simply typing; ``` if (inVar != 0) v.push_back(inVar); ``` I had to scan your example several times to figure out what the result would be with any certainty. I'd even prefer a single-line if() {} statement than your example - and I hate single-line if statement...
522,928
<p>Ok, I had a simple layout problem a week or two ago. Namely sections of a page needed a header:</p> <pre class="lang-none prettyprint-override"><code>+---------------------------------------------------------+ | Title Button | +--------------------------------------------...
[ { "answer_id": 522936, "author": "Milan Babuškov", "author_id": 14690, "author_profile": "https://Stackoverflow.com/users/14690", "pm_score": 5, "selected": false, "text": "<p>Just float left and right and set to clear both and you're done. No need for tables.</p>\n\n<p><strong>Edit:</st...
2009/02/07
[ "https://Stackoverflow.com/questions/522928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18393/" ]
Ok, I had a simple layout problem a week or two ago. Namely sections of a page needed a header: ```none +---------------------------------------------------------+ | Title Button | +---------------------------------------------------------+ ``` Pretty simple stuff. Thing is...
There is nothing wrong with using the tools that are available to you to do the job quickly and correctly. In this case a table worked perfectly. I personally would have used a table for this. I think nested tables should be avoided, things can get messy.
522,960
<p>I am writing a program that needs to search a LARGE text document for a large collection of words. The words are all file names, with underscores in them (eg, this_file_name). I know how to open and iterate through a text document, but I'm curious whether I should use Regex to search for these names, and if so, wh...
[ { "answer_id": 522980, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 3, "selected": true, "text": "<p>It would be helpful to see a sample of the source text. but maybe this helps</p>\n\n<pre><code>var doc = @\"asdfsdafjk...
2009/02/07
[ "https://Stackoverflow.com/questions/522960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am writing a program that needs to search a LARGE text document for a large collection of words. The words are all file names, with underscores in them (eg, this\_file\_name). I know how to open and iterate through a text document, but I'm curious whether I should use Regex to search for these names, and if so, what ...
It would be helpful to see a sample of the source text. but maybe this helps ``` var doc = @"asdfsdafjkj;lkjsadf asddf jsadf asdfj;lksdajf sdafjkl;sjdfaas sadfj;lksadf sadf jsdaf jf sda sdaf asdf sad jasfd sdf sadf sadf sdajlk;asdf this_file_name asdfsadf asdf asdf asdf asdf sadf asdfj asdf sdaf sadfsadf sadf asdf t...
522,974
<p>I want to shift away from Excel to Awk. I need basic mathematical operations, such as addition and division, for arrays. </p> <p>For example, arrays A and B are [1, 3, 2] and [2, 1, 2], respectively. How can I get an array [2, 3, 4] from the multiplication between A and B? What about the addition and division betwe...
[ { "answer_id": 522992, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 3, "selected": true, "text": "<p>I think awk is not done for this sort of numeric work. It's more for text processing. Arrays in awk are a...
2009/02/07
[ "https://Stackoverflow.com/questions/522974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54964/" ]
I want to shift away from Excel to Awk. I need basic mathematical operations, such as addition and division, for arrays. For example, arrays A and B are [1, 3, 2] and [2, 1, 2], respectively. How can I get an array [2, 3, 4] from the multiplication between A and B? What about the addition and division between A and B...
I think awk is not done for this sort of numeric work. It's more for text processing. Arrays in awk are associative and sparsely occupied (may have "holes" between its indexes). You use strings to index them: ``` for(int j=0; j<length(A) && j<length(B); j++) C[j] = A[j] * B[j] ``` It's like a hash-map. So, in aw...
523,015
<p>I have the following table on a MySQL 5.1.30:</p> <pre><code>CREATE TABLE article ( article_id int(10) unsigned NOT NULL AUTO_INCREMENT, category_id int(10) unsigned NOT NULL, title varchar(100) NOT NULL, PRIMARY KEY (article_id) ); </code></pre> <p>With this information:</p> <pre><code>1, 1, 'foo' 2, 1,...
[ { "answer_id": 523028, "author": "kquinn", "author_id": 54486, "author_profile": "https://Stackoverflow.com/users/54486", "pm_score": 0, "selected": false, "text": "<p>You probably should add another table containing the <code>category_id</code> and a description of the categories. Then ...
2009/02/07
[ "https://Stackoverflow.com/questions/523015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following table on a MySQL 5.1.30: ``` CREATE TABLE article ( article_id int(10) unsigned NOT NULL AUTO_INCREMENT, category_id int(10) unsigned NOT NULL, title varchar(100) NOT NULL, PRIMARY KEY (article_id) ); ``` With this information: ``` 1, 1, 'foo' 2, 1, 'bar' 3, 1, 'baz' 4, 1, 'quox' 5, 2,...
SELECT ... LIMIT isn't supported in subqueries, I'm afraid, so it's time to break out the self-join magic: ``` SELECT article.* FROM article JOIN ( SELECT a0.category_id AS id, MIN(a2.article_id) AS lim FROM article AS a0 LEFT JOIN article AS a1 ON a1.category_id=a0.category_id AND a1.article_id>a0.article...
523,034
<p>How can I find out the type of file system being used in Windows? Preferably in code.</p>
[ { "answer_id": 523048, "author": "Brock Woolf", "author_id": 40002, "author_profile": "https://Stackoverflow.com/users/40002", "pm_score": 1, "selected": false, "text": "<p>Right click on the drive in Explorer, choose Properties. The filesystem should be displayed there.</p>\n" }, { ...
2009/02/07
[ "https://Stackoverflow.com/questions/523034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I find out the type of file system being used in Windows? Preferably in code.
``` function string get_FileSystem( strPath ) object objFSO, objDrive; begin set objFSO = CreateObject ( "Scripting.FileSystemObject" ); if ( IsObject (objFSO) ) then try set objDrive = objFSO.GetDrive( objFSO.GetDriveName( strPath ) ); if ( IsObject( objDrive ) ) then //Available return t...
523,038
<p>If in the browser I have parameters like:</p> <pre><code>http://localhost/specials.php?year=2009&amp;make=honda&amp;model=civic </code></pre> <p>and the dropdown looks something like this:</p> <pre><code>&lt;select name="year"&gt; &lt;?php $query = mysql_query("select distinct year from tbl_content where year = '...
[ { "answer_id": 523063, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 2, "selected": false, "text": "<p>Maybe try <code>\"selected='selected'\"</code> to make it valid xml.</p>\n" }, { "answer_id": 523078, "aut...
2009/02/07
[ "https://Stackoverflow.com/questions/523038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27751/" ]
If in the browser I have parameters like: ``` http://localhost/specials.php?year=2009&make=honda&model=civic ``` and the dropdown looks something like this: ``` <select name="year"> <?php $query = mysql_query("select distinct year from tbl_content where year = '$year'"); while($row = mysql_fetch_assoc($query)) { e...
Maybe try `"selected='selected'"` to make it valid xml.
523,051
<p>I'm trying to add URL routing to a web application running in Tomcat 5.5.</p> <p>I want to make the dynamic page URLs more friendly, changing <code>main.jsp?type=test&amp;group=info</code> to <code>main/test/info</code> as is all the rage.</p> <p>I have set up the following in the web.xml</p> <pre><code> &lt;ser...
[ { "answer_id": 523103, "author": "paulmurray", "author_id": 63189, "author_profile": "https://Stackoverflow.com/users/63189", "pm_score": 3, "selected": true, "text": "<p>I have a system like this at work.</p>\n\n<p>We use a package called <a href=\"http://tuckey.org/urlrewrite/\" rel=\"...
2009/02/07
[ "https://Stackoverflow.com/questions/523051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23271/" ]
I'm trying to add URL routing to a web application running in Tomcat 5.5. I want to make the dynamic page URLs more friendly, changing `main.jsp?type=test&group=info` to `main/test/info` as is all the rage. I have set up the following in the web.xml ``` <servlet> <servlet-name>main</servlet-name> <jsp-file...
I have a system like this at work. We use a package called [urlrewrite](http://tuckey.org/urlrewrite/), which basically is the apache tomcat rewriter done up as a j2ee filter. It's cool, but I ran into this same problem. To fix it, I wrote another filter which is inserted into the filter chain *before* the rewriter. ...
523,084
<p>I've been trying to get this code to work for hours! All I need to do is open a file to see if it is real and readable. I'm new to C so I'm sure there is something stupid I'm missing. Here is the code (shorthand, but copied):</p> <pre><code>#include &lt;stdio.h&gt; main() { char fpath[200]; char file = ...
[ { "answer_id": 523086, "author": "Joe", "author_id": 57135, "author_profile": "https://Stackoverflow.com/users/57135", "pm_score": 0, "selected": false, "text": "<p>char file = \"/test/file.this\";</p>\n\n<p>You probably want</p>\n\n<p>char *file = \"/test/file.this\";</p>\n" }, { ...
2009/02/07
[ "https://Stackoverflow.com/questions/523084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62248/" ]
I've been trying to get this code to work for hours! All I need to do is open a file to see if it is real and readable. I'm new to C so I'm sure there is something stupid I'm missing. Here is the code (shorthand, but copied): ``` #include <stdio.h> main() { char fpath[200]; char file = "/test/file.this"; ...
1. The "~" is expanded by the shell, and is not expanded by fopen. 2. To test the existence and readability of a file, consider using the POSIX.1 "access" function: ``` #include <unistd.h> if (access ("/path/to/file", F_OK | R_OK) == 0) { // file exists and is readable } ```
523,087
<p>I'll try to explain this better on another question. This is the query that I think should work but, off course, MySQL doesn't support this specific subselect query:</p> <pre><code>select * from articles a where a.article_id in (select f.article_id from articles f where f.category_id = a.c...
[ { "answer_id": 523111, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>I've found a (horrible, horrible) workaround that I probably shouldn't even post but... </p>\n\n<pre><code>select *\n from...
2009/02/07
[ "https://Stackoverflow.com/questions/523087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'll try to explain this better on another question. This is the query that I think should work but, off course, MySQL doesn't support this specific subselect query: ``` select * from articles a where a.article_id in (select f.article_id from articles f where f.category_id = a.category_id ...
This is a simplification of your solution ``` select * from articles a where a.article_id = (select f.article_id from articles f where f.category_id = a.category_id order by f.is_sticky, f.published_at limit 1) or a.article_id = (select f.article_id from arti...
523,091
<p>Today, for the first time in 10 years of development with sql server I used a cross join in a production query. I needed to pad a result set to a report and found that a cross join between two tables with a creative where clause was a good solution. I was wondering what use has anyone found in production code for th...
[ { "answer_id": 523099, "author": "Brettski", "author_id": 5836, "author_profile": "https://Stackoverflow.com/users/5836", "pm_score": -1, "selected": false, "text": "<p>I personally try to avoid cartesian product's in my queries. I suppose have a result set of every combination of your ...
2009/02/07
[ "https://Stackoverflow.com/questions/523091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1433/" ]
Today, for the first time in 10 years of development with sql server I used a cross join in a production query. I needed to pad a result set to a report and found that a cross join between two tables with a creative where clause was a good solution. I was wondering what use has anyone found in production code for the c...
One use I've come across a lot is splitting records out into several records, mainly for reporting purposes. Imagine a string where each character represents some event during the corresponding hour. ``` ID | Hourly Event Data 1 | -----X-------X-------X-- 2 | ---X-----X------X------- 3 | -----X---X--X----------- ...
523,113
<p>I have this piece of code I'm trying to get to display but no matter how I do it I just don't get any response or error whatsoever.</p> <pre><code>&lt;?php $day = array("Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"); //$month[]= array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Ag...
[ { "answer_id": 523118, "author": "The.Anti.9", "author_id": 2128, "author_profile": "https://Stackoverflow.com/users/2128", "pm_score": 2, "selected": false, "text": "<p>Well i don't see a mistake, but you could just do</p>\n\n<pre><code>echo $day[date('N')-1];\n</code></pre>\n\n<p>you n...
2009/02/07
[ "https://Stackoverflow.com/questions/523113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28586/" ]
I have this piece of code I'm trying to get to display but no matter how I do it I just don't get any response or error whatsoever. ``` <?php $day = array("Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"); //$month[]= array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre...
To avoid using global variables (which is [often-times a bad idea](http://en.wikipedia.org/wiki/Global_variable)). You can just pass the variable in to the function. Thus change the function declaration to ``` function today($day) ``` and the last function call to ``` today($day); ``` Note that the two $day's a...
523,145
<p>The typical way of selecting data is:</p> <pre><code>select * from my_table </code></pre> <p>But what if the table contains 10 million records and you only want records 300,010 to 300,020</p> <p>Is there a way to create a SQL statement on Microsoft SQL that only gets 10 records at once?</p> <p>E.g. </p> <pre><c...
[ { "answer_id": 523152, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "<p><code>SELECT * FROM my_table</code> is just the tip of the iceberg. Assuming you're talking a table with an identi...
2009/02/07
[ "https://Stackoverflow.com/questions/523145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24696/" ]
The typical way of selecting data is: ``` select * from my_table ``` But what if the table contains 10 million records and you only want records 300,010 to 300,020 Is there a way to create a SQL statement on Microsoft SQL that only gets 10 records at once? E.g. ``` select * from my_table from records 300,010 to ...
Try looking at info about pagination. Here's a short summary of it for [SQL Server](http://www.singingeels.com/Articles/Pagination_In_SQL_Server_2005.aspx).
523,153
<p>Given a list of objects, I am needing to transform it into a dataset where each item in the list is represented by a row and each property is a column in the row. This DataSet will then be passed to an <a href="http://www.aspose.com/categories/file-format-components/aspose.cells-for-.net-and-java/default.aspx" rel="...
[ { "answer_id": 523160, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 1, "selected": false, "text": "<p>Apart from additionally using <code>Reflection</code> to determine the properties of class <code>Record</code> to t...
2009/02/07
[ "https://Stackoverflow.com/questions/523153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39532/" ]
Given a list of objects, I am needing to transform it into a dataset where each item in the list is represented by a row and each property is a column in the row. This DataSet will then be passed to an [Aspose.Cells](http://www.aspose.com/categories/file-format-components/aspose.cells-for-.net-and-java/default.aspx) fu...
You can do it through reflection and generics, inspecting the properties of the underlying type. Consider this extension method that I use: ``` public static DataTable ToDataTable<T>(this IEnumerable<T> collection) { DataTable dt = new DataTable("DataTable"); Type t = typeof(T); Proper...
523,164
<p>This is one of those things, that maybe so simple I'll never find it because everyone else already knows it.</p> <p>I've got objects I have to check for nil in my views so I don't dereference a nil:</p> <pre><code>&lt;%= if tax_payment.user; tax_payment.user.name; end %&gt; </code></pre> <p>Or I could do this var...
[ { "answer_id": 523173, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 7, "selected": true, "text": "<p>What about:</p>\n\n<pre><code>&lt;%= tax_payment.user.name if tax_payment.user %&gt;\n</code></pre>\n" }, { ...
2009/02/07
[ "https://Stackoverflow.com/questions/523164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62657/" ]
This is one of those things, that maybe so simple I'll never find it because everyone else already knows it. I've got objects I have to check for nil in my views so I don't dereference a nil: ``` <%= if tax_payment.user; tax_payment.user.name; end %> ``` Or I could do this variant: ``` <%= tax_payment.user ? tax_p...
What about: ``` <%= tax_payment.user.name if tax_payment.user %> ```