qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
388,816
<p>I have installed PEAR, <code>Spreadsheet_Excel_Writer</code> and OLE. The sample program is executed successfully but when I try to read the file it shows garbage values. I also tried <code>$workbook-&gt;setVersion(8);</code> and <code>$worksheet-&gt;setInputEncoding('UTF-8');</code></p> <p>I am using this tutorial and Google lot for this problem.<br> <a href="http://www.sitepoint.com/article/getting-started-with-pear/3/" rel="nofollow noreferrer">http://www.sitepoint.com/article/getting-started-with-pear/3/</a></p> <p>Thanks in advance.</p>
[ { "answer_id": 389418, "author": "Jack", "author_id": 24998, "author_profile": "https://Stackoverflow.com/users/24998", "pm_score": 2, "selected": false, "text": "$header = \"Last Name\\tFirst Name\\tAge\\tJob\\n\"; // new line is start of new row, tab is next column\n\n//ideally you wou...
2008/12/23
[ "https://Stackoverflow.com/questions/388816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
388,819
<p>I have a few modules of block of code in VBA to run on few Access databases. I would like to know how I should proceed if I want to convert the coding to C# environment. And is it possible to implement and obtain the same results as I am getting now with Access and VBA? I am completely new to C# at this point.</p>
[ { "answer_id": 389147, "author": "Eric Ness", "author_id": 18891, "author_profile": "https://Stackoverflow.com/users/18891", "pm_score": 2, "selected": false, "text": "Selection.TypeText(\"foo\")\n using Microsoft.Office.Interop.Word;\n\nApplication word = new Application();\nword.Select...
2008/12/23
[ "https://Stackoverflow.com/questions/388819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31132/" ]
388,837
<p>Let's say you are a GM dba and you have to design around the GM models</p> <p>Is it better to do this?</p> <ul> <li>table_model <ul> <li>type {cadillac, saturn, chevrolet}</li> </ul></li> </ul> <p>Or this?</p> <ul> <li>table_cadillac_model</li> <li>table_saturn_model </li> <li>table_chevrolet_model</li> </ul> <p>Let's say that the business lines have the same columns for a model and that there are over a million records for each subtype.</p> <p>EDIT:</p> <ul> <li>there is a lot of CRUD</li> <li>there are a lot of very processor intensive reports</li> <li>in either schema, there is a model_detail table that contains 3-5 records for each model and the details for each model differ (you can't add a cadillac detail to a saturn model)</li> <li>the dev team doesn't have any issues with db complexity</li> <li>i'm not really sure that this is a normalization question. even though the structures are the same they might be thought of as different entities.</li> </ul> <p>EDIT:</p> <p>Reasons for partitioning the structure into multiple tables - business lines may have different business rules regarding parts - addModelDetail() could be different for each business line (even though the data format is the same) - high add/update activity - better performance with partitioned structure instead of single structure (I'm guessing and not sure here)?</p> <p>I think this is a variation of the EAV problem. When posed as a EAV design, the single table structure generally gets voted as a bad idea. When posed in this manner, the single table strucutre generally gets voted as a good idea. Interesting... </p> <p>I think the most interesting answer is having two different structures - one for crud and one for reporting. I think I'll try concatenated/flattened view for reporting and multiple tables for crud and see how that works.</p>
[ { "answer_id": 390541, "author": "Quibblesome", "author_id": 1143, "author_profile": "https://Stackoverflow.com/users/1143", "pm_score": 0, "selected": false, "text": "table_model\n* type {cadillac, saturn, chevrolet}\n" }, { "answer_id": 390959, "author": "Robert C. Barth", ...
2008/12/23
[ "https://Stackoverflow.com/questions/388837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36902/" ]
388,843
<p>The building (a museum) has 7 levels (+3 to -3), each divided into different rooms/areas. Hovering over an area will reveal a popup describing that area.</p> <p>I'm looking for some markup that will accurately represent the 7 levels and their areas. The plan should make sense and be 'navigable' without any CSS/JS. </p> <p>Edit: Some clarification, the markup only has to represent the 'semantic structure' of the building, not the spatial layout (CSS will add in the layout and graphics).</p>
[ { "answer_id": 388852, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 1, "selected": false, "text": "<ul>" }, { "answer_id": 12139550, "author": "unor", "author_id": 1591669, "author_profile": "https://S...
2008/12/23
[ "https://Stackoverflow.com/questions/388843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
388,859
<p>I have a 'loader app' that loads a menu and when user clicks the menu image button a list view opens based on the text </p> <pre><code>(if text = employee) (Go to class A) (Go to class B) ... ... (Show List View Window) </code></pre> <p>if he clicks again on the same button it opens again, I would like to prevent this. i.e but this for a WPF application</p>
[ { "answer_id": 388872, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "Application.OpenForms .Assembly Assembly currentAssembly = Assembly.GetExecutingAssembly();\n List<For...
2008/12/23
[ "https://Stackoverflow.com/questions/388859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39278/" ]
388,868
<p>Im currently using the following function to load an image, however i could not figure out a way to find the width of the loaded image, which i intend to use before placing the next image using the same function. </p> <p>Note that q is a a variable (a number) which is used to load differant images.</p> <p>=X i need help obtainning the loaded image width...</p> <pre><code>function LoadImage(q) { var imageLoader:Loader = new Loader(); var image:URLRequest = new URLRequest("GalleryImages/Album1/"+q+".jpg"); imageLoader.load(image); addChild (imageLoader); imageLoader.x = 0 + CurrentXLength; imageLoader.y = 0; imageLoader.name = "image"+q; trace(imageLoader.x) } </code></pre>
[ { "answer_id": 389256, "author": "Brian Hodge", "author_id": 20628, "author_profile": "https://Stackoverflow.com/users/20628", "pm_score": 1, "selected": false, "text": "package\n{\n import flash.display.Sprite;\n import flash.display.Loader;\n import flash.net.URLRequest;\n\n ...
2008/12/23
[ "https://Stackoverflow.com/questions/388868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
388,878
<p>EDIT: minor fixes (virtual Print; return mpInstance) following remarks in the answers.</p> <p>I am trying to create a system in which I can derive a Child class from any Base class, and its implementation should replace the implementation of the base class.</p> <p>All the objects that create and use the base class objects shouldn't change the way they create or call an object, i.e. should continue calling BaseClass.Create() even when they actually create a Child class. The Base classes know that they can be overridden, but they do not know the concrete classes that override them.</p> <p>And I want the registration of all the the Child classes to be done just in one place. </p> <p>Here is my implementation:</p> <pre><code>class CAbstractFactory { public: virtual ~CAbstractFactory()=0; }; template&lt;typename Class&gt; class CRegisteredClassFactory: public CAbstractFactory { public: ~CRegisteredClassFactory(){}; Class* CreateAndGet() { pClass = new Class; return pClass; } private: Class* pClass; }; // holds info about all the classes that were registered to be overridden class CRegisteredClasses { public: bool find(const string &amp; sClassName); CAbstractFactory* GetFactory(const string &amp; sClassName) { return mRegisteredClasses[sClassName]; } void RegisterClass(const string &amp; sClassName, CAbstractFactory* pConcreteFactory); private: map&lt;string, CAbstractFactory* &gt; mRegisteredClasses; }; // Here I hold the data about all the registered classes. I hold statically one object of this class. // in this example I register a class CChildClass, which will override the implementation of CBaseClass, // and a class CFooChildClass which will override CFooBaseClass class RegistrationData { public: void RegisterAll() { mRegisteredClasses.RegisterClass("CBaseClass", &amp; mChildClassFactory); mRegisteredClasses.RegisterClass("CFooBaseClass", &amp; mFooChildClassFactory); }; CRegisteredClasses* GetRegisteredClasses(){return &amp;mRegisteredClasses;}; private: CRegisteredClasses mRegisteredClasses; CRegisteredClassFactory&lt;CChildClass&gt; mChildClassFactory; CRegisteredClassFactory&lt;CFooChildClass&gt; mFooChildClassFactory; }; static RegistrationData StaticRegistrationData; // and here are the base class and the child class // in the implementation of CBaseClass::Create I check, whether it should be overridden by another class. class CBaseClass { public: static CBaseClass* Create() { CRegisteredClasses* pRegisteredClasses = StaticRegistrationData.GetRegisteredClasses(); if (pRegisteredClasses-&gt;find("CBaseClass")) { CRegisteredClassFactory&lt;CBaseClass&gt;* pFac = dynamic_cast&lt;CRegisteredClassFactory&lt;CBaseClass&gt;* &gt;(pRegisteredClasses-&gt;GetFactory("CBaseClass")); mpInstance = pFac-&gt;CreateAndGet(); } else { mpInstance = new CBaseClass; } return mpInstance; } virtual void Print(){cout &lt;&lt; "Base" &lt;&lt; endl;}; private: static CBaseClass* mpInstance; }; class CChildClass : public CBaseClass { public: void Print(){cout &lt;&lt; "Child" &lt;&lt; endl;}; private: }; </code></pre> <p>Using this implementation, when I am doing this from some other class:</p> <pre><code>StaticRegistrationData.RegisterAll(); CBaseClass* b = CBaseClass::Create(); b.Print(); </code></pre> <p>I expect to get "Child" in the output.</p> <p>What do you think of this design? Did I complicate things too much and it can be done easier? And is it OK that I create a template that inherits from an abstract class? </p> <p>I had to use dynamic_pointer (didn't compile otherwise) - is it a hint that something is wrong?</p> <p>Thank you.</p>
[ { "answer_id": 388888, "author": "Nathan Fellman", "author_id": 1084, "author_profile": "https://Stackoverflow.com/users/1084", "pm_score": 0, "selected": false, "text": "b CBaseClass::Print" }, { "answer_id": 388963, "author": "duffymo", "author_id": 37213, "author_p...
2008/12/23
[ "https://Stackoverflow.com/questions/388878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44673/" ]
388,897
<p>How can I send a picture in Java ME ? Maybe using <code>base64 decode</code> and the send in post form via <code>http</code> request</p>
[ { "answer_id": 389378, "author": "Dmitry Khalatov", "author_id": 18174, "author_profile": "https://Stackoverflow.com/users/18174", "pm_score": -1, "selected": false, "text": "HttpConnection connection = (HttpConnection) Connector.open(\"http://www.myserver.com\");\nconnection.setRequestM...
2008/12/23
[ "https://Stackoverflow.com/questions/388897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48647/" ]
388,908
<p>I am trying to measure the throughput of a webservice.</p> <p>In order to do that, I have written a small tool that continuously sends requests and reads responses from a number of threads.</p> <p>The contents of the inner loop of each thread looks like this:</p> <pre><code>public void PerformRequest() { WebRequest webRequest = WebRequest.Create(_uri); webRequest.ContentType = "application/ocsp-request"; webRequest.Method = "POST"; webRequest.Credentials = _credentials; webRequest.ContentLength = _request.Length; ((HttpWebRequest)webRequest).KeepAlive = false; using (Stream st = webRequest.GetRequestStream()) st.Write(_request, 0, _request.Length); using (HttpWebResponse httpWebResponse = (HttpWebResponse)webRequest.GetResponse()) using (Stream responseStream = httpWebResponse.GetResponseStream()) using (BufferedStream bufferedStream = new BufferedStream(responseStream)) using (BinaryReader reader = new BinaryReader(bufferedStream)) { if (httpWebResponse.StatusCode != HttpStatusCode.OK) throw new WebException("Got response status code: " + httpWebResponse.StatusCode); byte[] response = reader.ReadBytes((int)httpWebResponse.ContentLength); httpWebResponse.Close(); } } </code></pre> <p>It seems to work okay, except that something seems to be limiting the tool. If I run two instances of the tool with each 40 threads, I get significantly more throughput than one instance with 80 threads.</p> <p>I found the ServicePointManager.DefaultConnectionLimit property, which I set to 10000 (and it makes no difference if I set it through app.config <a href="https://stackoverflow.com/a/436477/5542">as suggested by Jader Dias</a>).</p> <p>Are there any other settings in .NET or on my machine that can influence the performance? (I am running Vista, but I see the same problem on Windows Server 2003).</p> <p>Perhaps some restrictions on how many connections a single process can make?</p>
[ { "answer_id": 436477, "author": "Jader Dias", "author_id": 48465, "author_profile": "https://Stackoverflow.com/users/48465", "pm_score": 5, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n <system.net>\n <connectionManagement>\n <add ad...
2008/12/23
[ "https://Stackoverflow.com/questions/388908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5542/" ]
388,928
<p>I've written a script to backup my server's HD every night. At the end of the script, I sync, wait a couple of minutes, sync and then I issue <code>sg_start --stop</code> to stop the device. The idea is to extend the lifetime of the device by switching the HD off after ten minutes of incremental backup (desktop disks will survive several thousand on/off cycles but only a few hundred hours of continuous running).</p> <p>This doesn't always work; I often find the drive still spinning the next morning. Is there a shell command which I can use to check that the drive has stopped (so I can issue the stop command again [EDIT2]or write a script to create a process list when the drive is running so I can debug this[/EDIT2])?</p> <p>[EDIT] I've tried <a href="http://linux.die.net/man/8/sg_inq" rel="nofollow noreferrer">sg_inq</a> (as suggested by the sg_start man page) but this command always returns 0.</p> <p>I've tried <a href="http://sourceforge.net/projects/hdparm/" rel="nofollow noreferrer">hdparm</a> but it always returns "drive state is: unknown" for USB drives (attached via /dev/sdX) and when trying to spin down the drive, I get "HDIO_DRIVE_CMD(setidle1) failed: Input/output error".</p> <p><a href="http://sg.danny.cz/sg/sdparm.html" rel="nofollow noreferrer">sdparm</a> seems to support to set the idle timer on the drive (see "Power mode condition page") but the IDLE option has "Changeable: n" and I haven't found an option which tells me the drive power state.</p> <p>[EDIT2] Note: I can stop the drive with <code>sg_start --stop</code> from the console. That always works; it just doesn't always stay down until midnight. The sever is in the basement (where it's nice and cool) and I'd rather have a way to check whether the drive is up or not from the warm living room :) If I had a command which told me the status of the drive, I could write a script to alert me when it spins up (check every minute) and then I could try to figure out what might be causing this.</p> <p>If that matters: I'm using openSUSE 11.1.</p>
[ { "answer_id": 390275, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 2, "selected": false, "text": " hdparm -S 120 /dev/sda \n Nothing accesses the drive but the backup script.\n updatedb fam gamin lsof +D /mount...
2008/12/23
[ "https://Stackoverflow.com/questions/388928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34088/" ]
388,930
<p>I write or modify programs which perform name resolution and need a good control of the process. So I do not use <code>getaddrinfo()</code>, I go deeper and use <code>res_query()</code> / <code>res_send()</code> / etc in <code>resolv.h</code>, documented in resolver(3). </p> <p>Although not documented, the common way to set the resolver used is to update <code>_res.nsaddr_list</code>. But this array, defined in resolv.h, stores <code>struct sockaddr_in</code>, that is IPv4 addresses only. (IPv6 addresses are <code>struct sockaddr_in6</code>, a family-independant system would use <code>struct sockaddr</code>.)</p> <p>I'm looking for a way (preferrably portable, at least among the various Unix) to tell <code>_res</code> that I want also IPv6 addresses.</p> <p>Apparently, a long time ago, there was in FreeBSD a <code>_res_ext</code> with this ability but I cannot find it anymore in a recent FreeBSD 7 (<code>grep _res_ext /usr/include/resolv.h</code> finds nothing). You can still find <a href="http://www.squid-cache.org/~hno/changesets/squid3/patches/5775.patch" rel="nofollow noreferrer">code which uses it</a> (try yourself <a href="http://www.google.com/codesearch?hl=en&amp;lr=&amp;q=&quot;_res_ext&quot;+&quot;nsaddr_list&quot;&amp;sbtn=Search" rel="nofollow noreferrer">with Google Codesearch</a>).</p> <p>Thanks to Alnitak, I noticed it is apparently now <code>_res._ext</code> and not <code>.res_ext</code>. I wonder where these sort of things are documented or announced... I have no idea how portable <code>_res._ext</code> is. I can find it on Debian and FreeBSD. It seems there are few programs which use it.</p>
[ { "answer_id": 388994, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 2, "selected": false, "text": "resolv.h sockaddr_in6 res_setservers() _res._ext _res._ext resolv.conf gethostbyname() FREEBSD_7_0_0_RELEASE res_setservers(...
2008/12/23
[ "https://Stackoverflow.com/questions/388930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15625/" ]
388,934
<p>I want to align my member variables based on a class template type but I'm not sure if it is actually possible.</p> <p>The following is a (very) simple example of what I'd like to do</p> <pre><code>template&lt;int Align&gt; class MyClass { private: struct MyStruct { // Some stuff } __declspec(align(Align)); __declspec(align(Align)) int myAlignedVariable; }; </code></pre> <p>So what I'd like is for Align to be a per-instance variable, and only through that is the align value of the class contents decided.</p> <p>Unfortunately I always get the following error</p> <pre><code>error C2975: 'test::MyClass' : invalid template argument for 'Align', expected compile-time constant expression </code></pre> <p>So, is this actually possible or can the alignment only be possible using a fixed compile time constant? If not, can anyone think of a way around this?</p> <p>Thanks :)</p>
[ { "answer_id": 389053, "author": "pmdj", "author_id": 48660, "author_profile": "https://Stackoverflow.com/users/48660", "pm_score": 4, "selected": true, "text": "template<int A> struct aligned;\ntemplate<> struct aligned<1> { } __declspec(align(1));\ntemplate<> struct aligned<2> { } __de...
2008/12/23
[ "https://Stackoverflow.com/questions/388934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48651/" ]
388,937
<p>I'd like to know if there's a better approach to this problem. I want to resize a label (vertically) to accomodate certain amount of text. My label has a fixed width (about 60 chars wide before it must wrap), about 495 pixels. The font is also a fixed size (12points afaik), but the text is not. </p> <p>What I want to do is increase the Label Height when there's a "NewLine" or the text must wrap; the idea is that the text is fully visible in the label. The AutoSize doesn't work because it will grow in width, not in height. </p> <p>Of course I could count the number of NewLines and add: Newlines * LineHeight, and then -given that I manage to put 60 chars per line, just divide the number of chars and add as many LineHeight pixels as needed.</p> <p>I was wondering if there was a more professional way to do it. Is my approach too "lame" ?</p> <p>Thanks in advance.</p>
[ { "answer_id": 388964, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 8, "selected": true, "text": "Graphics.MeasureString SizeF Height using(Graphics g = CreateGraphics()) {\n SizeF size = g.Measure...
2008/12/23
[ "https://Stackoverflow.com/questions/388937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2684/" ]
388,941
<p>I have a bunch of pretty large CSV (comma separated values) files and I want to analyze them. SQL queries are ideal for this. So far I have been using MS Access to import the CSV files and execute queries on them. However, in addition to having a very bad SQL editor and having stupid arbitrary rules about when a query/table can be opened/edited/deleted, it is extremely slow. I can live with initial slowness when executing a query, but I really hate that it seems to re-execute it whenever I try to sort the table on another column, wait 5 minutes, or try to scroll.</p> <p>Are there any better (free) tools for the job? (I would be willing to manually write a script to transform the CSV into something else if required)</p> <p>Thanks!</p> <p>Edit: Thanks for all the answers! I'm going to try out SQL Server and if it works out, I'll accept that answer. Just a clarification: importing the data file is not necessarily a problem for me (although easy ways to do this are of course welcome). What I need is some program that subsequently allows me to quickly and efficiently execute (reasonably complex) queries on it. FileHelpers isn't going to help me, because first of all I don't know any .NET languages and second of all, I had the data in Java, but I thought analyzing it would be a lot easier with SQL. Thanks for the answer though!</p>
[ { "answer_id": 388952, "author": "cleg", "author_id": 29503, "author_profile": "https://Stackoverflow.com/users/29503", "pm_score": 3, "selected": false, "text": "LOAD DATA LOCAL INFILE 'file.csv' \nINTO TABLE some_table \nFIELDS TERMINATED BY ',' \nLINES TERMINATED BY '\\n' \n(field1, f...
2008/12/23
[ "https://Stackoverflow.com/questions/388941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48648/" ]
388,944
<p>I have NUnit installed on my machine in "C:\Program Files\NUnit 2.4.8\" but on my integration server(running CruiseControl.Net) I have it installed in "D:\Program Files\NUnit 2.4.8\". The problem is that on my development machine my NAnt build file works correctly because in the task I'm using the path "C:\Program Files\NUnit 2.4.8\bin\NUnit.Framework.dll" to add reference to the 'NUnit.Framework.dll' assembly but this same build file cannot build the file on my integration server(because the reference path is different). Do I have to have my NUnit installed at the same location as it is in my integration server? This solution seems too restrictive to me. Are there any better ones? What is the general solution to this kind of problem?</p>
[ { "answer_id": 388948, "author": "James Gregory", "author_id": 27206, "author_profile": "https://Stackoverflow.com/users/27206", "pm_score": 3, "selected": true, "text": "/MyApp\n /libs\n /NUnit\n /NAnt\n /etc...\n /src\n /etc...\n" }, { "answer_id": 389167, "au...
2008/12/23
[ "https://Stackoverflow.com/questions/388944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25125/" ]
388,946
<p>I'd like to learn how FireFox works behind the scenes. I'd like to understand the source code and the different components but the code-base is rather large and I'm not sure where to start. </p> <p>I'm wondering if there is some sort of walk though written up by anybody either from the firefox team or from outside the community. </p> <p>I've looked a little bit at: <a href="https://developer.mozilla.org/En" rel="noreferrer">https://developer.mozilla.org/En</a> but I don't see anything that screams "Start here". I'm simply trying to review their code base for [self-]educational reasons.</p>
[ { "answer_id": 389409, "author": "Jason S", "author_id": 44330, "author_profile": "https://Stackoverflow.com/users/44330", "pm_score": 5, "selected": false, "text": "onclick=\"blah()\" addEventListener()" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/388946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18196/" ]
388,955
<p>I've got about 3 million files I need to copy from one folder to another over my company's SAN. What's the best way for me to do this? </p>
[ { "answer_id": 388962, "author": "ConcernedOfTunbridgeWells", "author_id": 15401, "author_profile": "https://Stackoverflow.com/users/15401", "pm_score": 3, "selected": false, "text": "tar cf - * | (cd [destination dir] ; tar xf - )\n" }, { "answer_id": 388972, "author": "Oliv...
2008/12/23
[ "https://Stackoverflow.com/questions/388955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31830/" ]
388,985
<p>A simple stupid "<code>UPDATE table SET something=another WHERE (always true)</code>" in accident will easily destroy everything in the database. It could be a human mistake, an SQL injection/overflow/truncation attack, or a bug in the code who build the WHERE causes.</p> <p>Are popular databases provide a feature that protect tables by limit maximum number of row could be updated in one SQL statement?</p> <p>I mean some kind of defensive setting that apply to pre-table access right on database: no-way to bypass, less code to program, no human mistake(unless grant yourself too much access right).</p>
[ { "answer_id": 389360, "author": "Eric Sabine", "author_id": 1493157, "author_profile": "https://Stackoverflow.com/users/1493157", "pm_score": 1, "selected": false, "text": "CREATE TRIGGER dbo.trg_myTrigger_UD ON dbo.myTable FOR UPDATE, DELETE\nAS\nIF @@ROWCOUNT <> 1 RETURN\n" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/388985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40214/" ]
388,996
<p>I need to find a reg ex that only allows alphanumeric. So far, everyone I try only works if the string is alphanumeric, meaning contains both a letter and a number. I just want one what would allow either and not require both.</p>
[ { "answer_id": 389012, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 4, "selected": false, "text": "^\\s*([0-9a-zA-Z]*)\\s*$\n ^\\s*([0-9a-zA-Z]+)\\s*$\n" }, { "answer_id": 389022, "author": "Greg", "author_...
2008/12/23
[ "https://Stackoverflow.com/questions/388996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48655/" ]
389,021
<p>I have an ASP.NET site that I'm developing. The layout is pretty basic. The master page has a header with a horizontal menu beneath the banner taking the entire width. On the left is a Navigation pane, 150 pixels wide with a picture and a few external links. The remainder of the width is the ContentPlaceholder. Beneath that is the footer.</p> <p>In the default page, the master page's content has a few divs. One for "News", one for "FAQs", one for "deadlines" and another for a "Chart of the Day". Each of these is 450 pixels wide and I'd set them up with the appropriate "float: left;" and "float: right;" so that the left 'column' of content was the News, then FAQ under it and the right column was the deadlines and chart. If the user narrowed the browser too much, the deadlines and chart would get pushed under the News and FAQs.</p> <p>Now I'm directed to change the behavior. Now, if the user narrows the browser, the deadlines and chart should "hold their ground" and remain as a second column with the user having to use the horizontal scroll bar to see them properly.</p> <p>I thought that using "min-width: 950px;" on the overall content div would do that, but the "float: right" on the content div ends up pushing the whole content section under the navigation pane when I narrow the browser and when I narrow it further, the Deadlines and Chart divs are STILL getting pushed under the News and FAQs.</p> <p>I know I'm missing something simple - like a property to "stay to the right regardless" - and anchor or something. Googling around for examples isn't helping much because I don't think I'm putting the right words into searching.</p> <p>Thanks in advance for any advice.</p>
[ { "answer_id": 389012, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 4, "selected": false, "text": "^\\s*([0-9a-zA-Z]*)\\s*$\n ^\\s*([0-9a-zA-Z]+)\\s*$\n" }, { "answer_id": 389022, "author": "Greg", "author_...
2008/12/23
[ "https://Stackoverflow.com/questions/389021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15891/" ]
389,026
<p>One-to-one relations within nhibernate can be lazyloaded either "false" or "proxy". I was wondering if anyone knows a way to do a lazy one-to-one mapping.</p> <p>I worked out a hack to achieve the same result by using a lazy set mapped to a private field, and having the public property return the first result of that set. It works, but isn't the cleanest code...</p> <p>Thanks in advance!</p>
[ { "answer_id": 553278, "author": "Artem Tikhomirov", "author_id": 2313, "author_profile": "https://Stackoverflow.com/users/2313", "pm_score": 2, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" assembly=\"NHi...
2008/12/23
[ "https://Stackoverflow.com/questions/389026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18729/" ]
389,028
<p>Because of some non standard table creation options I am forced to use the sql dump instead of the standard schema.rb (i.e. I have uncommented this line in the environment.rb <code>config.active_record.schema_format = :sql</code>). I have noticed that when I use the sql dump that my fixtures do not seem to be loaded into the database. Some data is loaded into it but, I am not sure where it is coming from. Is this normal? and if it is normal can anybody tell me where this other data is coming from?</p>
[ { "answer_id": 389247, "author": "csexton", "author_id": 19839, "author_profile": "https://Stackoverflow.com/users/19839", "pm_score": 0, "selected": false, "text": "rake db:fixtures:load\n class CreateYourTable < ActiveRecord::Migration\n def self.up\n create_table :your_table, :opt...
2008/12/23
[ "https://Stackoverflow.com/questions/389028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004/" ]
389,066
<p>How to find a specific element, or a list of elements by using their TagName using Watin?</p>
[ { "answer_id": 410927, "author": "Lars Thorup", "author_id": 51370, "author_profile": "https://Stackoverflow.com/users/51370", "pm_score": 1, "selected": false, "text": "ie.Element(\"h1\", Find.ByIndex(0))\n" }, { "answer_id": 700599, "author": "Jeroen van Menen", "author...
2008/12/23
[ "https://Stackoverflow.com/questions/389066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32582/" ]
389,069
<p>I want to write a program in C/C++ that will dynamically read a web page and extract information from it. As an example imagine if you wanted to write an application to follow and log an ebay auction. Is there an easy way to grab the web page? A library which provides this functionality? And is there an easy way to parse the page to get the specific data?</p>
[ { "answer_id": 389074, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 6, "selected": true, "text": " #include <stdio.h>\n #include <curl/curl.h>\n\n int main(void)\n {\n CURL *curl;\n CURLcode res;\n\n curl = curl_easy_i...
2008/12/23
[ "https://Stackoverflow.com/questions/389069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23435/" ]
389,070
<p>I want to open a save file dialog, have the user enter a filename, and if they forget the .csv extension, have it tacked on.</p> <p>It would seem that the SaveFileDialog AddExtension property would work, but its doesn't. I've even set the DefaultExt property to .csv, and still nothing gets tacked on. My file gets saved just fine, but sans extension, so the user can't just double click on the file and have it open in Excel.</p> <p>I have to be missing something obvious. Here's what I've got</p> <pre><code> SaveFileDialog sfd = new SaveFileDialog(); sfd.DefaultExt = "*.csv"; sfd.Filter = "Comma Separated(*.csv)|*.*"; if (sfd.ShowDialog() == DialogResult.OK) { // Do my file saving } </code></pre>
[ { "answer_id": 389078, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "\"csv\" DefaultExt using IDisposable using (SaveFileDialog sfd = new SaveFileDialog())\n {\n ...
2008/12/23
[ "https://Stackoverflow.com/questions/389070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18927/" ]
389,082
<p>Our projects are using objects as the data source to reports.</p> <p>Our business layer is returning single objects or IEnumerable. Our reports (quite complex) need to display value-type properties of the object, and its related objects. Typical case would be, from a List, display a master report with category data, then a subreport with data for each Product inside each Category, then a subreport for each Part of each Product, and so on.</p> <p>Reporting from the database is not an option for us.</p> <p>We have tried so far - Reporting Services : works but have to mess around with the XML definition of the report to define the datasource classes, very hard to work with if you use an object datasource, architecturally not too clean - Telerik Reports : quite nice (esp., nice architecture) but seems to have problems with complex reports (master/sub), does not give great paging control, rumored to have performance/crash problems (immature product).</p> <p>Does anyone know a good reporting solution that can be integrated in an ASP.NET application and works well with objects as datasources ? </p>
[ { "answer_id": 389078, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "\"csv\" DefaultExt using IDisposable using (SaveFileDialog sfd = new SaveFileDialog())\n {\n ...
2008/12/23
[ "https://Stackoverflow.com/questions/389082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,083
<p>I'm looking at writing a tool for generating code based on the contents of a stored procedure. Like the parameters and stuff.</p> <p>I was wondering if anybody knew of an open source library that has a all the regex's and stuff to parse all this easily.</p> <p>Thanks.</p>
[ { "answer_id": 389078, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "\"csv\" DefaultExt using IDisposable using (SaveFileDialog sfd = new SaveFileDialog())\n {\n ...
2008/12/23
[ "https://Stackoverflow.com/questions/389083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45005/" ]
389,086
<p>Is it semantically correct to nest definition lists, or should they simply be a 'flat list of name/value pairs'.</p> <p><a href="http://www.w3.org/TR/html401/struct/lists.html#h-10.1" rel="noreferrer">The specs</a> don't seem to forbid it.</p> <p>Further to <a href="https://stackoverflow.com/questions/388843/">this question</a>.</p>
[ { "answer_id": 389099, "author": "Rob Kennedy", "author_id": 33732, "author_profile": "https://Stackoverflow.com/users/33732", "pm_score": 2, "selected": false, "text": "DL" }, { "answer_id": 389117, "author": "Yuliy", "author_id": 47527, "author_profile": "https://St...
2008/12/23
[ "https://Stackoverflow.com/questions/389086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
389,094
<p>There was a library of dynamic <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="noreferrer">LINQ</a> extensions methods released as a sample with <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2008" rel="noreferrer">Visual&nbsp;Studio&nbsp;2008</a>. I'd like to extend it with a join method. The code below fails with a parameter miss match exception at run time. Where is the problem?</p> <pre><code>public static IQueryable Join(this IQueryable outer, IEnumerable inner, string outerSelector, string innerSelector, string resultsSelector, params object[] values) { if (inner == null) throw new ArgumentNullException("inner"); if (outerSelector == null) throw new ArgumentNullException("outerSelector"); if (innerSelector == null) throw new ArgumentNullException("innerSelector"); if (resultsSelector == null) throw new ArgumentNullException("resultsSelctor"); LambdaExpression outerSelectorLambda = DynamicExpression.ParseLambda(outer.ElementType, null, outerSelector, values); LambdaExpression innerSelectorLambda = DynamicExpression.ParseLambda(inner.AsQueryable().ElementType, null, innerSelector, values); ParameterExpression[] parameters = new ParameterExpression[] { Expression.Parameter(outer.ElementType, "outer"), Expression.Parameter(inner.AsQueryable().ElementType, "inner") }; LambdaExpression resultsSelectorLambda = DynamicExpression.ParseLambda(parameters, null, resultsSelector, values); return outer.Provider.CreateQuery( Expression.Call( typeof(Queryable), "Join", new Type[] { outer.ElementType, inner.AsQueryable().ElementType, outerSelectorLambda.Body.Type, innerSelectorLambda.Body.Type, resultsSelectorLambda.Body.Type }, outer.Expression, inner.AsQueryable().Expression, Expression.Quote(outerSelectorLambda), Expression.Quote(innerSelectorLambda), Expression.Quote(resultsSelectorLambda)) ); } </code></pre>
[ { "answer_id": 412868, "author": "Royd Brayshay", "author_id": 35043, "author_profile": "https://Stackoverflow.com/users/35043", "pm_score": 6, "selected": true, "text": " public static IQueryable Join(this IQueryable outer, IEnumerable inner, string outerSelector, string innerSelecto...
2008/12/23
[ "https://Stackoverflow.com/questions/389094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35043/" ]
389,100
<p>Is there a built-in <code>IsLowerCase()</code> in .NET? </p>
[ { "answer_id": 389118, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 4, "selected": true, "text": "Char.IsLower(ch);" }, { "answer_id": 389127, "author": "George Stocker", "author_id": 16587, "author_profi...
2008/12/23
[ "https://Stackoverflow.com/questions/389100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
389,103
<p>I'm attempting to set up a symbol proxy using symproxy.dll from Debugging Tools for Windows. When I issue ".reload /f" from the debugger, none of the symbol files can be found. It looks like Symproxy isn't going out to the Microsoft Symbol Server to actually get the symbols. I see nothing in Wireshark, for example.</p> <p>SYMPROXY.DLL is definitely being loaded -- I can see some entries in the Event Log, and <a href="http://my-server/symbols/status" rel="nofollow noreferrer">http://my-server/symbols/status</a> returns valid-looking information.</p> <p>I've followed the instructions in the documentation as far as I can tell. Why won't symproxy go to Microsoft's site? What am I doing wrong? I need this to work, because the machine on which I'm debugging doesn't have external access.</p> <p>The box on which symproxy is running has Internet access -- I regularly use it for debugging. The symbol path configured in the registry for symproxy looks correct. It doesn't have to go through a proxy to get to the Internet, and I've configured that in the registry as well.</p> <p>When I use !sym noisy on the other box, it contacts symproxy, but simply says "file not found". It's like the symproxy is simply serving the content, rather than doing a lookaside to the MS symbol servers, like it's supposed to.</p>
[ { "answer_id": 389334, "author": "Cory Foy", "author_id": 4083, "author_profile": "https://Stackoverflow.com/users/4083", "pm_score": 1, "selected": false, "text": ".symfix c:\\symbols" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
389,124
<p>In C# if I want to create a "Custom Event" you do something like this:</p> <pre><code>private EventHandler _MyEvent; Public Event EventHandler MyEvent { add{ _MyEvent += value; } remove{ _MyEvent -= Value; } } protected void RaiseMyEvent() { if(_MyEvent != nul) _MyEvent(this, EventArgs.Empty); } </code></pre> <p>In VB this is not so straightforward nor can I find any help ANYWHERE on the net. This does not work:</p> <pre><code>private _MyEvent as EventHandler Public Custom Event MyEvent as EventHandler AddHandler(ByVal value as EventHandler) _MyEvent += value 'does not work addhandler _MyEvent, value 'does not work [Delegate].Combine(_MyEvent, value) '_MyEvent still nothing End AddHandler RemoveHandler(ByVal value as EventHandler) 'Same kind of stuff here End RemoveHandler RaiseEvent(sender as Object, e as EventArgs) if(_MyEvent IsNot Nothing) Then '_MyEvent is always nothing _MyEvent.Invoke(sender, e) End If End RaiseEvent End Event </code></pre> <p>Please help.</p>
[ { "answer_id": 389166, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 4, "selected": true, "text": "_MyEvent = [Delegate].Combine(_MyEvent, value)\n" }, { "answer_id": 390666, "author": "Tom Anderson", "author_...
2008/12/23
[ "https://Stackoverflow.com/questions/389124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17744/" ]
389,140
<p>I have a ASP.Net TreeView control that I am binding to an XML data source. I'm wanting to be able to control which nodes are expanded and which ones are collapsed in the XML definition file. The Expanded='' doesn't work for me though. In the following simple example, I want Node 2 to be fully expanded.</p> <p>ASP Page...</p> <pre><code>&lt;asp:XmlDataSource ID="oXmlDataSource" runat="server" /&gt; &lt;asp:TreeView ID="TreeView1" runat="server" EnableViewState="false" DataSourceID="oXmlDataSource"&gt;&lt;/TreeView&gt; </code></pre> <p>Code Behind...</p> <pre><code>oXmlDataSource.Data = MyXMLString; oXmlDataSource.XPath = "/Tree/Node"; </code></pre> <p>Here is the XML...</p> <pre><code>&lt;?xml version='1.0' encoding='utf-8' ?&gt; &lt;Tree Text='example.aspx' Href='example.aspx'&gt; &lt;Node Text='Example Node 1' Href='0800200c9a66.aspx' Expanded='false'&gt;&lt;/Node&gt; &lt;Node Text='Example Node 2' Href='0800200c9a66.aspx' Expanded='true'&gt; &lt;Node Text='Example Node 3' Href='0800200c9a66.aspx' Expanded='false'&gt;&lt;/Node&gt; &lt;Node Text='Example Node 4' Href='0800200c9a66.aspx' Expanded='false'&gt;&lt;/Node&gt; &lt;Node Text='Example Node 5' Href='0800200c9a66.aspx' Expanded='false'&gt;&lt;/Node&gt; &lt;Node Text='Example Node 6' Href='0800200c9a66.aspx' Expanded='false'&gt;&lt;/Node&gt; &lt;/Node&gt; &lt;/Tree&gt; </code></pre>
[ { "answer_id": 390014, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": true, "text": "<asp:XmlDataSource ID=\"oXmlDataSource\" runat=\"server\" />\n<asp:TreeView ID=\"TreeView1\" runat=\"server\" EnableViewState=\...
2008/12/23
[ "https://Stackoverflow.com/questions/389140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7819/" ]
389,149
<p>I have a basic HTML form that gets inserted into a server side <em>div</em> tag based on how many records exist in the database. This HTML form comes out just fine, and everything looks good. But on my action page I cannot seem to access the input elements from the code behind. I have tried using the <em>Request</em> scope, but I have come up empty on that approach. Any other suggestions?</p> <p>All of the below suggestions are great, and normally that is what I would do. But these forms are being built on the fly after the page is being compiled, so <code>runat='server'</code> did not do anything for me. It just passed that along to the HTML page.</p>
[ { "answer_id": 389163, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 3, "selected": false, "text": "Request.Form[\"elementName\"] <input type=\"text\" name=\"email\" /> Request.Form[\"email\"]" }, { "answer_id": 38917...
2008/12/23
[ "https://Stackoverflow.com/questions/389149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,169
<p>Are there any known how-tos or best practices for web service REST API versioning?</p> <p>I have noticed that <a href="http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/APIUsage.html" rel="noreferrer">AWS does versioning by the URL of the endpoint</a>. Is this the only way or are there other ways to accomplish the same goal? If there are multiple ways, what are the merits of each way? </p>
[ { "answer_id": 398564, "author": "Shonzilla", "author_id": 31625, "author_profile": "https://Stackoverflow.com/users/31625", "pm_score": 10, "selected": true, "text": "Location" }, { "answer_id": 6750376, "author": "jeremyh", "author_id": 852325, "author_profile": "ht...
2008/12/23
[ "https://Stackoverflow.com/questions/389169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4869/" ]
389,175
<p>Let's just assume that I don't know much about Kerberos - just the basics.</p> <p>I have...</p> <ul> <li>Debian Linux 2.6 Webserver <ul> <li>Apache 2.2 <ul> <li>mod_auth_kerb/5.3 </li> <li>PHP/5.2</li> </ul></li> </ul></li> <li>a (working) Kerberos Realm</li> <li>Windows Client <ul> <li>Firefox 3</li> <li>an logged in identity "user@EXAMPLE.COM" in MIT Network Identity Manager</li> </ul></li> </ul> <p>How do I use this information in a PHP script so that I don't need to log in to the website if the visitor has a kerberos ticket like that? I don't want Apache to handle the authentication. I need to find out which user is accessing the site via PHP.</p> <p>Is that possible? If so: How?</p> <p>What I have found out so far: I have to <a href="http://grolmsnet.de/kerbtut/firefox.html" rel="noreferrer">"enable" the domain in Firefox</a>. </p> <p>However that's about it...</p>
[ { "answer_id": 390719, "author": "Cetra", "author_id": 15087, "author_profile": "https://Stackoverflow.com/users/15087", "pm_score": 2, "selected": false, "text": "KrbSaveCredentials $_SERVER['REMOTE_USER']\n $_SERVER['KRB5CCNAME']\n" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
389,178
<p>Supposedly installing <a href="http://www.kuwata-lab.com/erubis/" rel="nofollow noreferrer">erubis</a> is as simple as:</p> <pre><code>gem install erubis # And in environment.rb: require 'erubis/helpers/rails_helper' </code></pre> <p>But I haven't found this to be so. Note that there are no evident errors in my code; it runs just fine and dandy with ERB.</p> <ol> <li>Where do I put this line? Directly after the <code>boot.rb</code> inclusion it fails to start the server, and at the end of the file I get an unexpected nil object error (nil.controller). Where is best?</li> <li>Are there known conflicts with the given versions?</li> <li>Are there any workarounds I can utilize to get erubis functioning?</li> </ol>
[ { "answer_id": 390719, "author": "Cetra", "author_id": 15087, "author_profile": "https://Stackoverflow.com/users/15087", "pm_score": 2, "selected": false, "text": "KrbSaveCredentials $_SERVER['REMOTE_USER']\n $_SERVER['KRB5CCNAME']\n" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24950/" ]
389,180
<p>After reading some threads on misuses of exceptions (basically saying you don't want to unwind the stack if a functions preconditions are incorrect - possibly signalling that all your memory is corrupt or something equally dangerous) I'm thinking about using assert() more often. Previously I have only used assert() as a debug tool and I think this is how a lot of C++ programmers use it. I'm concerned about part of my error handling being turned off by a NDEBUG #define introduced to the runtime builds at some point in the future. Is there a way round this and have others had a problem with this (i.e. should I be worrying about it)?</p> <p>Thanks, Pat</p> <p>Edit: The point of the threads I was reading was that if your application is truely buggered then unwinding stack could damage the system, for instance if a destructor wrote something to a file and the file handle was corrupted. I'm not suggesting using assert for normal error handling. The current use case I have is pretty weak but see what you think:</p> <pre> <code> //check later code won't crash the system if( buf.length() % 2 ) return false; // do other stuff that shouldn't affect bufs length //copy 2 bytes into buf at a time, if length is odd then don't know //what will happen so use assert to make sure it can't damage anything assert( !(buf.length() % 2) ); for( i = 0; i != buf.length(); i += 2 ) memcpy( buf + i, data, 2 ); </code> </pre> <p>edit2: the discussion is here: <a href="http://groups.google.com/group/comp.lang.c++.moderated/browse_frm/thread/80083ac31a1188da" rel="noreferrer">http://groups.google.com/group/comp.lang.c++.moderated/browse_frm/thread/80083ac31a1188da</a></p>
[ { "answer_id": 389225, "author": "Seb Rose", "author_id": 12405, "author_profile": "https://Stackoverflow.com/users/12405", "pm_score": 1, "selected": false, "text": "#undef NDEBUG\n" }, { "answer_id": 389901, "author": "Larry Gritz", "author_id": 3832, "author_profil...
2008/12/23
[ "https://Stackoverflow.com/questions/389180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38892/" ]
389,196
<p>I am using an instance of <code>ManualResetEvent</code> to control thread access to a resource but I'm running into problems with it. Does anyone know how I can find out during debugging what the state of the object is?</p> <p>That is to say I would like to know if the <code>ManualResetEvent</code> is currently blocking any threads and maybe even how many and which threads it is blocking.</p>
[ { "answer_id": 389226, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 8, "selected": true, "text": "WaitOne" }, { "answer_id": 6975276, "author": "fab", "author_id": 203528, "author_profile": "ht...
2008/12/23
[ "https://Stackoverflow.com/questions/389196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
389,204
<p>I have seen:</p> <ul> <li><code>http://www...</code></li> <li><code>ftp://blah.blah...</code></li> <li><code>file://blah.blah...</code></li> <li><code>unreal://blah.blah...</code></li> <li><code>mailto://blah.blah...</code></li> </ul> <p>What is that first section where you see <code>http</code> and the like called?</p> <p>Can I register my own?</p>
[ { "answer_id": 389223, "author": "James Gregory", "author_id": 27206, "author_profile": "https://Stackoverflow.com/users/27206", "pm_score": 9, "selected": true, "text": "HTTP:// FTP:// HKEY_CLASSES_ROOT/\n your-protocol-name/\n (Default) \"URL:your-protocol-name Protocol\"\n U...
2008/12/23
[ "https://Stackoverflow.com/questions/389204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37510/" ]
389,211
<p>This is a followup to <a href="https://stackoverflow.com/questions/378281/latlon-distance-heading-latlon">this question</a>.</p> <p>I seem to be stuck on this. Basically, I need to be able to convert back and forth to referring to coordinates either in the standard degree system OR by measuring a distance north from the south pole along the international date line, and then a distance east starting from that point on the date line. To do this (as well as some more general distance-measuring stuff), I have one method for determining the distance between two lat/lon points, and another method that takes a lat/lon point, a heading and a distance, and returns the lat/lon point at the end of that course.</p> <p>Here are the two static methods I've defined:</p> <pre><code>/* Takes two lon/lat pairs and returns the distance between them in kilometers. */ public static double distance (double lat1, double lon1, double lat2, double lon2) { double theta = toRadians(lon1-lon2); lat1 = toRadians(lat1); lon1 = toRadians(lon1); lat2 = toRadians(lat2); lon2 = toRadians(lon2); double dist = sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(theta); dist = toDegrees(acos(dist)) * 60 * 1.1515 * 1.609344 * 1000; return dist; } /* endOfCourse takes a lat/lon pair, a heading (in degrees clockwise from north), and a distance (in kilometers), and returns * the lat/lon pair that would be reached by traveling that distance in that direction from the given point. */ public static double[] endOfCourse (double lat1, double lon1, double tc, double dist) { double pi = Math.PI; lat1 = toRadians(lat1); lon1 = toRadians(lon1); tc = toRadians(tc); double dist_radians = toRadians(dist / (60 * 1.1515 * 1.609344 * 1000)); double lat = asin(sin(lat1) * cos(dist_radians) + cos(lat1) * sin(dist_radians) * cos(tc)); double dlon = atan2(sin(tc) * sin(dist_radians) * cos(lat1), cos(dist_radians) - sin(lat1) * sin(lat)); double lon = ((lon1-dlon + pi) % (2*pi)) - pi; double[] endPoint = new double[2]; endPoint[0] = lat; endPoint[1] = lon; return endPoint; } </code></pre> <p>And here's the function I'm using to test it:</p> <pre><code>public static void main(String args[]) throws java.io.IOException, java.io.FileNotFoundException { double distNorth = distance(0.0, 0.0, 72.0, 0.0); double distEast = distance(72.0, 0.0, 72.0, 31.5); double lat1 = endOfCourse(0.0, 0.0, 0.0, distNorth)[0]; double lon1 = endOfCourse(lat1, 0.0, 90.0, distEast)[1]; System.out.println("end at: " + lat1 + " / " + lon1); return; } </code></pre> <p>The "end at" values should be appx. 72.0 / 31.5. But instead I'm getting approximately 1.25 / 0.021.</p> <p>I assume I must be missing something stupid, forgetting to convert units somewhere, or something... Any help would be greatly appreciated!</p> <p><strong>UPDATE 1:</strong></p> <p>I had (correctly) written the distance function to return meters, but wrote kilometers in the comments by mistake ... which of course confused me when I came back to it today. Anyway, now that's fixed, and I've fixed the factoring error in the endOfCourse method, and I also realized I'd forgotten to convert back to degrees from radians in that method too. Anyway: while it appears I'm now getting the correct latitude number (71.99...), the longitude number is way off (I get 3.54 instead of 11.5).</p> <p><strong>UPDATE 2:</strong> I had a typo in the test, as mentioned below. It's now fixed in the code. The longitude number is still, however, wrong: I'm now getting -11.34 instead of 11.5. I think there must be something wrong with these lines:</p> <pre><code>double dlon = atan2(sin(tc) * sin(dist_radians) * cos(lat1), cos(dist_radians) - sin(lat1) * sin(lat)); double lon = ((lon1-dlon + pi) % (2*pi)) - pi; </code></pre>
[ { "answer_id": 389251, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 7, "selected": true, "text": " (60 * 1.1515 * 1.609344 * 1000)\n (60° N, 30° W), (60° N, 60° W)\n(60° N, 60° W), (60° N, 90° W)\n cos a = cos b ...
2008/12/23
[ "https://Stackoverflow.com/questions/389211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47450/" ]
389,216
<p>In the 10 years I've been programming, I can count the number of data structures I've used on one hand: arrays, linked lists (I'm lumping stacks and queues in with this), and dictionaries. This isn't really surprising given that nearly all of the applications I've written fall into the forms-over-data / CRUD category.</p> <p>I've never needed to use a red-black tree, skip list, double-ended queue, circularly linked list, priority queue, heaps, graphs, or any of the dozens of exotic data structures that have been researched in the past 50 years. I feel like I'm missing out.</p> <p>This is an open-ended question, but where are these "exotic" data structures used in practice? Does anyone have any real-world experience using these data structures to solve a particular problem?</p>
[ { "answer_id": 50198489, "author": "Vorac", "author_id": 1145760, "author_profile": "https://Stackoverflow.com/users/1145760", "pm_score": 1, "selected": false, "text": "Cache<Obj, Len>" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40516/" ]
389,219
<p>What methods are available for determining the optimum stack size for embedded/memory constrained system? If it's too big then memory is wasted that could be used elsewhere. However, if it is too small then we get this website's namesake...</p> <p>To try to jump start things: Jack Ganssle states in <em><a href="https://rads.stackoverflow.com/amzn/click/com/0750698691" rel="noreferrer" rel="nofollow noreferrer">The Art of Designing Embedded Systems</a></em> that, <strong>"With experience, one learns the standard, scientific way to compute the proper size for a stack: Pick a size at random and hope."</strong> Can anyone do better than that?</p> <p>A more specific example was requested. So, how about a C program targeting an <a href="http://focus.ti.com/mcu/docs/mcuprodoverview.tsp?sectionId=95&amp;tabId=140&amp;familyId=342" rel="noreferrer">MSP430 MCU</a> with 2 kB of RAM using the <a href="http://www.iar.com/website1/1.0.1.0/50/1/index.php?" rel="noreferrer">IAR Embedded Workbench</a> toolchain without an operating system? This IDE can display the stack contents and usage while using a JTAG debugger.</p>
[ { "answer_id": 389305, "author": "Diomidis Spinellis", "author_id": 20520, "author_profile": "https://Stackoverflow.com/users/20520", "pm_score": 5, "selected": false, "text": "char *stack_top, stack_bottom;\n\nint\nmain(int argc, char *argv[])\n{\n stack_top = (char *)&argc;\n // ...
2008/12/23
[ "https://Stackoverflow.com/questions/389219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491/" ]
389,254
<p>Is it possible in Delphi to have a class method invoke an inherited instance method with the same name? For example, I tried something like this:</p> <pre><code>//... Skipped surrounding class definitions function TSomeAbstractDialogForm.Execute: Boolean; begin Result := ShowModal = mrOk; end; </code></pre> <p>I had a couple of specialized dialog classes that inherited the abstract dialog form, and each class had its own factory method:</p> <pre><code>class function TSomeInheritingDialogForm.Execute: Boolean; var Fm: TSomeInheritingDialogForm; begin Fm := TSomeInheritingDialogForm.Create(nil); try Result := Fm.Execute; finally Fm.Free; end end; </code></pre> <p>This approach resulted in a never ending loop since F.Execute, instead of invoking the intended instance method of the base class, kept calling the factory method over and over again (resulting in a pile of created forms).</p> <p>Of course, the obvious solution was to change the name of the factory method (I named it CreateAndShow), but it made me curious. How come the compiler didn't warn me about the hidden method? And is there a way to explicitly invoke the instance method in a situation like this?</p>
[ { "answer_id": 389292, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 4, "selected": true, "text": "function TSomeAbstractDialogForm.Execute: Boolean;\nbegin\n Result := ShowModal = mrOk;\nend;\n\nclass function TSome...
2008/12/23
[ "https://Stackoverflow.com/questions/389254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39348/" ]
389,257
<p>This seems to go against every design guideline. A static method that accepts a single argument of type T should usually just be a member method.</p> <p>It's so bizzare I actually had to post a <a href="https://stackoverflow.com/questions/389100/is-there-a-built-in-islowercase-in-net">StackOverflow question</a> to understand IsUpper exists (as it didn't show up in auto-completion)</p> <p><strong>Edit</strong></p> <p>I understand my earlier statement needs a little explaining. An example of a good design is String.ToLower(). Instead of it being prototyped as static void ToLower(String foo), it is a member method. It's pretty obvious (to me at least) that the same should hold for char.IsLower().</p>
[ { "answer_id": 389391, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 2, "selected": false, "text": "double d = 100.0;\nConsole.WriteLine(\"Square root of d is \" + d.Sqrt());\n Math double d = 100.0;\nConsole.WriteLine(\"Squa...
2008/12/23
[ "https://Stackoverflow.com/questions/389257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
389,277
<p>When my colleague debugs a web application in his visual studio instance his output window streams all of the assemblies that are being compiled, (at least I believe that is what it's doing) but mine does not. I do see the text "Ready" flashing down in the status bar intermittently which I believe is something similar to what is being dumped to my colleagues output window. Does anyone know what switch I need to flip to get this working on my instance? Both of our output windows are configured to "show output from:" Debug. The reason I'm asking all of this is because this particularly smelly application I've been asked to help on takes something like two or three minutes for it to "spin up" before I actually see an explorer instance for this site and I was thinking that this output information might be able to help me figure out why it's taking so long to "spin up".</p>
[ { "answer_id": 389391, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 2, "selected": false, "text": "double d = 100.0;\nConsole.WriteLine(\"Square root of d is \" + d.Sqrt());\n Math double d = 100.0;\nConsole.WriteLine(\"Squa...
2008/12/23
[ "https://Stackoverflow.com/questions/389277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21909/" ]
389,289
<p>I am looking the fastest way to draw thousands of individually calculated pixels directly to the screen in an iPhone application that preforms extremely well.</p>
[ { "answer_id": 389335, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 3, "selected": true, "text": "glBegin(GL_POINTS);\nglColor3f(...);\nglVertex3f(...);\n...\nglEnd();\n" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30099/" ]
389,290
<p>I'm getting the error in the subject line. I'm running vs2k8 on server 2k3sp2. I've tried deleting the pdbs, cache directories, verifying that debugging is set up on the specific page. The interesting thing is other pages debug just fine. Just when I go to this one page. Must be a configuration issue but the page directive looks like this:</p> <p>print("&lt;%@ Page Language='C#' AutoEventWireup='true' CodeBehind='MemberSearch.aspx.cs' Inherits='SurencyPortal.EmployerPortal.MemberSearch' Debug='true' %>");</p> <p>I've also noticed that when debugging, if I open the modules window, almost all of the symbols show a status of 'Symbol not loaded'. However, after more research from the msdn article below, one of the MSFT posts said that if it's a core .net dll, it will not load symbols so I'm not worried about that. Some of the microsoft modules (like System.Enterpricesservices.wrapper.dll) show an exclamation point with the message 'the module did not load at the default load address'. Not sure why that dll is there as I don't know of any calls to it.</p> <p>Here are the thing's i've tried:</p> <p><a href="https://stackoverflow.com/questions/163133/breakpoint-not-hooked-up-when-debugging-in-vsnet-2005">Breakpoint not hooked up when debugging in VS.Net 2005</a></p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/vbide/thread/557fdedb-268e-48a8-9944-29b2b4e0dec2/#page:3" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/vbide/thread/557fdedb-268e-48a8-9944-29b2b4e0dec2/#page:3</a></p> <p>Bill</p>
[ { "answer_id": 389363, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 2, "selected": false, "text": "<compilation debug=\"true\">" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46064/" ]
389,298
<p>Is there a way to update more than one Database having same schema using single ObjectDataSource in C#???</p> <p>i.e Just by providing more than one connection string is it some how possible to update more than one Database? I need to update/insert same record in multiple Database with same schema using ObjectDataSource in C#. </p>
[ { "answer_id": 389350, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 3, "selected": true, "text": "public void DeleteMyObject(int objectId)\n{\n SqlConnection connectionOne = new SqlConnection(\"MyFirstDbConnect...
2008/12/23
[ "https://Stackoverflow.com/questions/389298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47344/" ]
389,341
<p>I have a WPF ListBox bound to a data object. Inside the listbox are a series of images with text. It is layed out in a horizontal fashion, and mousing over the left or right sides of the box scroll the items left or right respectively.</p> <p>let's say there are 20 items in the listbox. I'm trying to figure out how when I hit position 19 item (0 based) that I can cycle the box and start the collection over, so that it goes 1 -19 and so on. It would need to also cycle the other way, so that if you were on item 0, and scrolled left, you would get 19.</p> <p>I've tried the KeyboardNavigation.DirectionalNavigation="Cycle" but that doesnt' seem to do anything for me, and I was grasping at straws since this has nothing to do with the keyboard, it's all mouse based.</p> <pre><code> &lt;ListBox ItemsSource="{Binding Source={StaticResource WPFApparelCollection}}" Margin="24,-7,39,-19" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" SelectionMode="Single" x:Name="list1" MouseLeave="List1_MouseLeave" MouseMove="List1_MouseMove" Style="{DynamicResource ListBoxStyle1}" Background="Transparent" BorderThickness="0"&gt; &lt;ListBox.Resources&gt; &lt;!-- override the system brushes so that selected items are transparent whether the ListBox has focus or not --&gt; &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /&gt; &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" /&gt; &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /&gt; &lt;/ListBox.Resources&gt; &lt;ListBox.ItemContainerStyle&gt; &lt;Style TargetType="{x:Type ListBoxItem}"&gt; &lt;Setter Property="Background" Value="Transparent" /&gt; &lt;Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /&gt; &lt;Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /&gt; &lt;Setter Property="Padding" Value="20,10,20,10" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type ListBoxItem}"&gt; &lt;Border x:Name="Bd" SnapsToDevicePixels="true" Background="Transparent" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"&gt; &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /&gt; &lt;/Border&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsSelected" Value="true"&gt; &lt;Setter Property="Background" TargetName="Bd" Value="Transparent" /&gt; &lt;Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /&gt; &lt;/Trigger&gt; &lt;MultiTrigger&gt; &lt;MultiTrigger.Conditions&gt; &lt;Condition Property="IsSelected" Value="true" /&gt; &lt;Condition Property="Selector.IsSelectionActive" Value="false" /&gt; &lt;/MultiTrigger.Conditions&gt; &lt;Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /&gt; &lt;Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /&gt; &lt;/MultiTrigger&gt; &lt;Trigger Property="IsEnabled" Value="false"&gt; &lt;Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/ListBox.ItemContainerStyle&gt; &lt;ListBox.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListBox.ItemsPanel&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Vertical"&gt; &lt;Image Source="{Binding Image}" MouseLeave="Image_MouseLeave" MouseEnter="Image_MouseEnter" Cursor="Hand" Tag="{Binding Link}" MouseLeftButtonDown="Image_MouseLeftButtonDown" VerticalAlignment="Top" HorizontalAlignment="Left"&gt;&lt;/Image&gt; &lt;Label Content="{Binding Name}" Cursor="Hand" Tag="{Binding Link}" MouseLeftButtonDown="Label_MouseLeftButtonDown" VerticalAlignment="Bottom" Foreground="White" Style="{StaticResource Gotham-Medium}" FontSize="8pt" HorizontalAlignment="Center" /&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre>
[ { "answer_id": 397890, "author": "PaulJ", "author_id": 11308, "author_profile": "https://Stackoverflow.com/users/11308", "pm_score": 2, "selected": true, "text": "public class CyclicScrollViewer : ScrollViewer\n{\n public CyclicScrollViewer()\n {\n this.CommandBindings.Add(n...
2008/12/23
[ "https://Stackoverflow.com/questions/389341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22451/" ]
389,342
<p>The <code>image.size</code> attribute of <code>UIImageView</code> gives the size of the original <code>UIImage</code>. I would like to find out the size of the autoscaled image when it is put in the <code>UIImageView</code> (typically smaller than the original). </p> <p>For example, I have the image set to <code>Aspect Fit</code>. Now I want to know its new height and width on the screen so I can draw accurately on the new scaled image.</p> <p>Is there any way to do this without figuring it out myself based on the UIImageView size &amp; UIImage original size (basically reverse engineering its scaling)?</p>
[ { "answer_id": 4987554, "author": "cncool", "author_id": 615517, "author_profile": "https://Stackoverflow.com/users/615517", "pm_score": 6, "selected": false, "text": "-(CGRect)frameForImage:(UIImage*)image inImageViewAspectFit:(UIImageView*)imageView\n{\n float imageRatio = image.siz...
2008/12/23
[ "https://Stackoverflow.com/questions/389342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,343
<p>Currently, I'm working on a project to manage maintenance windows on a database of servers, etc. Basically, I only need to be accurate down to the hour, but allow for them to be set to allow, or disallow, for each day of the week.</p> <p>I've had a few ideas on how to do this, but since I work by myself, I'm not wanting to commit to anything without some feedback.</p> <p><strong>To visualize this, it's something like the flowing "graph"</strong></p> <pre><code> | Sun | Mon | Tue | Wed | Thu | Fri | Sat | ------------------------------------------- 5AM |allow|allow|allow|deny |deny |allow|allow| ------------------------------------------- 6AM |allow|deny |deny |deny |deny |deny |allow| ------------------------------------------- 7AM |allow|deny |deny |deny |deny |deny |allow| ------------------------------------------- 8AM |allow|deny |deny |deny |deny |deny |allow| ------------------------------------------- 9AM |allow|deny |deny |deny |deny |deny |allow| ------------------------------------------- ... etc... </code></pre> <p>Is there a standard way of doing this or a resource that might give me some ideas to...</p> <ol> <li>Make a format that can be saved and restored easily</li> <li>Make it searchable within the database (for example, not having to deserialize it to search for a time)</li> </ol> <p><strong>[Update]</strong></p> <p>It is worth mentioning that a day could, even though unlikely, be set to "allow, deny, allow, deny...etc...". The span isn't guaranteed to be the only one for the whole day.</p> <p>This is also not the only schedule, there will be hundreds of devices each with their own schedule, so it's going to get hairy... lol??</p> <p><strong>Rob</strong> asked if each week needed to be tracked - It does not. This is a generic schedule that will apply to the entire year (regularly scheduled maintenance)</p>
[ { "answer_id": 389357, "author": "kemiller2002", "author_id": 1942, "author_profile": "https://Stackoverflow.com/users/1942", "pm_score": 0, "selected": false, "text": "TABLE:\n StartTime DATETIME PrimaryKey,\n EndTime DATETIME PrimaryKey, /*if you are positive it will b...
2008/12/23
[ "https://Stackoverflow.com/questions/389343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17091/" ]
389,361
<p>We know that IIS caches ConfigurationManager.AppSettings so it reads the disk only once until the web.config is changed. This is done for performance purposes.</p> <p>Someone at:</p> <p><a href="http://forums.asp.net/p/1080926/1598469.aspx#1598469" rel="noreferrer">http://forums.asp.net/p/1080926/1598469.aspx#1598469</a></p> <p>stated that .NET Framework doesn't do the same for app.config, but it reads from the disk for every request. But I find it hard to believe, 'cause it would be slower. Please tell me that he is wrong or I'll have to fix every Console/Windows Forms/Windows Services I wrote.</p> <p><strong>Update</strong> I regret that I misinterpreted what people said in the linked forum above.</p>
[ { "answer_id": 389386, "author": "ZombieSheep", "author_id": 377, "author_profile": "https://Stackoverflow.com/users/377", "pm_score": 7, "selected": true, "text": "//edit the config file now.\nConsole.ReadLine();\n\nConsole.WriteLine(ConfigurationManager.AppSettings[\"ApplicationName\"]...
2008/12/23
[ "https://Stackoverflow.com/questions/389361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
389,393
<p>I've been watching Douglas Crockford's talks at YUI Theater, and I have a question about JavaScript inheritance...</p> <p>Douglas gives this example to show that "Hoozit" inherits from "Gizmo":</p> <pre><code>function Hoozit(id) { this.id = id; } Hoozit.prototype = new Gizmo(); Hoozit.prototype.test = function (id) { return this.id === id; }; </code></pre> <p>Why does he write <code>Hoozit.prototype = new Gizmo()</code> instead of <code>Hoozit.prototype = Gizmo.prototype</code>?</p> <p>Is there any difference between these two?</p>
[ { "answer_id": 389402, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 5, "selected": true, "text": "Hoozit.prototype = Gizmo.prototype Hoozit.prototype = new Gizmo()" }, { "answer_id": 389457, "author": "Chr...
2008/12/23
[ "https://Stackoverflow.com/questions/389393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7595/" ]
389,396
<p>I'm using a MOSS Publishing site with a custom master page. One of our requirements is to have a "Site Updated" footer. Currently we set this manually each time the site is updated. </p> <p>What i'm trying to do is reference a specific list item (from a custom list) that stores this date. </p> <p>I'm using sharepoint designer to insert a Data View on to the master page, then dropping the custom sharepoint list on it from the data source library.</p> <p>This works fine and you can see the date when you are viewing the root page of the site, as soon as you navigate to a subsite an error is returned stating:</p> <p><em>Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.</em></p> <p>I've googled this error and tried adding curly braces to the list ID but that hasn't solved the problem. Does anyone have any suggestions?</p>
[ { "answer_id": 389402, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 5, "selected": true, "text": "Hoozit.prototype = Gizmo.prototype Hoozit.prototype = new Gizmo()" }, { "answer_id": 389457, "author": "Chr...
2008/12/23
[ "https://Stackoverflow.com/questions/389396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46108/" ]
389,398
<p>I have a little python script that pulls emails from a POP mail address and dumps them into a file (one file one email)</p> <p>Then a PHP script runs through the files and displays them.</p> <p>I am having an issue with ISO-8859-1 (Latin-1) encoded email</p> <p>Here's an example of the text i get: =?iso-8859-1?Q?G=EDsli_Karlsson?= and Sj=E1um hva=F0 =F3li er kl=E1r J</p> <p>The way i pull emails is this code.</p> <pre><code>pop = poplib.POP3(server) mail_list = pop.list()[1] for m in mail_list: mno, size = m.split() lines = pop.retr(mno)[1] file = StringIO.StringIO("\r\n".join(lines)) msg = rfc822.Message(file) body = file.readlines() f = open(str(random.randint(1,100)) + ".email", "w") f.write(msg["From"] + "\n") f.write(msg["Subject"] + "\n") f.write(msg["Date"] + "\n") for b in body: f.write(b) </code></pre> <p>I have tried probably all combinations of encode / decode within python and php.</p>
[ { "answer_id": 390688, "author": "mcrute", "author_id": 33786, "author_profile": "https://Stackoverflow.com/users/33786", "pm_score": 3, "selected": true, "text": "import email\nimport poplib\nimport random\nfrom cStringIO import StringIO\nfrom email.generator import Generator\n\npop = p...
2008/12/23
[ "https://Stackoverflow.com/questions/389398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22459/" ]
389,403
<p>How can you access and display the row index of a gridview item as the command argument in a buttonfield column button?</p> <pre><code>&lt;gridview&gt; &lt;Columns&gt; &lt;asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" Visible="True" CommandArgument=" ? ? ? " /&gt; ..... </code></pre>
[ { "answer_id": 389424, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 0, "selected": false, "text": "protected void FormatGridView(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)\n{\n if (e.Row.RowType == Data...
2008/12/23
[ "https://Stackoverflow.com/questions/389403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35286/" ]
389,415
<p>I'm sending a file from a z/OS system to a Linux ftp sever using sftp.</p> <p>I want to append the date to the filename once the file resides on the linux box. (Ex: filename.txt becomes filename122308.txt)</p> <p>I have tried the 'rename' command using 'date +%m%d%y' - the file was renamed but the flags were not executed (The filename became filename'date +%m%d%y'.txt</p> <p>The 'cp' and 'mv' commands do not work... any ideas?</p> <p>Thanks.</p>
[ { "answer_id": 389465, "author": "dacracot", "author_id": 13930, "author_profile": "https://Stackoverflow.com/users/13930", "pm_score": 0, "selected": false, "text": "sftp [[user@]host[:file [file]]]\n export WHEN=`date +%m%d%y`\nsftp theUser@theHost:filename$WHEN.txt filename.txt <<-!\n...
2008/12/23
[ "https://Stackoverflow.com/questions/389415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,425
<p>I am trying to layout a header for a web site and I would like to have 4 containers in the header for dropping various user controls into.</p> <p>The 4 containers need to be positioned top left, top right, bottom left and bottom right inside the main the header container.</p> <p>So far I can acheive this, the bit I can't do is that the bottom left and bottom right containers need to be aligned with the bottoms of their containers at the same level. </p> <p>If I assign a height to #Bottom it works fine but I don't want to do this as I cannot predict what controls will be on the page and therefore won't know what height to set.</p> <p>It needs to work in IE7.</p> <p>I hope that all makes sense.</p> <p>I have created a sample app to demonstrate the problem...</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;style type="text/css"&gt; .clearFloats { clear:both; } #topLeft { float:left; border: 1px solid blue; height:50px; } #topRight { float:right; border: 1px solid blue; height:50px; } #bottom { position:relative; border: 1px solid green; } #bottomLeft { float:left; border: 1px solid red; position:absolute; top:0; } #bottomRight { float:right; border: 1px solid red; position:absolute; top:0; right:0; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;div id="topLeft"&gt;top left&lt;/div&gt; &lt;div id="topRight"&gt;top right&lt;/div&gt; &lt;div class="clearFloats" /&gt; &lt;div id="bottom"&gt; &lt;div id="bottomLeft"&gt;bottom left&lt;/div&gt; &lt;div id="bottomRight"&gt;bottom right&lt;br /&gt;Some content&lt;br /&gt;some more content&lt;/div&gt; &lt;div class="clearFloats" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 389452, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 0, "selected": false, "text": "bottomLeft bottomRight #bottomLeft\n{\n bottom:0;\n}\n\n#bottomRight\n{\n top:0;\n}\n bottomLeft bottomRight" ...
2008/12/23
[ "https://Stackoverflow.com/questions/389425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1127460/" ]
389,426
<p>Somewhat unclear to me are references (pointers?) to classes in VB.NET. The question I am about to ask can be answered by a little bit of testing, but I was wondering if anybody could post a decent explanation (or links, too).</p> <p>If you create a class:</p> <pre><code>Public Class ReferenceClass Private myBooleanValue As Boolean = False Public Property BooleanValue As Boolean Get Return myBooleanValue End Get Set(value As Boolean) myBooleanValue = value End Set End Property End Class </code></pre> <p>And then a class which actually uses this class as a property:</p> <pre><code>Public Class UsingClass Private myReference As ReferenceClass Public Property Reference As ReferenceClass Get return myReference End Get Set(value As ReferenceClass) myReference = value End Set End Property Public Sub New(ByVal Reference As ReferenceClass) myReference = Reference End Sub End Class </code></pre> <p>And then use it like this:</p> <pre><code>Public Class RuntimeOrSomething Public Shared myReference As ReferenceClass Public Shared ReadOnly Property Reference As ReferenceClass Get If myReference Is Nothing Then myReference = new ReferenceClass() return myReference End Get End Property Public Shared Function BooleanCheck() As Boolean Reference.BooleanValue = True Dim tempClass As New UsingClass(Reference) tempClass.Reference.BooleanValue = False Return (tempClass.Reference.BooleanValue = Reference.BooleanValue) End Sub Public Shared Sub DoNothing() Reference.BooleanValue = True Dim someBoolean As Boolean = BooleanCheck ' Now Reference.Booleanvalue is "False" End Sub End Class </code></pre> <p>Now the function <code>BooleanCheck</code> will always return <code>true</code>, even though the reference is passed to the new class <code>UsingClass</code> "by value", not by reference. So a copy of the class is not made, but the local variable <code>myReference</code> in <code>UsingClass</code> still references/points to the property <code>Reference</code> in <code>RuntimeOrSomething</code>.</p> <p>How can this be explained elegantly?</p>
[ { "answer_id": 389722, "author": "chyne", "author_id": 25157, "author_profile": "https://Stackoverflow.com/users/25157", "pm_score": 1, "selected": false, "text": "Dim tempClass as New UsingClass(Reference)\n Reference tempClass.Reference = new ReferenceClass" }, { "answer_id": 3...
2008/12/23
[ "https://Stackoverflow.com/questions/389426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1271/" ]
389,434
<p>My (.NET) app allows users to tweak database values. They will then need to generate reports based on their edits, either Crystal or Reporting Services, but that's not important - what is important is that the generation won't definitely be able occur on their local box, e.g. they might not have Crystal Reports (or whatever) installed on their machine. </p> <p>So I've set up a Message Queue on a network machine (which can generate the reports) and my app will post a message to that queue sending along an object with all the required information. So far, so good. </p> <p>I've configured the target queue with a rule and a trigger so any new message will automagically provoke a console app on that remote machine to attempt to deal with the message. </p> <p>The problem is that although everything works fine, the triggered console app runs as the local machine account. The app needs to interact with the database (which uses integrated authentication). </p> <p>The console app works perfectly when I run it as an actual user, but not when triggered by Message Queuing. </p> <p>The question is, can I configure the rule, trigger or console app to run as a specific user? I've tried all the config options that I can seem to see, but to no avail. </p> <p>Perhaps I can impersonate a user within the app's code itself (in app.config)? It's feasible in <a href="http://support.microsoft.com/?id=306158" rel="nofollow noreferrer">ASP.NET</a> code, but not in WinForms code by the look of it. </p> <p><strong>Edit:</strong> The impersonation suggestion works well ... right up until the point when I get an error "Access is Denied" from the Process.Start() function, calling startwithcreateprocess(). </p> <p>The user I'm impersonating has permission to run the process on the local box (so it can run natively with no problems). </p>
[ { "answer_id": 389477, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 2, "selected": false, "text": " Process p = new Process();\n\n p.StartInfo.UseShellExecute = false;\n\n SecureString password = new SecureString();...
2008/12/23
[ "https://Stackoverflow.com/questions/389434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2902/" ]
389,437
<p>From MS AJAX source code,</p> <pre><code>Type.isClass = function Type$isClass(type) { /// &lt;summary locid="M:J#Type.isClass" /&gt; /// &lt;param name="type" mayBeNull="true"&gt;&lt;/param&gt; /// &lt;returns type="Boolean"&gt;&lt;/returns&gt; var e = Function._validateParams(arguments, [ {name: "type", mayBeNull: true} ]); if (e) throw e; if ((typeof(type) === 'undefined') || (type === null)) return false; return !!type.__class; </code></pre> <p>}</p> <p>Please look at the last line of code, why use !! instead of just return type.__class?</p> <p>Thanks!</p>
[ { "answer_id": 389443, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 3, "selected": false, "text": "type.__class Type.isClass() Type.isClass(3);\nType.isClass({});\nType.isClass(AnActualClassFunction);\n type.__class _...
2008/12/23
[ "https://Stackoverflow.com/questions/389437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,438
<p>I have a page which has a rectangular area with text and icons in it and the whole thing is clickable. The anchor tag is set to display: block. One of the icons has an onclick handler. If a person clicks on an icon, I just want the icon's onclick handler to run and not to actually activate the containing anchor tag.</p> <p>Firefox behaves like I want, IE doesn't.</p> <p>So I tried to trap the event in the onclick handler:</p> <pre><code>function my_onclick_handler(evt){ if (!evt) evt = window.event; // ... handle the click if (evt.stopPropagation) evt.stopPropagation(); evt.cancelBubble = true; } </code></pre> <p>That didn't work so then I thought maybe it's actually the onmouseup or onmousedown events that trigger the anchor tag so I added a clickSwallow method to onmouseup and onmousedown methods:</p> <pre><code>function clickSwallow(evt){ if (!evt) evt = window.event; if (evt.stopPropagation) evt.stopPropagation(); evt.cancelBubble = true; } </code></pre> <p>That didn't work either. Any ideas how to keep the enclosing anchor from reacting to the click in this case?</p>
[ { "answer_id": 389447, "author": "idrosid", "author_id": 17876, "author_profile": "https://Stackoverflow.com/users/17876", "pm_score": 0, "selected": false, "text": "<a href=\"javascript:void(0)\"> <img src=\"...\" onclick=\"..\"> </a>\n" }, { "answer_id": 389454, "author": "...
2008/12/23
[ "https://Stackoverflow.com/questions/389438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28565/" ]
389,439
<p>I have data bound <code>DataGridView</code> in a desktop app with columns that have their <code>ToolTipText</code> property set, yet no tool tip is displayed when I hover over grid view (cells or cell headers).</p> <p>The <code>ShowCellToolTips</code> property of the grid view is <code>true</code>, and I have verified using break points that it is not changed programmatically before I mouse over.</p> <p>I have tried creating a <code>CellToolTipTextNeeded</code> event handler to see what the tool tip text was, but the event handler is never called.</p> <p>Is there anything I have missed?</p> <p>Thanks, Rob</p> <p><strong>Edit:</strong> We're using framework 2.0.</p>
[ { "answer_id": 422742, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "CellToolTipTextNeeded e.ToolTipText" }, { "answer_id": 547194, "author": "Robert Gowland", "author_id": 20570,...
2008/12/23
[ "https://Stackoverflow.com/questions/389439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20570/" ]
389,456
<p>I have two websites, let's say they're <code>example.com</code> and <code>anotherexample.net</code>. On <code>anotherexample.net/page.html</code>, I have an <code>IFRAME SRC="http://example.com/someform.asp"</code>. That IFRAME displays a form for the user to fill out and submit to <code>http://example.com/process.asp</code>. When I open the form ("<code>someform.asp</code>") in its own browser window, all works well. However, <strong>when I load <code>someform.asp</code> as an IFRAME in IE 6 or IE 7, the cookies for example.com are not saved.</strong> In Firefox this problem doesn't appear.</p> <p>For testing purposes, I've created a similar setup on <a href="http://newmoon.wz.cz/test/page.php" rel="noreferrer">http://newmoon.wz.cz/test/page.php</a> .</p> <p><code>example.com</code> uses cookie-based sessions (and there's nothing I can do about that), so without cookies, <code>process.asp</code> won't execute. <strong>How do I force IE to save those cookies?</strong></p> <p>Results of sniffing the HTTP traffic: on GET /someform.asp response, there's a valid per-session Set-Cookie header (e.g. <code>Set-Cookie: ASPKSJIUIUGF=JKHJUHVGFYTTYFY</code>), but on POST /process.asp request, there is no Cookie header at all.</p> <p>Edit3: some AJAX+serverside scripting is apparently capable to sidestep the problem, but that looks very much like a bug, plus it opens a whole new set of <a href="http://en.wikipedia.org/wiki/Session_hijacking" rel="noreferrer">security holes</a>. I don't want my applications to use a combination of bug+security hole just because it's easy.</p> <p>Edit: the <strong>P3P policy was the root cause</strong>, full explanation below.</p>
[ { "answer_id": 389458, "author": "Piskvor left the building", "author_id": 19746, "author_profile": "https://Stackoverflow.com/users/19746", "pm_score": 10, "selected": true, "text": "policy1 http://example.com/w3c/p3p.xml <META>\n <POLICY-REFERENCES>\n <POLICY-REF about=\"/w3c/examp...
2008/12/23
[ "https://Stackoverflow.com/questions/389456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19746/" ]
389,459
<p>I am trying to write operator overload for custom class and don't know how to handle null comparison.</p> <pre><code>Class Customer { int id; public static bool operator ==(Customer a, Customer b) { //When both a and b are null don't know how to compare as can't use == in here as //it will fall into loop } } </code></pre> <p>Problem is when a and b both are null result is true but not sure how to check it without using ==.</p>
[ { "answer_id": 389472, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 1, "selected": false, "text": "if (((object)a == null) && ((object)b == null))\n{\n return true;\n}\n" }, { "answer_id": 389483, "a...
2008/12/23
[ "https://Stackoverflow.com/questions/389459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48695/" ]
389,485
<p>If I make changes in the trunk to 3 different files, say revisions 40, 45, and 47 respectively, where none of those files have changed since revision 15, how can I merge those revisions into the branch (made at revision 30 and unchanged since) so that I get just the changes between rev 15 and rev 40, 45, and 47 for each of the respective files?</p> <p>Other changes have been made at the in-between revisions(obviously) but they do not affect the files in question, and I do not want those changes to show up in the branch.</p>
[ { "answer_id": 390045, "author": "Mike Miller", "author_id": 16138, "author_profile": "https://Stackoverflow.com/users/16138", "pm_score": 0, "selected": false, "text": "40,45,47 svn merge" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20770/" ]
389,488
<p>Let's consider the following program and try to compile it under Cygwin:</p> <pre><code>#include &lt;GL/glut.h&gt; int main(int argc, char** argv) { glutInit(&amp;argc, argv); glLoadIdentity(); } </code></pre> <p>It compiles and runs just fine. <code>-I/usr/include/opengl</code> seems to be terribly important.</p> <pre><code>g++ -I/usr/include/opengl -I../include/cygwin -L../lib/cygwin test.cpp -o test.exe -lglut32 -lglu32 -lglew32 -lopengl32 </code></pre> <p>Now,</p> <pre><code>#include &lt;GL/glew.h&gt; // from newest NVIDIA SDK #include &lt;GL/glut.h&gt; int main(int argc, char** argv) { glewInit(); glutInit(&amp;argc, argv); glLoadIdentity(); } </code></pre> <p>compiled by</p> <pre><code>g++ -I/usr/include/opengl -I../include/cygwin -L../lib/cygwin test.cpp -o test.exe -lglut32 -lglu32 -lglew32 -lopengl32 </code></pre> <p>fails. How to build the second application?</p> <h3>First</h3> <p>There are several ways to build glew by from NVIDIA SDK: by VS, by cygwin, by cygwin with -D_WIN32. I also tried cygwin build of original glew from source.</p> <p>VS build gives</p> <pre><code>/cygdrive/c/DOCUME~1/kelebron/LOCALS~1/Temp/ccErbecl.o:test.cpp:(.text+0xa8): undefined reference to `_glLoadIdentity' collect2: ld returned 1 exit status </code></pre> <p>cygwin builds give many</p> <pre><code>../lib/cygwin/glew32.lib(glew.o):glew.c:(.text+0x38e): undefined reference to `_glXGetProcAddress' </code></pre> <p>and cygwin with -D_WIN32 does not compile at all (I was slightly motivated by <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=cd39a5a20711290045u7f1f1f15g77a148c1453d8e79%40mail.gmail.com&amp;forum_name=glew-users" rel="noreferrer">this post</a>).</p> <h3>Second</h3> <p>There seem to be two ways to link with OpenGL<br /> with -L/lib/w32api<br /> or with -L/usr/X11R6/lib -lX11 -lXi -lXmu</p> <p>But, the -L directives do not change anything. I've got /usr/lib/w32api/libopengl32.a, but may be missing the X11 version (/usr/X11R6/lib/libGL?). What package should I include into Cygwin? I've installed all starting with libGL (not only...).</p>
[ { "answer_id": 1774411, "author": "Steinbitglis", "author_id": 215904, "author_profile": "https://Stackoverflow.com/users/215904", "pm_score": 2, "selected": false, "text": "#define _STDCALL_SUPPORTED\n#define _M_IX86\n#include <windows.h>\n#include <GL/glew.h>\n#include <GL/glut.h>\n#in...
2008/12/23
[ "https://Stackoverflow.com/questions/389488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19336/" ]
389,496
<p>What are some alternatives to <a href="http://en.wikipedia.org/wiki/Make_(software)" rel="noreferrer">make</a> for linux/freebsd?</p>
[ { "answer_id": 389673, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 4, "selected": true, "text": "SConstruct make" }, { "answer_id": 390068, "author": "Nathan Fellman", "author_id": 1084, "author_prof...
2008/12/23
[ "https://Stackoverflow.com/questions/389496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9789/" ]
389,501
<p>I have a listview that is binded to a ThreadSafeObservableCollection. The background of each of these items is set to an enum that is run through a color converter, here's the code for these 2 settings.</p> <pre><code>&lt;UserControl.Resources&gt; &lt;EncoderView:EncoderStatusToColorConverter x:Key="ColorConverter"/&gt; &lt;Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}"&gt; &lt;Setter Property="Background" Value="{Binding Converter={StaticResource ColorConverter}}" /&gt; &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt; &lt;/Style&gt; &lt;/UserControl.Resources&gt; </code></pre> <p>what I want to have happen is that the background color of the listviewItem will change from Red - Yellow - Green based on an enum value. Which is updated based on business logic rules. This is currently working, but only for the initial display of the item. When I make a change to the "Status" property of the object that the listItemView is bound to, the background does not update. If I remove the object from the collection, change the status, and then add it to the collection again, the background IS updated.<br> I've tried making the object IPropertyNotify, and throwing the event on the status property changed setter, but that didn't work.</p> <p>does anyone know if there is something special I have to do in order to get the background of a listview item to update. I'm also open for other ideas on how to solve this problem, thanks. here's the XAML for the ListView. EncoderService.Encoders is my ThreadSafeObservableCollection of Encoder objects.</p> <pre><code> &lt;ListView AutomationProperties.AutomationId="FinishScreen" ItemsSource="{Binding Path=EncoderService.Encoders}" x:Name="DataListView" Grid.RowSpan="1" Grid.Row="1" Margin="5" ItemContainerStyle="{StaticResource ItemContStyle}" Background="Azure"&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn Header="MAC"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ContentControl Content="{Binding Path=MAC}" ToolTip="{Binding Path=MAC}"/&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Header="IDF"&gt;... </code></pre>
[ { "answer_id": 389569, "author": "Sailing Judo", "author_id": 42620, "author_profile": "https://Stackoverflow.com/users/42620", "pm_score": 1, "selected": false, "text": "public class UniqueWordDataTemplateSelector : DataTemplateSelector\n{\n public override DataTemplate SelectTemplat...
2008/12/23
[ "https://Stackoverflow.com/questions/389501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29849/" ]
389,503
<p>If you use an WebHandler inheriting IHttpAsyncHandler, you shouldn't notice that under undetermined specific circumstances the browser MS IE6 won't display it, the request will never finish. Is there a fix for it?</p>
[ { "answer_id": 389521, "author": "Jader Dias", "author_id": 48465, "author_profile": "https://Stackoverflow.com/users/48465", "pm_score": 3, "selected": true, "text": "using (Image resizedImage = generateImage())\n{\n using (MemoryStream memoryStream = new MemoryStream())\n {\n ...
2008/12/23
[ "https://Stackoverflow.com/questions/389503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
389,504
<p>I have a child form that is throwing an ApplicationException in the Load event handler (intentionally for testing purposes). The parent form wraps the ChildForm.Show() method in a Try...Catch ex As Exception block. The catch block simply displays a message and closes the child form. All works as expected when debugged in visual studio 2008 (.net 3.5 sp1). However, when I run it outside of visual studio, the Catch block seems to get missed and an unhandled exception occurs. Any idea why that is?</p> <p>Thank you.</p> <p>Example Code:</p> <pre><code>Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim f2 As Form2 f2 = New Form2 Try MessageBox.Show("Opening form 2") f2.ShowDialog() Catch ex As Exception f2.Close() MessageBox.Show("Form 2 closed.") End Try End Sub End Class Public Class Form2 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Throw New ApplicationException("Test Form_Load") End Sub Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. End Sub End Class </code></pre> <p>Stack Trace:</p> <pre> System.ApplicationException: Test Form_Load at WindowsApplication1.Form2.Form2_Load(Object sender, EventArgs e) in UnhandledExceptionTest2\WindowsApplication1\Form2.vb System.Windows.Forms.Form.OnLoad(EventArgs e) System.Windows.Forms.Form.OnCreateControl() System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) System.Windows.Forms.Control.CreateControl() System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message&> m) at System.Windows.Forms.ScrollableControl.WndProc(Message&> m) at System.Windows.Forms.ContainerControl.WndProc(Message&> m) at System.Windows.Forms.Form.WmShowWindow(Message&> m) at System.Windows.Forms.Form.WndProc(Message&> m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&> m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&> m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) </pre>
[ { "answer_id": 389538, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 0, "selected": false, "text": " ChildForm child = new ChildForm();\n try {\n child.Show();\n }\n catch(Exception ex)\n {.....}\n" }, {...
2008/12/23
[ "https://Stackoverflow.com/questions/389504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30419/" ]
389,528
<p>I am making a configuration page, that splits a category tree over 3 columns for easy browsing like:</p> <pre><code>**Column 1** **Column 2** **Column3** Category1 Category3 Category5 *SubCategory1* Category4 *SubCategory5* Category2 *SubCategory4* *SubCategory6* *SubCategory2* etc. *SubCategory3* </code></pre> <p>I am using jsp, jquery, and struts2. What I am trying to do is configure the order in which categories/subcategories are displayed. Now I show the structure like that, and I am able to drag them from a column to another, sort the categories of a column and sort the subcategories, using jquery and modifying directly the HTML, but I don't realize how to get the data of the modified structure to persist it over my DB.</p>
[ { "answer_id": 389578, "author": "Daniel Schaffer", "author_id": 2596, "author_profile": "https://Stackoverflow.com/users/2596", "pm_score": 4, "selected": true, "text": "function refactor() {\n var array = jQuery.makeArray($('ul#remapped > li:not(.target)'));\n var mappedArray = j...
2008/12/23
[ "https://Stackoverflow.com/questions/389528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314728/" ]
389,535
<p>I need to query a table for values given a string. The table is case sensitive but I want to do a ToLower() in the comparison. </p> <p>Suppose I have a classes table with the following data.</p> <pre><code>class teacher ----------------- Mat101 Smith MAT101 Jones mat101 Abram ENG102 Smith </code></pre> <p>My query should be something like</p> <pre><code>Select teacher From classes where lower(class) = 'math101' </code></pre> <p>Is this the best way to do the comparison?</p> <h2>Update</h2> <p>I have no control over the database or the data. I am a read only consumer.</p>
[ { "answer_id": 389770, "author": "Gabe", "author_id": 48143, "author_profile": "https://Stackoverflow.com/users/48143", "pm_score": 2, "selected": false, "text": "SQL> WITH LETTERS AS\n 2 (SELECT 'a' LETTER FROM DUAL UNION ALL\n 3 SELECT 'b' LETTER FROM DUAL UNION ALL\n 4 SELECT ...
2008/12/23
[ "https://Stackoverflow.com/questions/389535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,541
<p>Is there a way to select rows in Postgresql that aren't locked? I have a multi-threaded app that will do:</p> <pre><code>Select... order by id desc limit 1 for update </code></pre> <p>on a table. </p> <p>If multiple threads run this query, they both try to pull back the same row. </p> <p>One gets the row lock, the other blocks and then fails after the first one updates the row. What I'd really like is for the second thread to get the first row that matches the <code>WHERE</code> clause and isn't already locked.</p> <p>To clarify, I want each thread to immediately update the first available row after doing the select. </p> <p>So if there are rows with <code>ID: 1,2,3,4</code> , the first thread would come in, select the row with <code>ID=4</code> and immediately update it. </p> <p>If during that transaction a second thread comes it, I'd like it to get row with <code>ID=3</code> and immediately update that row. </p> <p>For Share won't accomplish this nor with <code>nowait</code> as the <code>WHERE</code> clause will match the locked row <code>(ID=4 in my example)</code>. Basically what I'd like is something like "AND NOT LOCKED" in the <code>WHERE</code> clause.</p> <pre><code>Users ----------------------------------------- ID | Name | flags ----------------------------------------- 1 | bob | 0 2 | fred | 1 3 | tom | 0 4 | ed | 0 </code></pre> <p>If the query is "<code>Select ID from users where flags = 0 order by ID desc limit 1</code>" and when a row is returned the next thing is "<code>Update Users set flags = 1 where ID = 0</code>" then I'd like the first thread in to grab the row with <code>ID 4</code> and the next one in to grab the row with <code>ID 3</code>. </p> <p>If I append "<code>For Update</code>" to the select then the first thread gets the row, the second one blocks and then returns nothing because once the first transaction commits the <code>WHERE</code> clause is no longer satisfied. </p> <p>If I don't use "<code>For Update</code>" then I need to add a WHERE clause on the subsequent update (WHERE flags = 0) so only one thread can update the row. </p> <p>The second thread will select the same row as the first but the second thread's update will fail. </p> <p>Either way the second thread fails to get a row and update because I can't get the database to give row 4 to the first thread and row 3 to the second thread the the transactions overlap.</p>
[ { "answer_id": 389610, "author": "HUAGHAGUAH", "author_id": 27233, "author_profile": "https://Stackoverflow.com/users/27233", "pm_score": 0, "selected": false, "text": "Select... order by id desc offset THREAD_NUMBER limit 1 for update\n" }, { "answer_id": 391927, "author": "...
2008/12/23
[ "https://Stackoverflow.com/questions/389541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14059/" ]
389,551
<p>I have a condition in which I need to close the application and so I call this.Dispose () when I set a certian flag.</p> <p>At first I thought it was a problem of calling functions after I call this.Dispose () and so I moved the code to be the last thing called, but I still get an "ArgumentException was unhandled" "Parameter is not valid." On the Application.Run (new myApp (); line.</p> <p>What am I doing wrong? Did I miss something along the way? Or maybe there is a better way to close the application?</p>
[ { "answer_id": 389561, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": true, "text": "Application.Exit() Application.Run(new MyForm()); Dispose() Close Application.Exit()" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19802/" ]
389,571
<p>If I have an ObjectDataSource defined at design time, can I get a DataTable from that ObjectDataSource at runtime? I have a method that returns a DataTable that I am using for the Select method property of the ObjectDataSource.</p>
[ { "answer_id": 389561, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": true, "text": "Application.Exit() Application.Run(new MyForm()); Dispose() Close Application.Exit()" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
389,575
<p>My technical lead insists on this exception mechanism:</p> <pre><code>try { DoSth(); } catch (OurException) { throw; } catch (Exception ex) { Util.Log(ex.Message, "1242"); // 1242 is unique to this catch block throw new OurException(ex); } </code></pre> <p>1242 here is an identifier of the catch method which we handle an exception other than OurException. Every catch block in the project must have a unique identifier so we can know where the exception occurred by looking at the logs.</p> <p>For every method, we have to catch OurException and throw it. If an other type of exception is thrown, we have to log it and mask it by OurException before rethrowing it.</p> <p>Is this a reasonable approach? If there are any, what are the better alternatives?</p> <p><strong>Edit:</strong> I've been told the stack trace does not produce meaningful results in release mode. Are you suggesting catching and throwing generic exceptions is OK?</p> <p><strong>Edit2:</strong> Thank you all. I used your answers as part of my argument against this but I've been told you are not experienced enough and do not know how to deal with real life situations. I have to go this way.</p>
[ { "answer_id": 389600, "author": "Daniel Schaffer", "author_id": 2596, "author_profile": "https://Stackoverflow.com/users/2596", "pm_score": 2, "selected": false, "text": "try\n{\nDoSth();\n}\ncatch(Exception ex)\n{\nUtil.Log(ex.Message, ex.StackTrace);\nif(ex is OurException) throw ex;\...
2008/12/23
[ "https://Stackoverflow.com/questions/389575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
389,581
<p>I am attempting to get the information from one table (games) and count the entries in another table (tickets) that correspond to each entry in the first. I want each entry in the first table to be returned even if there aren't any entries in the second. My query is as follows:</p> <pre><code>SELECT g.*, count(*) FROM games g, tickets t WHERE (t.game_number = g.game_number OR NOT EXISTS (SELECT * FROM tickets t2 WHERE t2.game_number=g.game_number)) GROUP BY t.game_number; </code></pre> <p>What am I doing wrong?</p>
[ { "answer_id": 389587, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 4, "selected": true, "text": "SELECT g.Game_Number, g.PutColumnsHere, count(t.Game_Number) \nFROM games g\nLEFT JOIN tickets t ON g.Game_Number = t.Game_...
2008/12/23
[ "https://Stackoverflow.com/questions/389581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30133/" ]
389,582
<p>I've been searching for information for a common kernel implementation of queues, that is, first-in-first-out data structures. I thought there may be one since it's likely something that's common to use, and there's a standard for linked lists (in the form of the list_head structure). Is there some standard queue implementation I can't find, or is it perhaps common practice to just use linked lists as queues and hope for the best?</p>
[ { "answer_id": 389602, "author": "Diomidis Spinellis", "author_id": 20520, "author_profile": "https://Stackoverflow.com/users/20520", "pm_score": 4, "selected": true, "text": " INIT_LIST_HEAD(&wq->list);\n // ...\n case CPU_UP_CANCELED:\n list_for_each_entry(wq, &workqueue...
2008/12/23
[ "https://Stackoverflow.com/questions/389582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34426/" ]
389,591
<p>Since the <code>OleDbParameter</code> does not use named parameters (due to its nature), why is it that the .NET <code>OleDbParameter</code> class expects a name? <code>(string parametername ...)</code> </p> <p>All constructors require a parameter name, and I'm never sure what name to give it; my name is ok? or my grandmothers name?</p>
[ { "answer_id": 389647, "author": "Ricardo Villamil", "author_id": 19314, "author_profile": "https://Stackoverflow.com/users/19314", "pm_score": 1, "selected": false, "text": "OleDbCommand command = new OleDbCommand();\n...//Add your parameters with names, then reference them later if you...
2008/12/23
[ "https://Stackoverflow.com/questions/389591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,604
<p>Is there any reason why there isn't an addAll() function available when using ArrayCollections in Actionscript? I've been using for loops to individually add them one at a time using addItem(). Is this common or is there a more convenient way?</p>
[ { "answer_id": 389682, "author": "Tmdean", "author_id": 45084, "author_profile": "https://Stackoverflow.com/users/45084", "pm_score": 2, "selected": false, "text": "Array ArrayCollection Array.concat addItem" }, { "answer_id": 389948, "author": "shadenite", "author_id": 4...
2008/12/23
[ "https://Stackoverflow.com/questions/389604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47130/" ]
389,620
<p>Assume I have 10 Methods and 10 Properties. Is there a way to add the xml comments (///) to all 10 Methods and 10 Properties at once in VS 2008 or do I have to type /// for each one.</p>
[ { "answer_id": 389627, "author": "Yuliy", "author_id": 47527, "author_profile": "https://Stackoverflow.com/users/47527", "pm_score": 2, "selected": false, "text": "///" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
389,644
<p>The following code for a co-worker throws the following error when he tries to compile it using VS 2008:</p> <p>Error:</p> <blockquote> <p>A new expression requires () or [] after type</p> </blockquote> <p>Code:</p> <p>MyClass Structure:</p> <pre><code>public class MyClass { public MyClass() {} public string Property1 { get; set; } public string Property2 { get; set; } } </code></pre> <p>Sample Source Code:</p> <pre><code>List&lt;MyClass&gt; x = new List&lt;MyClass&gt;(); x.Add(new MyClass { Property1 = "MyValue", Property2 = "Another Value" }); </code></pre> <p>It "works on my machine", but not his. Any idea why?</p> <p><B>UPDATE</B><br /> He is targeting the 3.5 .NET framework<br /> He is using the System.Collections.Generics namespace<br /> The MyClass object does have a constructor</p> <p><b>UPDATE 1:</b><br /> @Funky81 - Your example and my example were able to compile on my PC.</p> <p><b>Update 2:</b><br /> Included schema of MyClass in sample</p> <p><B>UPDATE 3:</b><br /> @DK - I had my co-worker add the following configuration section to his application:</p> <pre><code>&lt;system.codedom&gt; &lt;compilers&gt; &lt;compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt; &lt;providerOption name="CompilerVersion" value="v3.5"/&gt; &lt;providerOption name="WarnAsError" value="false"/&gt; &lt;/compiler&gt; &lt;compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt; &lt;providerOption name="CompilerVersion" value="v3.5"/&gt; &lt;providerOption name="OptionInfer" value="true"/&gt; &lt;providerOption name="WarnAsError" value="false"/&gt; &lt;/compiler&gt; &lt;/compilers&gt; &lt;/system.codedom&gt; </code></pre> <p>And he received the following compilation error: Unrecognized element 'providerOption'.</p>
[ { "answer_id": 389686, "author": "Funky81", "author_id": 37509, "author_profile": "https://Stackoverflow.com/users/37509", "pm_score": 2, "selected": false, "text": "x.Add(new MyClass()\n{\n Property1 = \"MyValue\",\n Property2 = \"Another Value\"\n});\n" }, { "answer_id": ...
2008/12/23
[ "https://Stackoverflow.com/questions/389644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
389,645
<p>I was wondering how can I set a timeout on a <code>socket_read</code> call? The first time it calls <code>socket_read</code>, it waits till data is sent, and if no data is sent within 5 secs I want to shutdown the connection. Any Help? I already tried <code>SO_RCVTIMEO</code> with no luck.</p> <p>I'm creating a socket with <code>socket_create()</code> and listening on it for connections, then when connected I listen for the data and then do something with it. When the timeout hits, I want to run <code>socket_shutdown()</code> and then <code>socket_close()</code>.</p>
[ { "answer_id": 8205562, "author": "Nick", "author_id": 964080, "author_profile": "https://Stackoverflow.com/users/964080", "pm_score": 5, "selected": false, "text": "socket_set_option($socket,SOL_SOCKET, SO_RCVTIMEO, array(\"sec\"=>5, \"usec\"=>0));\n" }, { "answer_id": 40866511,...
2008/12/23
[ "https://Stackoverflow.com/questions/389645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45530/" ]
389,660
<p>I can use:</p> <pre><code>select * from sys.tables </code></pre> <p>in mssql to show a list of all tables in the current database. Is there anyways I can use similar syntax to show list of tables in another database?</p> <p>Say I am using A with:</p> <pre><code>use A </code></pre> <p>statement, can I show tables in database B?</p>
[ { "answer_id": 389668, "author": "Daniel Schaffer", "author_id": 2596, "author_profile": "https://Stackoverflow.com/users/2596", "pm_score": 5, "selected": true, "text": "select * from your_database_name.sys.tables\n use a;\ngo\n\nselect * from sys.tables; -- selects table info from a\ns...
2008/12/23
[ "https://Stackoverflow.com/questions/389660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10088/" ]
389,677
<p>Anyone know how to query for a specific date within entity framework ? I tried following code, but it gives me NotSupportedException.</p> <pre><code>var deposit = (from tempDeposit in entities.Deposit where !tempDeposit.IsApproved &amp;&amp; tempDeposit.CreatedDate.Date == DateTime.Today select tempDeposit).FirstOrDefault(); </code></pre> <p>I also tried following code but still gave me NotSupportedException.</p> <pre><code>var deposit = (from tempDeposit in entities.Deposit where !tempDeposit.IsApproved &amp;&amp; tempDeposit.CreatedDate.ToFullString() == DateTime.Today.ToFullString() select tempDeposit).FirstOrDefault(); </code></pre> <p>ToFullString() is an extension method</p> <pre><code>public static string ToFullString(this DateTime date){ return date.ToString("yyyyMMdd"); } </code></pre> <p>Please help.</p>
[ { "answer_id": 389870, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 5, "selected": true, "text": "var d1 = DateTime.Today;\nvar d2 = d1.AddDays(1);\nvar deposit = (from tempDeposit in entities.Deposit\n ...
2008/12/23
[ "https://Stackoverflow.com/questions/389677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37509/" ]
389,680
<p>I am using hudson CI to manage a straight java web project, using ant to build.</p> <p>I would like to mandate that the unit test coverage never be worse than the previous build, thereby making sure any new code is always tested, or at least the coverage is continually improving.</p> <p>Is there a hudson plugin that works this way?</p> <p>Edit: I am currently using Emma, but would be willing to switch to another coverage app.</p> <p>Also, as a clarification, I've seen the thresholds in some Hudson plugins, but that's not exactly what I'm after. For example what I'd like is that if coverage for Build #12 was 46% overall, and someone checked in Build #13 with 45% coverage, the build would break.</p> <p>The reason I want to do this, is that I have a codebase with low test coverage. We don't have time to go back and retroactively write unit tests, but I'd like to make sure that the coverage keeps getting better.</p> <p>UPDATE: Dan pointed out an edge case with my plan that will definitely be a problem. I think I need to rethink whether this is even a good idea.</p>
[ { "answer_id": 389842, "author": "Rob Hruska", "author_id": 29995, "author_profile": "https://Stackoverflow.com/users/29995", "pm_score": 2, "selected": false, "text": "echo javac" } ]
2008/12/23
[ "https://Stackoverflow.com/questions/389680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43379/" ]
389,688
<p>I'm about to start a project where I will be the only one doing actual code and two less experienced programmers (scary to think of myself as experienced!) will be watching and making suggestions on the program in general.</p> <p>Is there a good (free) system that I can use to provide documentation for classes and functions based on the code I've written? It'd likely help them a lot in getting to grips with the structure of the data.</p>
[ { "answer_id": 900314, "author": "Martin Geisler", "author_id": 110204, "author_profile": "https://Stackoverflow.com/users/110204", "pm_score": 2, "selected": false, "text": "/**\n * Set the name.\n *\n * @param firstName the first name.\n * @param lastName the last name.\n */\npublic vo...
2008/12/23
[ "https://Stackoverflow.com/questions/389688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
389,692
<p>I'm trying to connect to an Oracle DB which is currently offline. When it's online it's not a problem, however, now that it's offline my program is getting hung up on the $connection = oci_connect() line and timing out. How do I simply check the connectio and bail out if it's not there?</p>
[ { "answer_id": 389785, "author": "Jack", "author_id": 24998, "author_profile": "https://Stackoverflow.com/users/24998", "pm_score": 4, "selected": true, "text": "if ( @fsockopen($db_ip,$db_port ) ) {\n //connect to database\n} else {\n // didn't work\n}\n" }, { "answer_id":...
2008/12/23
[ "https://Stackoverflow.com/questions/389692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39653/" ]
389,709
<p>I'm trying to write a notification service (for completely legit non-spam purposes) in .NET using SmtpClient. Initially I just looped through each message and sent it, however this is slow and I would like to improve the speed. So, I switched to using 'SendAsync', but now get the following error on the second call:</p> <pre><code>An asynchronous call is already in progress. </code></pre> <p>I read this to mean that MS crippled System.Net.Mail to prevent mass-mailers. Is this correct? If so, is there a better way to do this in .NET, and still be able to log the results of each email(which is important to our client). If not, why can SendAsync only be called once?</p>
[ { "answer_id": 389726, "author": "Gant", "author_id": 12460, "author_profile": "https://Stackoverflow.com/users/12460", "pm_score": 2, "selected": false, "text": "XXXAsync XXXReceived Thread" }, { "answer_id": 1364338, "author": "kntcnrg", "author_id": 125376, "author...
2008/12/23
[ "https://Stackoverflow.com/questions/389709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47225/" ]
389,710
<p>XAML:</p> <pre><code>&lt;ToolBarTray Name="tlbTray" ButtonBase.Click="tlbTray_Click"&gt; &lt;ToolBar Name="tlbFile"&gt; &lt;Button Name="btnOpen"&gt;&lt;Image Source="images\folder.png" Stretch="None" /&gt;&lt;/Button&gt; &lt;Button Name="btnSave"&gt;&lt;Image Source="images\disk.png" Stretch="None" /&gt;&lt;/Button&gt; &lt;/ToolBar&gt; &lt;/ToolBarTray&gt; </code></pre> <p>Code:</p> <pre><code>private void tlbTray_Click(object sender, RoutedEventArgs e) { // How to get the name of the button or control that triggered the event } </code></pre> <p>As commented in the method. How do I get the name of the button or control that triggered the event. Or I'm handling this the wrong way? I just want to route all click events to that one method and decide what to do from there...</p> <p>Thanks! ;-)</p>
[ { "answer_id": 389733, "author": "Nate", "author_id": 3413, "author_profile": "https://Stackoverflow.com/users/3413", "pm_score": 1, "selected": false, "text": "Button test = (Button)sender;\nif(test.Name==\"btnOpen\")\n{\n //Do something\n}\n" }, { "answer_id": 389773, "aut...
2008/12/23
[ "https://Stackoverflow.com/questions/389710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2172/" ]
389,737
<p>I have a Database table that I want to display in a DataGridView. However, it has several foreign keys and I don't want to show the integer that represents the other Table to the user.</p> <p>I have this DataTable with a column userId I have another DataTable with a column id, and a column username</p> <p>I want the DataGridView to show the username instead of userId where the userId = id.</p> <p>How can I do this? I also have to do this on several columns in the same table to be displayed.</p> <p>edit: windows forms, not web forms.</p>
[ { "answer_id": 389769, "author": "Eduardo Crimi", "author_id": 48132, "author_profile": "https://Stackoverflow.com/users/48132", "pm_score": 1, "selected": false, "text": "List<YourClass>" }, { "answer_id": 389774, "author": "Dillie-O", "author_id": 71, "author_profil...
2008/12/23
[ "https://Stackoverflow.com/questions/389737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12243/" ]
389,738
<p>I'm working on a web app (ASP.NET) that has some features that require Microsoft Excel installed on the client. I'd like to disable those features if Excel is not present. </p> <p>Windows/IE/Excel only solutions are fine. This is not a multi-browser, multi-OS web app.</p> <p>Any clever JavaScript out there to accomplish this?</p>
[ { "answer_id": 389777, "author": "D'Arcy Rittich", "author_id": 39430, "author_profile": "https://Stackoverflow.com/users/39430", "pm_score": 2, "selected": false, "text": "<script>\nvar excelInstalled;\ntry \n{\n var excel = new ActiveXObject(\"Excel.Application\");\n excelInstall...
2008/12/23
[ "https://Stackoverflow.com/questions/389738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44091/" ]
389,741
<p>I saw this keyword for the first time and I was wondering if someone could explain to me what it does.</p> <ul> <li>What is the <code>continue</code> keyword?</li> <li>How does it work?</li> <li>When is it used?</li> </ul>
[ { "answer_id": 389744, "author": "Diomidis Spinellis", "author_id": 20520, "author_profile": "https://Stackoverflow.com/users/20520", "pm_score": 10, "selected": true, "text": "continue while do for if continue while (getNext(line)) {\n if (line.isEmpty() || line.isComment())\n conti...
2008/12/23
[ "https://Stackoverflow.com/questions/389741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33911/" ]
389,743
<p>I need to limit the jquery ui date picker to only have future Tuesdays and Thursdays as selectable days. </p> <p>How can I accomplish this?</p>
[ { "answer_id": 389756, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "$(\"div.selector\").datepicker({ \n onSelect: function(dateText) { \n alert(dateText);\n } \n})\n $(\".selector\")....
2008/12/23
[ "https://Stackoverflow.com/questions/389743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40149/" ]
389,759
<p>What is the easiest way to use post-commit hook with VisualSVN Server to export from the repository to a directory for staging / testing after a developer commits his changes?</p>
[ { "answer_id": 393160, "author": "Stefan", "author_id": 48003, "author_profile": "https://Stackoverflow.com/users/48003", "pm_score": 1, "selected": false, "text": "path\\to\\svn.exe export file:///%1/trunk path\\to\\where\\you\\want\\to\\export\\to\n .bat .cmd .bat cmd.exe /C path\\to\\...
2008/12/23
[ "https://Stackoverflow.com/questions/389759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
389,761
<p>What is the best method to determine if the current time is AM or PM using VB.NET?</p> <p>Currently I'm using If Date.Today.ToString.Contains("AM") but I'm sure there is a better method.</p> <pre><code>Good &lt;%If Date.Today.ToString.Contains("AM") Then Response.Write("Morning") Else Response.Write("Afternoon")%&gt; </code></pre>
[ { "answer_id": 389765, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 5, "selected": true, "text": "If Date.Now.Hour < 12 Then" }, { "answer_id": 389771, "author": "Colby Africa", "author_id": 47164, ...
2008/12/23
[ "https://Stackoverflow.com/questions/389761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
389,763
<p>I know that <a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/" rel="nofollow noreferrer">CodeRush Xpress</a> is intended to be used on VS 2008 and not on VS 2005.<br> But since I can't migrate to VS2008 yet, I want to install it on VS2005 and don't care it's not supposed to work.<br></p> <p>My base assumption is that it can be done, this is based on the fact that the rest of the free re factoring products from DevExpress do work on VS 2005.</p>
[ { "answer_id": 586303, "author": "Alex Shnayder", "author_id": 26042, "author_profile": "https://Stackoverflow.com/users/26042", "pm_score": 4, "selected": true, "text": "Windows Registry Editor Version 5.00\n[HKEY_LOCAL_MACHINE\\SOFTWARE\\Developer Express]\n[HKEY_LOCAL_MACHINE\\SOFTWAR...
2008/12/23
[ "https://Stackoverflow.com/questions/389763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26042/" ]
389,767
<p>I'm reading the book "LINQ Pocket Reference" and there is a particular example (slightly modified below) that I'm having difficulty getting my head around... The explanation in the book is a bit brief, so I was wondering if someone could break it down step-by-step for me so that it makes sense...</p> <pre><code> IEnumerable&lt;char&gt; query2 = "Not what you might expect"; foreach (char vowel in "aeiou") { var t = vowel; query2 = query2.Where(c =&gt; c != t); // iterate through query and output (snipped for brevity) } </code></pre> <p>Outputs this:</p> <pre> Not wht you might expect Not wht you might xpct Not wht you mght xpct Nt wht yu mght xpct Nt wht y mght xpct </pre> <p>Which makes perfect sense to me... However, this does not.</p> <pre><code> IEnumerable&lt;char&gt; query2 = "Not what you might expect"; foreach (char vowel in "aeiou") { query2 = query2.Where(c =&gt; c != vowel); // iterate through query and output (snipped for brevity) } </code></pre> <pre> Not wht you might expect Not what you might xpct Not what you mght expect Nt what yu might expect Not what yo might expect </pre> <p>which doesn't...</p> <p>Can someone give me a better explanation of exactly what is going on here? </p>
[ { "answer_id": 389780, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": true, "text": "IEnumerable<char> query2 = \"Not what you might expect\";\nChar t1 = 'a'; query2 = query2.Where(c => c != t1);\nChar t...
2008/12/23
[ "https://Stackoverflow.com/questions/389767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40410/" ]