qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
419,702
<p>I see in MSDN links such as "CompareOrdinal Overloads". How can I write such a link in C#?</p> <p>I tried:</p> <pre><code>&lt;seealso cref="MyMethod"&gt;MyMethod Overloads&lt;/seealso&gt; </code></pre> <p>But the compiler gives me a warning about being an ambiguous reference for the method which has other overloads.</p> <p>(Beginner question: do I actually need to write this tag to link to the overloads, or is it automatically generated by documentation processors?)</p>
[ { "answer_id": 419711, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "/// <seealso cref=\"Foo(int)\"/>\nstatic void Foo() { }\n/// <seealso cref=\"Foo()\"/>\n/// <seealso cref=\"Foo(float...
2009/01/07
[ "https://Stackoverflow.com/questions/419702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41283/" ]
419,707
<p>Can anyone find a constant in the .NET framework that defines the number of days in a week (7)?</p> <pre><code>DateTime.DaysInAWeek // Something like this??? </code></pre> <p>Of course I can define my own, but I'd rather not if it's somewhere in there already.</p> <h2>Update:</h2> <p>I am looking for this because I need to allow the user to select a week (by date, rather than week number) from a list in a DropDownList.</p>
[ { "answer_id": 419721, "author": "tanathos", "author_id": 51295, "author_profile": "https://Stackoverflow.com/users/51295", "pm_score": 3, "selected": false, "text": "Enum.GetNames(System.DayOfWeek).Length\n" }, { "answer_id": 419732, "author": "MSalters", "author_id": 15...
2009/01/07
[ "https://Stackoverflow.com/questions/419707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39709/" ]
419,710
<p>I have a <code>UIImageView</code> that is displaying an image that is wider and taller than the <code>UIImageView</code> is. I would like to pan the image within the view using an animation (so that the pan is nice and smooth).</p> <p>It seems to me that I should be able to just adjust the <code>bounds.origin</code> of the <code>UIImageView</code>, and the image should move (because the image should paint inside the view with that as <strong>its</strong> origin, right?) but that doesn't seem to work. The <code>bounds.origin</code> changes, but the image draws in the same location.</p> <p>What almost works is to change the <code>contentsRect</code> of the view's layer. But this begins as a unit square, even though the viewable area of the image is not the whole image. So I'm not sure how I would detect that the far edge of the image is being pulled into the viewable area (which I need to avoid, since it displays by stretching the edge out to infinity, which looks, well, sub-par).</p> <p>My view currently has its <code>contentsGravity</code> set to <code>kCAGravityTopLeft</code> via Interface Builder, if that makes a difference (Is it causing the image to move?). No other options seemed to be any better, though.</p> <p>UPDATE: to be clear, I want to move the image <strong>inside</strong> the view, while keeping the view in the same spot.</p>
[ { "answer_id": 421646, "author": "Brad Larson", "author_id": 19679, "author_profile": "https://Stackoverflow.com/users/19679", "pm_score": 6, "selected": false, "text": "UIImageView UIScrollView UIImageView UIScrollView UIImageView's window UIScrollView scrollRectToVisible:animated: show...
2009/01/07
[ "https://Stackoverflow.com/questions/419710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5657/" ]
419,714
<p>I have set my Visual Studio to start Nunit as an external program to run all the tests written in a module. </p> <p>Now what I am trying to do is to create a batch file which will call Myproj.exe. What I am expecting is that it will run Nunit as I have set it to run an external program and execute all my tests in nunit.exe, but when I run that batch file it starts running from Visual Studio instead of opening NUnit.</p> <p>Can any one please give me a clear idea as how to accomplish it? </p> <p>I am too much stuck. </p> <hr> <p>Now I am trying to run the following commands in shell</p> <p>nunit-x86.exe Can you please tell how should I load my visualbasic project file (exe) here and then run all the tests from here as unable to execute following command</p> <pre><code>nunit nunit.tests.vbproj /config:release </code></pre>
[ { "answer_id": 641543, "author": "JeffH", "author_id": 73826, "author_profile": "https://Stackoverflow.com/users/73826", "pm_score": 1, "selected": false, "text": "nunit-console /xml:$(ProjectName).xml $(TargetPath)\n nunit $(TargetPath) /run\n" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/419714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
419,718
<p>Seemingly simple, but I cannot find anything relevant on the web.</p> <p>What is the correct HTML code for an apostrophe? Is it <code>&amp;#8217;</code>?</p>
[ { "answer_id": 419722, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 5, "selected": false, "text": "&apos; &#39;" }, { "answer_id": 419728, "author": "Recep", "author_id": 51771, "author_profile": "ht...
2009/01/07
[ "https://Stackoverflow.com/questions/419718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
419,738
<p>I have an application which makes decisions based on part of URL:</p> <pre><code> if ( isset($this-&gt;params['url']['url']) ) { $url = $this-&gt;params['url']['url']; $url = explode('/',$url); $id = $this-&gt;Provider-&gt;getProviderID($url[0]); $this-&gt;providerName = $url[0]; //set the provider name return $id; } </code></pre> <p>This happens to be in a cake app so $this->params['url'] contains an element of URL. I then use the element of the URL so decide which data to use in the rest of my app. My question is...</p> <p>whats the best way to secure this input so that people can't pass in anything nasty?</p> <p>thanks, </p>
[ { "answer_id": 421952, "author": "neilcrookes", "author_id": 9968, "author_profile": "https://Stackoverflow.com/users/9968", "pm_score": 2, "selected": true, "text": "Router::connect('/:provider/:controller/:action');\n $html->link('label', array(\n 'controller' => 'xxx',\n 'action' =>...
2009/01/07
[ "https://Stackoverflow.com/questions/419738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69346/" ]
419,769
<p>I have an asp.net page, some of its controls are created dynamically, these controls are one of the following; textbox, calendar, or dropdownlist.</p> <p>These controls in some cases, should be validated based on flag read from db?</p> <blockquote> <p>Is there any way to validate dynamically created controls?</p> </blockquote>
[ { "answer_id": 506904, "author": "Ahmed Atia", "author_id": 14118, "author_profile": "https://Stackoverflow.com/users/14118", "pm_score": 1, "selected": true, "text": "txtBox.Attributes.Add(\"Type\", \"T\"); // Type of control.\ntxtBox.Attributes.Add(\"IsKeyField\", \"Y\"); // Is dynamic...
2009/01/07
[ "https://Stackoverflow.com/questions/419769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14118/" ]
419,774
<p>If you put a DataGridView that is 400 pixels high on a panel that's 300 pixels high, so that there's a scroll bar on the panel, then scroll down so that the lower half of the grid is shown, then click on a control outside the panel, then click on a line in the grid, the panel scrolls up to the top and the wrong row in the grid is selected.</p> <p>It's not just a DataGridView; it happens with any control that's higher than the panel, eg Infragistics UltraWinGrid, Rich Text Box. I raised it as a bug with Infragistics, but they say it's a Microsoft issue.</p> <p>I've tried using all the relevant events for the controls, but the Panel scroll happens before the events fire.</p> <p>Any suggestions?</p>
[ { "answer_id": 421321, "author": "BlackWasp", "author_id": 21862, "author_profile": "https://Stackoverflow.com/users/21862", "pm_score": 3, "selected": true, "text": "private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)\n{\n panel1.VerticalScroll.Value = vScrollBar1.Value...
2009/01/07
[ "https://Stackoverflow.com/questions/419774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
419,775
<p>I am developing an application for video recording and I want to overlay the video preview with a logo and recording timer.</p> <p>I tried to run the full-screen application and everything worked fine. Then I tried to run the application as a regular Windows application and it returned an error.</p> <p>Could anyone take a look at the code below if there's a way to modify it to run the application as a regular Windows app?</p> <pre><code>HRESULT CViewfinderRenderer::OnStartStreaming() { HRESULT hr = S_OK; DDSURFACEDESC ddsd; m_pDD = NULL; //full screen settings hr = DirectDrawCreate(NULL, &amp;m_pDD, NULL); hr = m_pDD-&gt;SetCooperativeLevel(m_hWnd, DDSCL_FULLSCREEN); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE; ddsd.dwBackBufferCount = 1; //end full screen settings //normal settings /*hr = DirectDrawCreate(NULL, &amp;m_pDD, NULL); hr = m_pDD-&gt;SetCooperativeLevel(m_hWnd, DDSCL_NORMAL); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_BACKBUFFERCOUNT; ddsd.dwBackBufferCount = 1;*/ //end normal settings hr = m_pDD-&gt;CreateSurface(&amp;ddsd, &amp;m_pSurface, NULL); if (hr != DD_OK) { return hr; } // Get backsurface hr = m_pSurface-&gt;EnumAttachedSurfaces(&amp;m_pBackSurface, EnumFunction); return S_OK; } </code></pre>
[ { "answer_id": 421321, "author": "BlackWasp", "author_id": 21862, "author_profile": "https://Stackoverflow.com/users/21862", "pm_score": 3, "selected": true, "text": "private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)\n{\n panel1.VerticalScroll.Value = vScrollBar1.Value...
2009/01/07
[ "https://Stackoverflow.com/questions/419775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22996/" ]
419,796
<p>It seems to me that explicitly specifying serialVersionUID for new classes is bad. Consider the two cases of not changing it when layout has it should have been changed and changing it when it should not have.</p> <p>Not changing when it should have been changed occurs almost only when it is explicit. In this case, it results in some very subtle, hard-to-find bugs. Especially during development, when class layout changes often. But if it has not been explicitly specified, it will change and the deserialization will break loudly, mostly likely solved by purging the repository.</p> <p>Changing it when should not have would occur almost only when it is implicit. This is the rare case where class layout has changed but we still want to deserialize from the old serialized blobs. This will likely be caught during QA (<em>Strange errors after upgrade from 5.2 to 5.2.1, see attached stack trace</em>) and can be trivially fixed by setting a explicit value.</p> <p>Comments?</p>
[ { "answer_id": 419808, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 2, "selected": false, "text": "serialVersionUID" }, { "answer_id": 420083, "author": "Tom Hawtin - tackline", "author_id": 4725, ...
2009/01/07
[ "https://Stackoverflow.com/questions/419796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18573/" ]
419,800
<p>i'm currently using File::Basename fileparse to separate out a file's directory, base file name and it's extension using something like this:</p> <pre><code>my($myfile_name,$mydirectory, $file_extension) = fileparse($$rhash_params{'storage_full_path_location'},'\..{1,4}'); </code></pre> <p>But see that there's a variation where you can actually provide a array of suffixes to the function, the array would contains all the known file extension.</p> <p>So i'm trying to find a safe way to do this as i've seen that i've got some strange file names to process, i.e. file.0f1.htm, etc.</p> <h2>Question:</h2> <ol start="2"> <li>Is there a list of commonly used extension for Windows and Unix systems? But in my case it's mainly for Windows. </li> <li>And is it safe to assume that all file names in Windows should have an extension ending with three letter characters?</li> </ol> <p>And if there's an even better way to do this, please share.</p> <p>Thanks.</p> <h2>Updates:</h2> <p>So obviously i must be drunk to forgot about those other extension. :) Thus i've updated the current regex to allow from 1-4chars.</p> <p>In this case, how should i change my regex line to properly match it? Or is it an even better idea to look for all those commonly used extension from google and put them into an array to be passed to the function instead? My users are usually either students or teachers.</p>
[ { "answer_id": 419814, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 3, "selected": true, "text": "1 2 '.c' '.java'" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/419800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38124/" ]
419,804
<p>I have taken a liking to jQuery/Javascript's way of extending functionality via closures. Is it possible to do something similar in PHP 5.3?</p> <pre><code>class Foo { public $bar; } $foo = new Foo; $foo-&gt;bar = function($baz) { echo strtoupper($baz); }; $foo-&gt;bar('lorem ipsum dolor sit amet'); // LOREM IPSUM DOLOR SIT AMET </code></pre> <p>[edit] mixed up 'it' and 'is' in my question. heh.</p> <h1>UPDATE</h1> <p>I downloaded 5.3a3 and it does work!</p> <pre><code>class Foo { protected $bar; public $baz; public function __construct($closure) { $this-&gt;bar = $closure; } public function __call($method, $args) { $closure = $this-&gt;$method; call_user_func_array($closure, $args); } } $foo = new Foo(function($name) { echo "Hello, $name!\n"; }); $foo-&gt;bar('Mon'); // Hello, Mon! $foo-&gt;baz = function($s) { echo strtoupper($s); }; $foo-&gt;baz('the quick brown fox jumps over the lazy dog'); // THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG </code></pre>
[ { "answer_id": 419883, "author": "Tom Haigh", "author_id": 22224, "author_profile": "https://Stackoverflow.com/users/22224", "pm_score": 1, "selected": false, "text": "create_function() $func = create_function('$baz', ' echo strtoupper($baz); ');\n$func(\"hello\");\n $foo = new Foo;\n$fo...
2009/01/07
[ "https://Stackoverflow.com/questions/419804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31003/" ]
419,810
<p>Here's what I'm seeing: I have a conditional-get caching policy in place (cache-control: private, must-revalidate).</p> <p>It works fine if I'm on the page, then try to hit the browser's refresh button.</p> <p>However, in another part of my site, I use location.replace(url) to go to that page... if I do that, its not makign that check and always retrieving the cached version.</p> <p>Any tips on what might be wrong here?</p>
[ { "answer_id": 419883, "author": "Tom Haigh", "author_id": 22224, "author_profile": "https://Stackoverflow.com/users/22224", "pm_score": 1, "selected": false, "text": "create_function() $func = create_function('$baz', ' echo strtoupper($baz); ');\n$func(\"hello\");\n $foo = new Foo;\n$fo...
2009/01/07
[ "https://Stackoverflow.com/questions/419810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
419,811
<p>What is a quick example / demo of an msbuild task to delete then restore a database and also maybe run any .sql files against the restored database?</p>
[ { "answer_id": 419864, "author": "bh213", "author_id": 28912, "author_profile": "https://Stackoverflow.com/users/28912", "pm_score": 2, "selected": false, "text": "$Server = new-object (\"Microsoft.SqlServer.Management.Smo.Server\") $ServerName\n$Database = new-object (\"Microsoft.SqlSer...
2009/01/07
[ "https://Stackoverflow.com/questions/419811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6440/" ]
419,833
<p>I have a list of jar files, all containing slightly different versions of the same system.</p> <p>I want to execute a set of test cases on each jar file while being able to obtain the results for each jar (via RunListener or something like that).</p> <p>I am a bit confused with the class loading problems that are implied.</p> <p>How can I nicely do this ?</p>
[ { "answer_id": 419861, "author": "Yoni Roit", "author_id": 34161, "author_profile": "https://Stackoverflow.com/users/34161", "pm_score": 0, "selected": false, "text": "URLClassloader ucl = new URLClassLoader( list of jars from version1 );\nTestCase tc = ucl.loadClass(\"Your Test Case\")....
2009/01/07
[ "https://Stackoverflow.com/questions/419833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41315/" ]
419,844
<p>In a lot of my PHP projects, I end up with classes that have non-public functions that I don't intend to extend.</p> <p>Is it best to declare these as protected, or private?</p> <p>I can see arguments both ways - making them private is a far more conservative approach, but it can be argued that they could be made protected later if I want the method to be extended and it makes it clear which methods are extended by base classes.</p> <p>On the other hand, is using private somehow antisocial, in that it impedes a theoretical future developer from extending my code without modification?</p>
[ { "answer_id": 429863, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 2, "selected": false, "text": "private" }, { "answer_id": 1184292, "author": "Peter Hagström", "author_id": 145257, "author_profile"...
2009/01/07
[ "https://Stackoverflow.com/questions/419844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34024/" ]
419,850
<p>I'm writing a Java client application to receive live M-JPEG video from an IP camera. The video is sent by the camera as an endless multipart HTTP message where each part is a single JPEG frame. I need to process each of these frames as they arrive, so I'm hoping there's a way to make an HTTP request that asynchronously triggers an event as each message part/video frame is received.</p> <p>Is anyone aware of any libraries that can do this? All the examples I can find on Google won't work because they use blocking calls that only parse the response and break it up into parts after the entire response has finished being received (which obviously won't work for an endless response).</p> <p>I realise I could manually break up the data into parts as it arrives by searching for the message boundary but it just feels like I would be reinventing the wheel.</p>
[ { "answer_id": 5890128, "author": "Maurice Perry", "author_id": 72673, "author_profile": "https://Stackoverflow.com/users/72673", "pm_score": 0, "selected": false, "text": "com.sun.net.httpserver" }, { "answer_id": 73532923, "author": "Younes El Ouarti", "author_id": 3705...
2009/01/07
[ "https://Stackoverflow.com/questions/419850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52386/" ]
419,858
<p>How can I deep copy an irregularly shaped 2D array in Java?</p> <p>Ie.</p> <pre><code>int[][] nums = {{5}, {9,4}, {1,7,8}, {8,3,2,10}} </code></pre> <p>I'm unable to use <code>Arrays.arrayCopy()</code> for some reason (versioning?)</p>
[ { "answer_id": 419887, "author": "Joao da Silva", "author_id": 46329, "author_profile": "https://Stackoverflow.com/users/46329", "pm_score": 4, "selected": false, "text": "int[][] copy = new int[nums.length][];\n\nfor (int i = 0; i < nums.length; i++) {\n copy[i] = new int[nums[i].len...
2009/01/07
[ "https://Stackoverflow.com/questions/419858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33033/" ]
419,859
<p>Is it possible to open an iPhone application or an Xcode project from the terminal? I have already tried:</p> <p><code>open /path/to/project.app</code></p> <p>But this returns a warning and quits unexpectedly due to an image load error when it launches the simulator. Does anyone have any suggestions?</p>
[ { "answer_id": 419965, "author": "Jason Coco", "author_id": 34218, "author_profile": "https://Stackoverflow.com/users/34218", "pm_score": 3, "selected": true, "text": "xcodebuild /path/to/project.app/Contents/MacOS/project $ /path/to/project/Foo.app/Contents/MacOS/Foo" }, { "answ...
2009/01/07
[ "https://Stackoverflow.com/questions/419859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
419,868
<p>The following code will not run correctly in IE7 with the latest service packs installed.</p> <pre><code>System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Disposition", "attachment;filename=Contacts.xls"); response.ContentType = "application/octet-stream"; System.Text.UnicodeEncoding Encoding = new System.Text.UnicodeEncoding(); byte[] unicodeBytes = {255,254}; int length = 2 + Encoding.GetByteCount(_exportContent); // _exportContent is string. response.AddHeader("Content-Length", length.ToString()); response.OutputStream.Write(unicodeBytes, 0, 2); unicodeBytes = Encoding.GetBytes(_exportContent); response.OutputStream.Write(unicodeBytes, 2, unicodeBytes.Length); response.End(); </code></pre> <p>I am opening the aspx page with js (window.open()) and execute the above code in the Page_Load().</p> <p>The strange thing is that the window pops up, tries to load/show the file dialog and then you hear the sound like a popup window has been blocked (although popup blocker is deactivated!).</p> <p>Extra information:<br> - The behavior happens both on XP and W2k3 (which is a real web server without anything else installed but IE7 &amp; FW 3.5 SP1 &amp; latest service packs.) - The same code works fine with FW 2.0 - Firefox has no problems to display a file dialog.</p> <p>I would be curious if anyone else has ran into the same problem and could provide a solution for getting the thing working in IE7.</p> <p>Cheers,<br> Dimi</p>
[ { "answer_id": 436331, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": " Response.Clear();\n\n Response.ClearHeaders();\n Response.ClearContent();\n\n Res...
2009/01/07
[ "https://Stackoverflow.com/questions/419868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52039/" ]
419,878
<p>I have an object that is generated in one class</p> <pre><code>public class CreatingClass { public T CreateObject&lt;T&gt;(Dictionary&lt;string, object&gt; parameters) where T : IMyInterface, new() { .... } public void DestroyObject(IMyInterface objectToDestroy) { .... } } </code></pre> <p>I call this function from a client class, then at times need to nullify it through my application by the creating class.</p> <p>Can I do something like the following</p> <pre><code>public class ClientClass { MyObject obj; CreatingClass creatingClass = new CreatingClass(); private void AFunctionToCreateMyClass() { obj = creatingClass.CreateObject&lt;MyClass&gt;(parameters); } private void AFunctionToDeleteMyObject() { CreatingClass.DestroyObject(obj); Assert.IsNull(obj);//Doesn't fail } } </code></pre> <p>I had tried objectToDestroy = null, but didn't think it would work (and it didn't)</p>
[ { "answer_id": 419888, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 3, "selected": false, "text": "public void DestroyClass(ref IMyInterface objectToDestroy)\n{\n ....\n objectToDestroy = null;\n}\n" }, {...
2009/01/07
[ "https://Stackoverflow.com/questions/419878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
419,900
<p>How do you implement this in CodeIgniter?</p>
[ { "answer_id": 9091002, "author": "Guilherme", "author_id": 1181924, "author_profile": "https://Stackoverflow.com/users/1181924", "pm_score": 0, "selected": false, "text": "$this->session->sess_expiration = 500000;\n" }, { "answer_id": 33222188, "author": "falselight", "a...
2009/01/07
[ "https://Stackoverflow.com/questions/419900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26721/" ]
419,908
<p>How to get the text of selected item from a drop down box element in html forms? (using python) How can I store the value to a variable, when I select one item from the drop down box using mouse? (ie. without using a submit button)</p> <p>This is for a application which I am doing in app engine which only supports Python.</p>
[ { "answer_id": 420004, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 5, "selected": true, "text": "submit action onchange <select name='myfield' onchange='this.form.submit()'>\n<option .... >\n...\n</select>\n</form>\n" }...
2009/01/07
[ "https://Stackoverflow.com/questions/419908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52393/" ]
419,954
<p>I have following Code Block Which I tried to optimize in the Optimized section</p> <pre><code>DataSet dsLastWeighing = null; DataSet ds = null; DataSet dsWeight = null; string strQuery = string.Empty; string strWhere = string.Empty; Database db = null; #region Original Code Block try { db = DatabaseFactory.CreateDatabase(); strWhere = "WHERE SESSION_ID = '"+pSessionID+"'"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("DeleteWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); strWhere = "WHERE LAB_ID = 0"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("InsertWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); strWhere = strWhere = "WHERE SESSION_ID = '"+pSessionID+"'"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("GetPatientID",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); ds = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strQuery); foreach(DataRow dr in ds.Tables[0].Rows) { if (db.ToString() == "Microsoft.Practices.EnterpriseLibrary.Data.SqlBase.SqlBaseDatabase") { strWhere = "WHERE LAB_ID=0 AND PAT_ID ="+ int.Parse(dr["PAT_ID"].ToString())+" AND WHEN IN(SELECT MAX(WHEN) FROM PATIENT_LAB WHERE LAB_ID=0 AND PAT_ID="+ int.Parse(dr["PAT_ID"].ToString())+")"; } else if (db.ToString() == "Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase") { strWhere = "WHERE LAB_ID=0 AND PAT_ID ="+ int.Parse(dr["PAT_ID"].ToString())+" AND [WHEN] IN(SELECT MAX([WHEN]) FROM PATIENT_LAB WHERE LAB_ID=0 AND PAT_ID="+ int.Parse(dr["PAT_ID"].ToString())+")"; } strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("GetWeight",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); strMain.append(strQuery+" "); dsWeight = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strQuery); foreach(DataRow drWeight in dsWeight.Tables[0].Rows) { strWhere = "WHERE PAT_ID = "+int.Parse(dr["PAT_ID"].ToString())+" AND SESSION_ID ='"+pSessionID+"'"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("UpdateWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,decimal.Parse(drWeight["LEVEL"].ToString()),DateTime.Parse(drWeight["WHEN"].ToString()).ToUniversalTime(),int.Parse(drWeight["IS_BAD"].ToString()),drWeight["NOTE"].ToString()); db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); } } strWhere = " ORDER BY W.IS_BAD DESC, P.LASTNAME ASC, P.FIRSTNAME ASC,P.MIDDLENAME ASC"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("GetPatientLastWeight",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); dsLastWeighing = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strQuery); } catch(Exception ex) { throw ex; } finally { db = null; ds= null; dsWeight= null; } return dsLastWeighing; #endregion --Optimized Section-- #region Optimized Code Block try { StringBuilder strMain=new StringBuilder(); db = DatabaseFactory.CreateDatabase(); //StartTime=DateTime.Now.ToLongTimeString(); strWhere = "WHERE SESSION_ID = '"+pSessionID+"'"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("DeleteWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); //EndTime=DateTime.Now.ToLongTimeString(); //db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); strMain.append(strQuery+" "); strWhere = "WHERE LAB_ID = 0"; //StartTime=DateTime.Now.ToLongTimeString(); strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("InsertWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); //EndTime=DateTime.Now.ToLongTimeString(); //db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); strMain.append(strQuery+" "); strWhere = strWhere = "WHERE SESSION_ID = '"+pSessionID+"'"; //StartTime=DateTime.Now.ToLongTimeString(); strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("GetPatientID",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); //EndTime=DateTime.Now.ToLongTimeString(); //ds = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strQuery); strMain.append(strQuery+" "); //StartTime=DateTime.Now.ToLongTimeString(); ds = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strMain.ToString()); //EndTime=DateTime.Now.ToLongTimeString(); strMain=null; foreach(DataRow dr in ds.Tables[0].Rows) { //StartTime=DateTime.Now.ToLongTimeString(); if (db.ToString() == "Microsoft.Practices.EnterpriseLibrary.Data.SqlBase.SqlBaseDatabase") { strWhere = "WHERE LAB_ID=0 AND PAT_ID ="+ int.Parse(dr["PAT_ID"].ToString())+" AND WHEN IN(SELECT MAX(WHEN) FROM PATIENT_LAB WHERE LAB_ID=0 AND PAT_ID="+ int.Parse(dr["PAT_ID"].ToString())+")"; } else if (db.ToString() == "Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase") { strWhere = "WHERE LAB_ID=0 AND PAT_ID ="+ int.Parse(dr["PAT_ID"].ToString())+" AND [WHEN] IN(SELECT MAX([WHEN]) FROM PATIENT_LAB WHERE LAB_ID=0 AND PAT_ID="+ int.Parse(dr["PAT_ID"].ToString())+")"; } strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("GetWeight",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); strMain.append(strQuery+" "); //EndTime=DateTime.Now.ToLongTimeString(); //dsWeight = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strQuery); /* foreach(DataRow drWeight in dsWeight.Tables[0].Rows) { strWhere = "WHERE PAT_ID = "+int.Parse(dr["PAT_ID"].ToString())+" AND SESSION_ID ='"+pSessionID+"'"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("UpdateWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,decimal.Parse(drWeight["LEVEL"].ToString()),DateTime.Parse(drWeight["WHEN"].ToString()).ToUniversalTime(),int.Parse(drWeight["IS_BAD"].ToString()),drWeight["NOTE"].ToString()); db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); } */ } dsWeight = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strMain.ToString()); strMain=null; //StartTime=DateTime.Now.ToLongTimeString(); for(int i=0;i&lt;dsWeight.Tables.Count;i++) { foreach(DataRow drWeight in dsWeight.Tables[i].Rows) { strWhere = "WHERE PAT_ID = "+int.Parse(dr["PAT_ID"].ToString())+" AND SESSION_ID ='"+pSessionID+"'"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("UpdateWeightRecent",db.ToString(),pFacilityID,pSessionID,strWhere,decimal.Parse(drWeight["LEVEL"].ToString()),DateTime.Parse(drWeight["WHEN"].ToString()).ToUniversalTime(),int.Parse(drWeight["IS_BAD"].ToString()),drWeight["NOTE"].ToString()); strMain.append(strQuery+" "); //db.ExecuteNonQuery(System.Data.CommandType.Text, strQuery); } } db.ExecuteNonQuery(System.Data.CommandType.Text, strMain.ToString()); //EndTime=DateTime.Now.ToLongTimeString(); //StartTime=DateTime.Now.ToLongTimeString(); strWhere = " ORDER BY W.IS_BAD DESC, P.LASTNAME ASC, P.FIRSTNAME ASC,P.MIDDLENAME ASC"; strQuery = SQ.BusinessLogic.SQLQueryFactory.GetPatientLastWeighing("GetPatientLastWeight",db.ToString(),pFacilityID,pSessionID,strWhere,0,DateTime.Now.ToUniversalTime(),0,""); dsLastWeighing = (DataSet) db.ExecuteDataSet(System.Data.CommandType.Text, strQuery); //EndTime=DateTime.Now.ToLongTimeString(); } catch(Exception ex) { throw ex; } finally { db = null; ds= null; dsWeight= null; } return dsLastWeighing; #endregion </code></pre> <p>Can This Further be optimized .. Just concentrate on minimizing the loops.. I am not getting any ideas further..Any Help would be appreciated</p>
[ { "answer_id": 419970, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 0, "selected": false, "text": "strMain.append(strQuery+\" \");\n strMain.append(new StringBuilder().append(strQuery).append(\" \").toString());\n" }, {...
2009/01/07
[ "https://Stackoverflow.com/questions/419954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
419,966
<p>I want to create a parallel object oriented system in QNX using c++ and threads. How do I do this?</p> <p>I tried:</p> <pre><code>pthread_t our_thread_id; pthread_create(&amp;our_thread_id, NULL, &amp;functionA ,NULL); </code></pre> <p>with function A being a pointer to a function:</p> <pre><code>void *functionA() { //do something } </code></pre> <p>However this function only works in C and not C++. How can I make it work in C++?</p>
[ { "answer_id": 420024, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 2, "selected": false, "text": "class Thread {\npublic:\n int Create()\n {\n return pthread_create(&m_id, NULL, start_routine_trampolin...
2009/01/07
[ "https://Stackoverflow.com/questions/419966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
419,967
<p>I'm wanting to test that a class has an EventHandler assigned to an event. Basically I'm using my IoC Container to hook up EventHandlers for me, and I'm wanting to check they get assigned properly. So really, I'm testing my IoC config.</p> <pre><code>[Test] public void create_person_event_handler_is_hooked_up_by_windsor() { IChangePersonService changePersonService = IoC.Resolve&lt;IChangePersonService&gt;(); // check that changePersonService.PersonCreated has a handler attached } </code></pre> <p>I'm not sure how to test that changePersonService.PersonCreated has anything attached to it though.</p> <p>Any ideas?</p> <p>Thanks.</p>
[ { "answer_id": 419983, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 0, "selected": false, "text": "IChangePersonService" }, { "answer_id": 420291, "author": "bruno conde", "author_id": 31136, "autho...
2009/01/07
[ "https://Stackoverflow.com/questions/419967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12459/" ]
419,977
<p>Aparently, encoding japanese emails is somewhat challenging, which I am slowly discovering myself. In case there are any experts (even those with limited experience will do), can I please have some guidelines as to how to do it, how to test it and how to verify it?</p> <p>Bear in mind that I've never set foot anywhere near Japan, it is simply that the product I'm developing is used there, among other places.</p> <p>What (I think) I know so far is following:<br> - Japanese emails should be encoded in ISO-2022-JP, Japanese JIS codepage 50220 or possibly SHIFT_JIS codepage 932<br> - Email transfer encoding should be set to Base64 for plain text and 7Bit for Html<br> - Email subject should be encoded separately to start with "=?ISO-2022-JP?B?" (don't know what this is supposed to mean). I've tried encoding the subject with </p> <pre><code>"=?ISO-2022-JP?B?" + Convert.ToBase64String(Encoding.Unicode.GetBytes(subject)) </code></pre> <p>which basically gives the encoded string as expected but it doesn't get presented as any japanese text in an email program<br> - I've tested in Outlook 2003, Outlook Express and GMail </p> <p>Any help would be greatly appreciated</p> <hr> <p>Ok, so to post a short update, thanks to the two helpful answers, I've managed to get the right format and encoding. Now, Outlook gives something that resembles the correct subject:<br> <code>=?iso-2022-jp?B?6 Japanese test に各々の視点で語ってもらった。 6相当の防水?=</code></p> <p>However, the exact same email in Outlook Express gives subject like this:<br> <code>=?iso-2022-jp?B?6 Japanese test 縺ォ蜷・・・隕也せ縺ァ隱槭▲縺ヲ繧ゅi縺」縺溘・ 6逶ク蠖薙・髦イ豌エ?=</code></p> <p>Furthermore, when viewed in the Inbox view in Outlook Express, the email subject is even more weird, like this:<br> <code>=?iso-2022-jp?B?6 Japanese test ??????????????? 6???????=</code></p> <p>Gmail seems to be working in the similar fashion to Outlook, which looks correct.</p> <p>I just can't get my head around this one.</p>
[ { "answer_id": 450353, "author": "liggett78", "author_id": 19762, "author_profile": "https://Stackoverflow.com/users/19762", "pm_score": 0, "selected": false, "text": "Encoding.GetEncoding(\"ISO-2022-JP\")" }, { "answer_id": 450386, "author": "Community", "author_id": -1,...
2009/01/07
[ "https://Stackoverflow.com/questions/419977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21692/" ]
419,979
<p>In Visual Studio 2003, I am trying to set an environment variable in the pre-build event that will then be used in the compilation step, but the value doesn't seem to be propagated. For example, if the pre-build event contains this (either directly or within a batch file):</p> <pre><code>set MY_LIB_VERSION=1.0.0 </code></pre> <p>and AdditionalIncludeDirectories has this:</p> <pre><code>c:\path\to\library\my_lib_v$(MY_LIB_VERSION)\include </code></pre> <p>then I would expect the compilation to work if the <code>my_lib_v1.0.0</code> directory exists. But instead, I get</p> <pre> c:\path\to\prog\my_prog.c(22) : fatal error C1083: Cannot open include file: 'my_lib.h' Project : warning PRJ0018 : The following environment variables were not found: $(MY_LIB_VERSION) </pre> <p>I deduce that the environment variable set in the pre-build event therefore isn't being propagated to the compilation step, but I may be missing something.</p> <p><strong>How can I set the environment variable in the pre-build event and use it in the compilation step?</strong></p> <p>(Alternatively, any other sensible ways of defining a library version once and using it several times for AdditionalIncludeDirectories and AdditionalLibraryDirectories would do just as well.)</p> <hr> <p><strong>Update</strong>: I ended up solving our problem in a different way. We are using Subversion, and set up the <code>svn:externals</code> property on a subdirectory of the project source called <code>dependencies</code>, such that a checkout of the project would additionally check out <code>&lt;svn_path&gt;\libraries\my_lib_v1.0.0</code> and call it <code>dependencies\my_lib</code> in the working copy. Then the project settings could refer to <code>dependencies\my_lib\include</code> and suchlike. Upgrading to version 1.0.1 of <code>my_lib</code> is then simply a matter of editing the <code>svn:externals</code> property -- the code and project settings did not need to change.</p>
[ { "answer_id": 420011, "author": "Timo Geusch", "author_id": 29068, "author_profile": "https://Stackoverflow.com/users/29068", "pm_score": 3, "selected": false, "text": "REM\nREM Set up VS environment with defaults (this is for 2008) - need to do this first\nREM\ncall \"C:\\Program Files...
2009/01/07
[ "https://Stackoverflow.com/questions/419979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5536/" ]
419,980
<p>How to change the row position of virtual mode DataGridView?</p> <p>I am using <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow noreferrer">Windows Forms</a>.</p>
[ { "answer_id": 429003, "author": "codeConcussion", "author_id": 1321, "author_profile": "https://Stackoverflow.com/users/1321", "pm_score": 3, "selected": true, "text": "dgv.CurrentCell = dgv.Rows[0].Cells[0];\n dgv.CurrentCell = null;\n" }, { "answer_id": 968707, "author": "...
2009/01/07
[ "https://Stackoverflow.com/questions/419980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11432/" ]
420,022
<p>Is there something wrong with this code?<br> Sometimes I get an unhandled "Invalid transaction object" exception in it:</p> <pre><code>procedure BlaBla; var TD: TDBXTransaction; begin TD := SQLConnection.BeginTransaction; try SQLConnection.ExecuteDirect('some sql command'); SQLConnection.ExecuteDirect('some sql command'); SQLConnection.CommitFreeAndNil(TD); except SQLConnection.RollbackFreeAndNil(TD); end; end; </code></pre> <p>This exception is being raised to the user, so I assume it's raised by RollbackFreeAndNil, since all rest is inside a try..except.</p> <p>Should I wrap RollbackFreeAndNil with another try..except? What a mess.</p> <p>I'm using Delphi 2009, DBX with Firebird 2.1 and Devart's driver.</p>
[ { "answer_id": 420424, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 2, "selected": false, "text": "procedure BlaBla;\nvar\n TD: TDBXTransaction;\nbegin\n TD := SQLConnection.BeginTransaction;\n try\n SQLConnectio...
2009/01/07
[ "https://Stackoverflow.com/questions/420022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089/" ]
420,031
<p>My application heavily uses the UIImage object to change images on a single UIImageView based on user input and the previous image which was set. I use [UIImage imageNamed:] to create my UIImage objects.</p> <p>I guess this is not the best way to use UIImage coz my memory usage keeps increasing with time and never drops. (Got to know this when I ran the app with Object Allocations and moreover there are no other NSString variables I am using, only BOOL and UIImage)</p> <p>How should I effectively use UIImage and UIImageView objects to keep the memory low?</p> <p>Thanks</p>
[ { "answer_id": 420098, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": true, "text": "[UIImage imageNamed:] \n NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];\nNSDa...
2009/01/07
[ "https://Stackoverflow.com/questions/420031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46297/" ]
420,035
<p>Is there any way how to run the setup.exe bootstrapper generated by VS2008 with .NET 2.0 WinForms application on Windows 2000 SP4? If I try to run it, it gives me an error message about missing HeapSetInformation in Kernel32.dll and it doesn't run.</p> <p>I tried to install manually Windows Installer 3.1 and also .NET 2.0 Framework, but the setup.exe still shows the same error message. I have to use Setup.msi directly to install my app on Windows 2000. Is the bootstrapper limited to be used only on XP and higher?</p> <p>It runs OK on Windows XP.</p>
[ { "answer_id": 420098, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": true, "text": "[UIImage imageNamed:] \n NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];\nNSDa...
2009/01/07
[ "https://Stackoverflow.com/questions/420035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20353/" ]
420,057
<p>Does anyone know where I can go to find the results of usability testing of widely used software? </p> <p>I want to be able to make informed decisions about: </p> <ul> <li>which bits of existing packages to copy in my software</li> <li>how to choose between multiple packages (programs, components, etc). </li> </ul> <p>Really, I would be grateful for anything here.<br> I'm interested in: websites, office software, email clients, you name it.<br> I want objective, empirical information about what's good and what's not in specific instances. </p> <p>This question is inspired by <a href="https://stackoverflow.com/questions/416766/is-markdown-friendly-enough-for-non-technical-users#416905">my answer</a> to <a href="https://stackoverflow.com/questions/416766/is-markdown-friendly-enough-for-non-technical-users">this question about markdown</a>. </p>
[ { "answer_id": 420098, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": true, "text": "[UIImage imageNamed:] \n NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];\nNSDa...
2009/01/07
[ "https://Stackoverflow.com/questions/420057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7211/" ]
420,058
<p>How do I copy a symbolic link (and not the file it points to) in a Perl program while preserving all of the symbolic link attributes (such as owner and permissions)?</p>
[ { "answer_id": 420080, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 4, "selected": true, "text": "readlink() lstat() stat() lchown() Lchown use Lchown;\n my $old_link = 'path to the symlink';\n my $new_link = 'path to the ...
2009/01/07
[ "https://Stackoverflow.com/questions/420058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46635/" ]
420,059
<p>I have a legacy application in our company built on... ahem; Classic VB (VB 6). It has got a optimizer(CPLEX MIP Solver) component running on a Linux server and is developed in Java.</p> <p>If we want to provide a Windows UI to invoke the optimizer instance on a remote linux server; how should I implement it?</p> <p>The optimizer will pump out messages about its progress and it needs to be displayed on the UI.</p> <p>I thought of two options as of now.</p> <ol> <li>Invoke the linux process with PLINK. Not sure whether it can bring STDOUT to windows.</li> <li>Build a small java app and load it as a daemon on the linux server and communicate over TCP.</li> </ol> <p>Would appreciate expert advise. Thank for the helping hand!</p>
[ { "answer_id": 420153, "author": "dsm", "author_id": 7780, "author_profile": "https://Stackoverflow.com/users/7780", "pm_score": 0, "selected": false, "text": "system()" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52406/" ]
420,064
<p>When searching in SharePoint the results are returned to a page called OSSSearchResults.aspx.</p> <p>This page has a scope dropdown for the search i.e. Site:Departments</p> <p>How can I remove this scope so that the whole site collection is always searching, irrespective of the site I am within?</p> <p>All the best</p>
[ { "answer_id": 432968, "author": "Øyvind Skaar", "author_id": 49194, "author_profile": "https://Stackoverflow.com/users/49194", "pm_score": 0, "selected": false, "text": "\\12\\TEMPLATE\\LAYOUTS\\osssearchresults.aspx <SPSWC:SearchBoxEx id=\"SearchBox\" runat=\"server\" \n GoIma...
2009/01/07
[ "https://Stackoverflow.com/questions/420064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12318/" ]
420,065
<p>I would like to develop cross-platform applications using C++ and QT4. I code on both Linux and Windows (MinGW).</p> <p>Currently I'm using KDevelop and it's QMake integration. On Windows I'm trying out Eclipse with QT integration plugin. However moving sources and updating profiles/IDE project files on both systems is tedious.</p> <p>I'm looking into using CMake as it can generate Makefiles, KDevelop project files and Eclipse project files.</p> <p>What's your opinion? What are you using for such kind of development?</p>
[ { "answer_id": 420266, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 2, "selected": false, "text": "qt-apps.org environment tools kde-apps.org environment tools" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5731/" ]
420,067
<p>I need to bind the column Header text of a DataGrid to a Resource string in a XAML file. Does anybody know if this is possible ?</p> <p>The column Header definition looks like this but I would like to replace the "MyHeaderText" with text from a resource file:-</p> <pre><code>&lt;data:DataGridTextColumn Header="MyHeaderText" Binding="{Binding SomeData}" IsReadOnly="True"/&gt; </code></pre> <p>The Resource string would be set up in the UserControl.Resources section.</p>
[ { "answer_id": 420317, "author": "Sorskoot", "author_id": 31722, "author_profile": "https://Stackoverflow.com/users/31722", "pm_score": 0, "selected": false, "text": "<data:DataGridTextColumn Header=\"{StaticResource SomeData}\" \n IsReadOnly=\"True\"/>\n" }, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52408/" ]
420,076
<p>I am trying to get a description in a XUL application to wrap, even if it contains long lines.</p> <p>For example, if I save the following as a .xul file and open it in Firefox, it looks fine and wraps appropriately:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;?xml-stylesheet href="chrome://global/skin/" type="text/css"?&gt; &lt;window id="theWindow" title="The Window" style="overflow: auto;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" &gt; &lt;vbox flex="1" style="max-width: 200px; overflow:auto; border: 1px dotted black; padding: 2px;"&gt; &lt;description style="border: 1px solid black; padding: 2px;"&gt;test&lt;/description&gt; &lt;description style="border: 1px solid black; padding: 2px;"&gt;test test test test test test test test test test test test test test test test test test test test test&lt;/description&gt; &lt;/vbox&gt; &lt;/window&gt; </code></pre> <p>However, if I remove the spaces in the big line, it doesn't get wrapped and I just get a scroll bar to see the line:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;?xml-stylesheet href="chrome://global/skin/" type="text/css"?&gt; &lt;window id="theWindow" title="The Window" style="overflow: auto;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" &gt; &lt;vbox flex="1" style="max-width: 200px; overflow:auto; border: 1px dotted black; padding: 2px;"&gt; &lt;description style="border: 1px solid black; padding: 2px;"&gt;test&lt;/description&gt; &lt;description style="border: 1px solid black; padding: 2px;"&gt;testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest&lt;/description&gt; &lt;/vbox&gt; &lt;/window&gt; </code></pre> <p>Is there any way I can use CSS or anything else to force the long line to be wrapped when it reaches the 200 pixel limit? </p>
[ { "answer_id": 436417, "author": "Muxecoid", "author_id": 50194, "author_profile": "https://Stackoverflow.com/users/50194", "pm_score": 3, "selected": true, "text": "<br />" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20925/" ]
420,095
<p>The trouble here is that I can't declare variables inside a function after the function already has some statements in it. Declaring at the start works fine, but after something, it gives a parse error. For example:</p> <pre><code>int main() { int b; b = sisesta(); float st[b]; return 0; } </code></pre> <p>I'd like to declare an array <code>st</code> with its size being returned by another function, but it won't let me do it! Says "Parse error before float". This is in C by the way, but I guess its identical to what it would be in other languages with the same syntax.</p> <p>Any help appreciated.</p>
[ { "answer_id": 420124, "author": "Tamas Czinege", "author_id": 8954, "author_profile": "https://Stackoverflow.com/users/8954", "pm_score": 3, "selected": false, "text": "-std=c99" }, { "answer_id": 420169, "author": "dsm", "author_id": 7780, "author_profile": "https:/...
2009/01/07
[ "https://Stackoverflow.com/questions/420095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,099
<pre><code>#include&lt;iostream&gt; class name { public: int a; name():a(0){}; }; void add(name * pname) { pname = NULL; } int main() { name varName(); name * pName = new name(); add(pName); add(&amp;varName);//error C2664: 'add' : cannot convert parameter 1 from 'name __cdecl *)(void)' to 'name *' } </code></pre>
[ { "answer_id": 420113, "author": "MiniQuark", "author_id": 38626, "author_profile": "https://Stackoverflow.com/users/38626", "pm_score": 5, "selected": false, "text": "name varName();\n name varName;\n" }, { "answer_id": 420120, "author": "Daniel Paull", "author_id": 4306...
2009/01/07
[ "https://Stackoverflow.com/questions/420099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
420,103
<p>For a POST method, the W3 specs say:</p> <blockquote> <p>If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see Section 10.4).</p> </blockquote> <p><a href="http://www.ietf.org/internet-drafts/draft-ietf-httpbis-p2-semantics-05.txt" rel="noreferrer">http://www.ietf.org/internet-drafts/draft-ietf-httpbis-p2-semantics-05.txt</a> (section 8.5)</p> <p>The standard response actually seems to be to send a Redirect to the newly created resource.</p> <p>I'm building my site with ASP.NET MVC, and tried to follow the spec, so created a <code>ResourceCreatedResult</code> class:</p> <pre><code>public class ResourceCreatedResult : ActionResult { public string Location { get; set; } public override void ExecuteResult(ControllerContext context) { context.HttpContext.Response.Clear(); context.HttpContext.Response.StatusCode = 201; context.HttpContext.Response.ClearHeaders(); context.HttpContext.Response.AddHeader("Location", Location); } } </code></pre> <p>And my action looks something like this:</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] public ActionResult CreateNew(string entityStuff) { Entity newEntity = new Entity(entityStuff); IEntityRepository entityRepository = ObjectFactory.GetInstance&lt;IEntityRepository&gt;(); entityRepository.Add(newEntity); ActionResult result = new ResourceCreatedResult() { Location = Url.Action("Show", new { id = newEntity.Id }) }; return result; } </code></pre> <p>However, IE, Firefox and Chrome all fail to redirect to the new resource. Have I messed up generating the correct response, or do web browsers not expect this type of response, instead relying on servers to send a Redirect response?</p>
[ { "answer_id": 677271, "author": "dthrasher", "author_id": 19112, "author_profile": "https://Stackoverflow.com/users/19112", "pm_score": 4, "selected": false, "text": "HTTP 201: Created HTTP 303: See Other" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50136/" ]
420,118
<p>I want to make a bookmark of my webpage by using javascript code. I want a javascript code to make a bookmark that should be opened in a new window.</p> <p>I am using firefox. </p>
[ { "answer_id": 420139, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 2, "selected": false, "text": "function bookmark_us(url, title){\nif (window.sidebar) // firefox\n window.sidebar.addPanel(title, url, \"\");\ne...
2009/01/07
[ "https://Stackoverflow.com/questions/420118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,136
<p>I've got the following piece of code in an aspx webpage:</p> <pre><code>Response.Redirect("/Someurl/"); </code></pre> <p>I also want to send a different referrer with the redirect something like:</p> <pre><code>Response.Redirect("/Someurl/", "/previousurl/?message=hello"); </code></pre> <p>Is this possible in Asp.net or is the referrer handled solely by the browser?</p> <p>Cheers Stephen</p>
[ { "answer_id": 420177, "author": "Recep", "author_id": 51771, "author_profile": "https://Stackoverflow.com/users/51771", "pm_score": 3, "selected": true, "text": "Response.Redirect(\"/Someurl/\");\n Response.Redirect(\"/Someurl/?message=hello\");\n" }, { "answer_id": 420200, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
420,140
<p>On my java project, I have a bunch of strings externalized on a <code>messages.properties</code> file. On its respective <code>Messages.java</code> file I had the same number of public static String-typed attributes, so I could access those externalized texts. </p> <p>Then, I implemented a method called <code>getString</code>, which receives the name of the constant as its argument and returns the wanted text. This way, there is no need to declare all the public static Strings-typed attributes inside the <code>Messages.java</code> file.</p> <p>But after doing this my log became filled with "<em>NLS unused message</em>" messages.</p> <p>Do you know if there's a way to prevent those warning messages to be logged?</p> <p>Thanks in advance.</p>
[ { "answer_id": 420221, "author": "jamesh", "author_id": 4737, "author_profile": "https://Stackoverflow.com/users/4737", "pm_score": 3, "selected": false, "text": "Messages org.eclipse.osgi.util.NLS Message.staticVariable staticVariable Messages.java messages.properties getString()" }, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/431/" ]
420,143
<p>I'd like to use git to record all the changes to a file. </p> <p>Is there a way I can turn git 'commit' on to automatically happen every time a file is updated - so there is a new commit for every change to a file?</p> <p>Ideally I'd like my users to not even know that git is running behind the scenes. A user could then potentially "undo" changes to a file - and this could be achieved by pulling a previous version out of git.</p>
[ { "answer_id": 420172, "author": "JesperE", "author_id": 13051, "author_profile": "https://Stackoverflow.com/users/13051", "pm_score": 8, "selected": true, "text": "inotifywait -q -m -e CLOSE_WRITE --format=\"git commit -m 'autocommit on change' %w\" file.txt | sh\n" }, { "answer...
2009/01/07
[ "https://Stackoverflow.com/questions/420143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52416/" ]
420,151
<p>I would like to write an simple application able to retrieve some certain data from another process(application)'s allocated memory.</p> <p>Say I already know a process' id and I would like to obtain a value in this process' memory always from a fixed offset (like 0x523F1C), is this doable in the user-mode, or it has to be in kernel-mode?</p> <p>Any hints or info are highly appreciated.</p> <p>My environment is Windows XP, and I am using Visual C++ and Qt for GUI. </p> <p>Thanks in advance :)</p> <p>EDIT:</p> <p>(a) thanks guys. basically it's working (when setting a break point and hook over the value it's correct), but when doing a normal release build the value obtained is always the initialized :(</p> <p>will have to work more to figure it out...</p> <p>(b) Since the application I am trying to obtain value from isn't written by me, can I still do the interprocess communications / shared memory techniques?</p> <p>EDIT 2:</p> <p>thanks again for the quick response! :D</p>
[ { "answer_id": 420176, "author": "James Ogden", "author_id": 3198, "author_profile": "https://Stackoverflow.com/users/3198", "pm_score": 4, "selected": true, "text": "BOOL WINAPI ReadProcessMemory(\n __in HANDLE hProcess,\n __in LPCVOID lpBaseAddress,\n __out LPVOID lpBuffer,\n ...
2009/01/07
[ "https://Stackoverflow.com/questions/420151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52415/" ]
420,154
<p>In Visual&nbsp;Studio&nbsp;2005, how can I save what's written to the output window to a file (I can't change the code writing to the output window, and it writes a lot; I just want to save the output window content to a file)?</p>
[ { "answer_id": 420231, "author": "StingyJack", "author_id": 16391, "author_profile": "https://Stackoverflow.com/users/16391", "pm_score": 0, "selected": false, "text": "c:\\>dir > out.txt\n" }, { "answer_id": 31928196, "author": "Shabbir Hussain", "author_id": 1055869, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,162
<p>I need to execute an entire javascript function.</p> <p>Found what I was doing wrong:</p> <pre><code>var edit = igedit_getById("FG2100RefNo"); var editText = edit.getText(); alert(!isNaN(editText)); </code></pre> <p>But, this only checks &amp; displays a message box.</p> <p>I need to execute the below javascript:</p> <pre><code>&lt;script language=Javascript&gt; &lt;!-- function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57)) return false; return true; } //--&gt; </code></pre> <p></p> <pre><code>onkeypress="return isNumberKey(event)" </code></pre> <p><strong>How can I do this with the webtextedit:</strong> </p> <pre><code>var edit = igedit_getById("FG2100RefNo"); var editText = edit.getText(); function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57)) return false; return true; } return isNumberKey(editText) </code></pre> <p>I only have the <code>onkey</code> event property value to insert the code. </p>
[ { "answer_id": 420231, "author": "StingyJack", "author_id": 16391, "author_profile": "https://Stackoverflow.com/users/16391", "pm_score": 0, "selected": false, "text": "c:\\>dir > out.txt\n" }, { "answer_id": 31928196, "author": "Shabbir Hussain", "author_id": 1055869, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,185
<p>I need to get the version information of a DLL file I created in Visual&nbsp;Studio&nbsp;2008 C++. How do I get it?</p>
[ { "answer_id": 420314, "author": "Adam Oren", "author_id": 44521, "author_profile": "https://Stackoverflow.com/users/44521", "pm_score": 6, "selected": true, "text": "WCHAR fileName[_MAX_PATH];\nDWORD size = GetModuleFileName(g_dllHandle, fileName, _MAX_PATH);\nfileName[size] = NULL;\nDW...
2009/01/07
[ "https://Stackoverflow.com/questions/420185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44521/" ]
420,223
<p>What is the difference between Java's <code>compare()</code> and <code>compareTo()</code> methods? Do those methods give same answer?</p>
[ { "answer_id": 420228, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 4, "selected": false, "text": "compareTo() Comparable compare() Comparator compareTo()" }, { "answer_id": 420236, "author": "Abgan", "...
2009/01/07
[ "https://Stackoverflow.com/questions/420223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,237
<p>I’ve used the asp.net login control on my sharepoint custom master page. All works well and I can login to my site without problems. </p> <p>However I’d like to run some code once the user has logged, or alternatively perform a redirect based on the user’s role.</p> <p>Has anyone does this type of thing before?</p>
[ { "answer_id": 420228, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 4, "selected": false, "text": "compareTo() Comparable compare() Comparator compareTo()" }, { "answer_id": 420236, "author": "Abgan", "...
2009/01/07
[ "https://Stackoverflow.com/questions/420237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46108/" ]
420,261
<p>I have to use a smart pointer and I found "shared_ptr" from boost looks good. I downloaded the boost library and I can see many files and libraries there. Is there any way to use only the shared_ptr ?</p>
[ { "answer_id": 420277, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "boost bcp" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50419/" ]
420,275
<p>I'm coding in C# and I have a dictionary with tons of data. One of the members is "children" but when I try to write out its values, I get: System.Object[]</p> <p>I know that children contains data, probably nested data, but I'm unsure if it's a list, dictionary, array, etc.</p> <p>How do I write out all the data within "children"?</p>
[ { "answer_id": 420283, "author": "flq", "author_id": 51428, "author_profile": "https://Stackoverflow.com/users/51428", "pm_score": 2, "selected": false, "text": "foreach (object o in children)\n Console.WriteLine(o != null ? o.GetType().FullName : \"null\");\n" }, { "answer_id":...
2009/01/07
[ "https://Stackoverflow.com/questions/420275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,278
<p>Right now I'm using exec to redirect stderr to an error log with</p> <pre><code>exec 2&gt;&gt; ${errorLog} </code></pre> <p>The only downside is that I have to start each run with a timestamp since exec just pushes the text straight into the log file. Is there a way to redirect stderr but allow me to append text to it, such as a time stamp?</p>
[ { "answer_id": 420735, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": " foo() { while IFS='' read -r line; do echo \"$(date) $line\" >> file.txt; done; };\n exec 2> >(foo)\n" },...
2009/01/07
[ "https://Stackoverflow.com/questions/420278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204/" ]
420,294
<p>I'm trying to get the exact equivalent (not functional) of this vb.net code in F#:</p> <pre><code>Function FastPow(ByVal num As Double, ByVal exp As Integer) As Double Dim res As Double = 1 If exp &lt; 1 Then If exp = 0 Then Return res exp = -exp num = 1 / num End If Do While exp &gt; 1 If exp Mod 2 = 1 Then res = res * num num = num * num exp = exp &gt;&gt; 1 Loop Return res * num End Function </code></pre> <p>I wrote this:</p> <pre><code>let FastPow num exp = let mutable ex = exp let mutable res = 1 let mutable n = num if ex &lt; 1 then if ex = 0 then res ex &lt;- -ex n &lt;- 1 / n while ex &gt; 1 do if (ex % 2 = 1) then res &lt;- res * n n &lt;- n * n exp &gt;&gt;&gt; 1 res * n </code></pre> <p>but in the line "if ex = 0 then res" at res I got an error:<br> "This expression has type int but is here used with type unit". I cannot understand why it gives me that error.<br> Edit: i actually got a warning as well:<br> "This expression should have type 'unit', but has type 'int'."<br> at "if (ex % 2 = 1) then"</p>
[ { "answer_id": 420375, "author": "zendar", "author_id": 25732, "author_profile": "https://Stackoverflow.com/users/25732", "pm_score": 0, "selected": false, "text": "then ex >>> 1\n\nshould be\n\nex <- ex >>> 1\n let FastPow num exp =\n let calcExp num exp = \n let mutable res =...
2009/01/07
[ "https://Stackoverflow.com/questions/420294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38561/" ]
420,295
<p>We have a number of PDFs hosted using Lighttpd but when they are downloaded in IE (7.0.5730.13), the file download hangs at the end and does not complete. For example</p> <p><a href="http://static.vouchercodes.co.uk/printable/87-burger-king-voucher.pdf" rel="nofollow noreferrer">http://static.vouchercodes.co.uk/printable/87-burger-king-voucher.pdf</a></p> <p><a href="http://static.vouchercodes.co.uk/printable/10-gbk.pdf" rel="nofollow noreferrer">http://static.vouchercodes.co.uk/printable/10-gbk.pdf</a></p> <p>This works fine in Firefox (3.0.5) both on OSX 10.5 and Windows XP but not on IE 7.</p> <p>A screenshot of the hung download can be seen at <a href="http://www.mytton.net/so-pdf-q.png" rel="nofollow noreferrer">http://www.mytton.net/so-pdf-q.png</a></p> <p>This is not localised to one machine and has been replicated on other IE7 Windows PCs. The problem affects only the PDFs on the vouchercodes.co.uk site as other sites with PDFs work fine.</p> <p>It has also been replicated with other versions of IE7/IE6 but not consistently.</p>
[ { "answer_id": 420385, "author": "WiseTechi", "author_id": 52374, "author_profile": "https://Stackoverflow.com/users/52374", "pm_score": 2, "selected": false, "text": "HTTP/1.1 206 Partial Content" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2183/" ]
420,299
<p>I have a table that has a list of restaurant names and links to another table that holds the cuisine type.</p> <p>I want to provide a search box on my web page that when typing, each word is searched for in the database and results returned. I was looking for a solution that doesn't involve setting up sql full text search as I want to be able to test this using Linq to SQL.</p> <p>From my old code I have a function which creates a query filter given the input text and returns all the results based on that.</p> <pre><code>Private Function SetupQuery(ByVal searchText As String) As String Dim searchFields As New List(Of String) searchFields.Add("Name") searchFields.Add("Postcode") searchFields.Add("Cuisine") Dim firstCol As Boolean = True Dim a() As String Dim j As Integer a = searchText.Trim.Split(" ") Dim filter As String = "" Dim compareString As String For Each col As String In searchFields For j = 0 To a.GetUpperBound(0) compareString = a(j).ToUpper() compareString = compareString.Trim() If firstCol Then filter = filter &amp; col &amp; " LIKE '" &amp; compareString &amp; "%' " firstCol = False Else filter = filter &amp; " or " &amp; col &amp; " LIKE '" &amp; compareString &amp; "%' " End If Next Next Return filter End Function </code></pre> <p>This has the search fields hard coded and then loops through each one and each word in the search text to construct an OR LIKE filter.</p> <p>I'm sure I could then use this in my LINQ code but it doesn't seem like an elegant solution especially since the columns are hard coded and not used how LINQ uses them.</p> <p>Could anyone recomend a better way to do this or some tips in what direction to go with this? </p> <p>Thanks</p>
[ { "answer_id": 421131, "author": "Noah", "author_id": 47496, "author_profile": "https://Stackoverflow.com/users/47496", "pm_score": 0, "selected": false, "text": "from t in temp\nwhere t.Name == a(0)\n|| t.Postcode == a(1)\n|| t.Cuisine == a(2)\nselect t\n" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33054/" ]
420,300
<p>The following does not work in this particular case, complaining that whatever you give it is not a character.</p> <pre><code>(handler-bind ((sb-int:character-coding-error #'(lambda (c) (invoke-restart 'use-value #\?)))) (sb-ext:octets-to-string *euc-jp* :external-format :euc-jp))</code></pre> <p>Where <code>*euc-jp*</code> is a variable containing binary of EUC-JP encoded text.</p> <p>I have tried <code>#\KATAKANA_LETTER_NI</code> as well, instead of #\? and also just "". Nothing has worked so far.</p> <p>Any help would be greatly appreciated!</p> <p>EDIT: To reproduce <code>*EUC-JP*</code>, fetch <a href="http://blogs.yahoo.co.jp/akira_w0325/27287392.html" rel="nofollow noreferrer">http://blogs.yahoo.co.jp/akira_w0325/27287392.html</a> using drakma.</p>
[ { "answer_id": 422068, "author": "Matthias Benkard", "author_id": 15517, "author_profile": "https://Stackoverflow.com/users/15517", "pm_score": 0, "selected": false, "text": "CL-USER> (handler-bind ((sb-int:character-coding-error\n #'(lambda (c)\n ...
2009/01/07
[ "https://Stackoverflow.com/questions/420300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52433/" ]
420,304
<p>Does anyone know how to maintain text formatting when using XPath to extract data?</p> <p>I am currently extracting all blocks</p> <p><code> &lt;div class="info"&gt; &lt;h5&gt;title&lt;/h5&gt; text &lt;a href="somelink"&gt;anchor&lt;/a&gt; &lt;/div&gt; </code></p> <p>from a page. The problem is when I access the nodeValue, I can only get plain text. How can I capture the contents including formatting, i.e. the h5 and a still in the code?</p> <p>Thanks in advance. I have searched every combination imaginable on Google and no luck.</p>
[ { "answer_id": 420323, "author": "Ciaran McNulty", "author_id": 34024, "author_profile": "https://Stackoverflow.com/users/34024", "pm_score": 3, "selected": true, "text": "$string = $dom->saveXml($element);\n" }, { "answer_id": 420328, "author": "Glen Solsberry", "author_...
2009/01/07
[ "https://Stackoverflow.com/questions/420304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,310
<p>Using Amazon's own <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=552&amp;categoryID=187" rel="nofollow noreferrer">client libraries</a> (or <a href="http://code.google.com/p/typica/" rel="nofollow noreferrer">alternatives</a>), you can get listings of available pre-packaged AMIs, but the interface is definitely designed for scriptability, not readability. <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609" rel="nofollow noreferrer">Elasticfox</a> is better, but still doesn't make it easy to see what an AMI <em>does</em>, allow for user rating, etc.</p> <p>Is there a centralised place for me to easily find AMIs for specific purposes? AMIs for Apache, OpenMQ, MySQL, that sort of thing?</p>
[ { "answer_id": 420323, "author": "Ciaran McNulty", "author_id": 34024, "author_profile": "https://Stackoverflow.com/users/34024", "pm_score": 3, "selected": true, "text": "$string = $dom->saveXml($element);\n" }, { "answer_id": 420328, "author": "Glen Solsberry", "author_...
2009/01/07
[ "https://Stackoverflow.com/questions/420310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29903/" ]
420,315
<p>I was wondering why we use the terms "push" and "pop" for adding/removing items from stacks? Is there some physical metaphor that caused those terms to be common?</p> <p>The only suggestion I have is something like a <a href="http://www.istockphoto.com/file_thumbview_approve/2645114/2/istockphoto_2645114_9mm_handgun_magazine.jpg" rel="noreferrer">spring-loaded magazine for a handgun</a>, where rounds are "pushed" into it and can be "popped" out, but that seems a little unlikely.</p> <p>A second stack trivia question: Why do most CPUs implement the call stack as growing <strong>downwards</strong> in memory, rather than upwards? </p>
[ { "answer_id": 420397, "author": "joel.neely", "author_id": 3525, "author_profile": "https://Stackoverflow.com/users/3525", "pm_score": 3, "selected": false, "text": "+---+---+-------- -------+--+--+--+\n| | | -> ... <- | | | |\n+---+---+-------- -------+--+--+--+\n^ ...
2009/01/07
[ "https://Stackoverflow.com/questions/420315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737/" ]
420,319
<p>How do I run stylecop against an iis based webproject on a buildserver? Buildserver runs in continuous integration and I would like this automated.</p> <p>With a library I can add a few lines to the .csproj and its done. I believe it to be a website application project. </p>
[ { "answer_id": 420397, "author": "joel.neely", "author_id": 3525, "author_profile": "https://Stackoverflow.com/users/3525", "pm_score": 3, "selected": false, "text": "+---+---+-------- -------+--+--+--+\n| | | -> ... <- | | | |\n+---+---+-------- -------+--+--+--+\n^ ...
2009/01/07
[ "https://Stackoverflow.com/questions/420319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39643/" ]
420,337
<p>I'm concerned about the third parameter in this overload, validateImageData. The documentation doesn't explain much about it, it only states that it causes the image data to be validated but no details, what exactly is done to validate the image data?</p> <pre><code>public static Image FromStream ( Stream stream, bool useEmbeddedColorManagement, bool validateImageData ) </code></pre> <p>I want to use this in a web application, so, I want to know what exactly will happen if I set validateImageData to true, I want to be sure that what the user uploads is a valid image, is it recommended to set validateImageData to true or is it enough to catch the exception if one is thrown? Also, can setting validateImageData to true affect the performance in any way? (users can upload images up to 250k in size)</p> <p>Thanks</p>
[ { "answer_id": 420475, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 4, "selected": false, "text": "if (validateImageData)\n{\n num = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, zero));\n if...
2009/01/07
[ "https://Stackoverflow.com/questions/420337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/676066/" ]
420,343
<p>I think it's better to release the version of the software which your developers actually tested; I therefore tend to delete the 'debug' target from the project/makefile, so that there's only one version that can be built (and tested, and debugged, and released).</p> <p>For a similar reason, I don't use 'assertions' (see also <a href="https://stackoverflow.com/questions/419406/are-assertions-always-bad#419410">Are assertions always bad?</a> ...).</p> <p>One person there argued that the reason for a 'debug' version is that it's easier to debug: but, I counter-argued that you may eventually want to support and debug whatever it is you released, and so you need to build a release which you can if necessary debug ... this may mean enabling debug symbols, and disabling some optimizations, even in the 'release' build.</p> <p>Someone else said that "this is such a bad idea"; it's a policy I evolved some years ago, having been burned by:</p> <ul> <li>Some developers' testing their debug but not release versions</li> <li>Some developers' writing bugs which show up only in the release version</li> <li>The company's releasing the release version after inadequate testing (is it <strong>ever</strong> entirely adequate?)</li> <li>Being called on to debug the release version</li> </ul> <p>Since then I've seen more than one other development shop follow this practice (i.e. not have separate debug and release builds).</p> <p>What's your policy?</p>
[ { "answer_id": 420363, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 1, "selected": false, "text": "#define" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49942/" ]
420,350
<ul> <li><p>environment: linux, userspace-application created via g++ from a couple of C++ files (result is an ELF)</p></li> <li><p>there is a problem (SIGSEGV) when traversing the constructor list </p></li> </ul> <pre> ( __CTOR_LIST__ ) </pre> <p>(note: code called via this list is a kind of system initialisation for every class, <em>not</em> the constructor-code I wrote)</p> <ul> <li>when I understand correctly every compilation unit (every .o created from a .cpp) creates one entry in</li> </ul> <pre> __CTOR_LIST__ </pre> <ul> <li><p>the problem (SIGSEGV) does not exist when I step via GDB through the program</p></li> <li><p>for debugging this I'm looking for an way to add own code code <strong>before</strong> the call of </p></li> </ul> <pre> "_do_global_ctors_aux" </pre> <p>any hints for this ?</p> <p>thanks,</p> <p>Uwe</p>
[ { "answer_id": 420402, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 1, "selected": false, "text": "x y x y" }, { "answer_id": 420414, "author": "Johannes Schaub - litb", "author_id": 34509, "au...
2009/01/07
[ "https://Stackoverflow.com/questions/420350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,352
<p>With <code>:limit</code> in query, I will get first N records. What is the easiest way to get last N records?</p>
[ { "answer_id": 420415, "author": "Dan McNevin", "author_id": 50924, "author_profile": "https://Stackoverflow.com/users/50924", "pm_score": 8, "selected": true, "text": "Record.last(N) User.last(5) Something.find(:all, :order => \"id desc\", :limit => 5).reverse\n result = Something.find(...
2009/01/07
[ "https://Stackoverflow.com/questions/420352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30958/" ]
420,362
<p>Can someone explain the syntax in the source attribute here? What the heck is "pack:" and "application:" and why 3 commas? I couldn't find any decent desciptions.</p>
[ { "answer_id": 420415, "author": "Dan McNevin", "author_id": 50924, "author_profile": "https://Stackoverflow.com/users/50924", "pm_score": 8, "selected": true, "text": "Record.last(N) User.last(5) Something.find(:all, :order => \"id desc\", :limit => 5).reverse\n result = Something.find(...
2009/01/07
[ "https://Stackoverflow.com/questions/420362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47118/" ]
420,380
<p>I am wondering why the link to profile looks like: </p> <pre><code>http://stackoverflow.com/users/ID/NAME </code></pre> <p>not simply:</p> <pre><code>http://stackoverflow.com/users/ID </code></pre> <p>or even better:</p> <pre><code>http://stackoverflow.com/users/NAME </code></pre> <p>Can there be couple users with the same name? Or can one user have many names?</p>
[ { "answer_id": 420392, "author": "Ole", "author_id": 49540, "author_profile": "https://Stackoverflow.com/users/49540", "pm_score": 2, "selected": false, "text": "http://stackoverflow.com/users/37086/othername" }, { "answer_id": 420418, "author": "Arne Burmeister", "author...
2009/01/07
[ "https://Stackoverflow.com/questions/420380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37086/" ]
420,386
<p>I'm trying to create a DataGridTableStyle object so that I can control the column widths of a DataGrid. I've created a BindingSource object bound to a List. Actually it's bound to an anonymous type list created though Linq in the following manner (variable names changed for clarity of what I'm doing):</p> <pre><code>List&lt;myType&gt; myList = new List&lt;myType&gt;(someCapacity); . ...populate the list with query from database... . var query = from i in myList select new { i.FieldA, i.FieldB, i.FieldC }; myBindingSource.DataSource = query; myDataGrid.DataSource = myBindingSource; </code></pre> <p>Then I create a DataGridTableStyle object and add it to the datagrid. However, it never applies my table style properties I set up because I can't seem set the proper myDataGridTableStyle.MappingName property.</p> <p>I've searched Google for about 1/2 an hour and keep seeing links to the same question throughout a bunch of different forums (literally the same text, like someone just copied and pasted the question... I hate that...). Anyway, none of the suggestions work, just like the guy says on all the other sites.</p> <p>So does anybody here know what I need to set the MappingName property to in order to have my TableStyle actually work properly? Where can I grab the name from? (It can't be blank... that only works with a BindingSource that is bound to a DataTable or SqlCeResultSet etc.). </p> <p>I'm thinking it could be an issue with me using Linq to create an anonymous, more specialized version of the objects with only the fields I need. Should I just try to bind the BindingSource directly to the List object? Or maybe even bind the DataGrid directly to the List object and skip the binding source altogether.</p> <p>Thanks</p> <p>PS - C#, Compact Framework v3.5</p> <p>UPDATE:</p> <p>I've posted an answer below that solved my problem. Whether or not it's the best approach, it did work. Worth a peek if you're having the same issue I had.</p>
[ { "answer_id": 420406, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "IEnumerable<T> T IList IList<T> .ToList() myBindingSource.DataSource = query.ToList();\n BindingList<T> BindingList<T...
2009/01/07
[ "https://Stackoverflow.com/questions/420386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9732/" ]
420,396
<p>Im trying to get pretty.js to prettify code in CODE tags, using this js:</p> <pre><code>onload_functions.push(function() { var node_list=document.getElementsByTagName('code'); for (i=0; i &lt; node_list.length; i++) { node_list[i].setAttribute('class','prettyprint'); } prettyPrint(); }); </code></pre> <p>This works fine for Firefox :) but IE's having none of it. What am i doing wrong?</p> <p>You can see it (non)working at <a href="http://sam.xnet.tk" rel="nofollow noreferrer">http://sam.xnet.tk</a></p>
[ { "answer_id": 420453, "author": "phihag", "author_id": 35070, "author_profile": "https://Stackoverflow.com/users/35070", "pm_score": 1, "selected": true, "text": "className onload" }, { "answer_id": 420464, "author": "Steve Losh", "author_id": 13498, "author_profile"...
2009/01/07
[ "https://Stackoverflow.com/questions/420396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428/" ]
420,404
<p>I found this statement is some old code and it took me a second to figure out...</p> <pre><code>IsTestActive = (TestStateID == 1 ? true : false); </code></pre> <p>Please correct me if I'm wrong but isn't this the same as this one?:</p> <pre><code>IsTestActive = (TestStateID == 1); </code></pre> <p>If it is, why would you ever want to use the first? Which one is more readable? (I think the latter, but I'd like to see what others think.)</p>
[ { "answer_id": 420663, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 3, "selected": false, "text": "IsTestActive = (TestStateID == 1);\n ACTIVE = 1\n IsTestActive (TestStateID == ACTIVE)\n IsTestActive TestStateID" ...
2009/01/07
[ "https://Stackoverflow.com/questions/420404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23855/" ]
420,410
<p>I.e.:</p> <pre><code>echo H#97llo | MagicPerlCommand </code></pre> <p>Stdout:</p> <pre><code>Hallo </code></pre> <p>were MagicPerlCommand is something like </p> <pre><code>perl -pnle "s/#(\d+)/chr(\1)/ge" </code></pre> <p>(but that doesn't work).</p>
[ { "answer_id": 420420, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 4, "selected": true, "text": "\\1 $1 \\digit s///e" }, { "answer_id": 420435, "author": "Alnitak", "author_id": 6782, "author...
2009/01/07
[ "https://Stackoverflow.com/questions/420410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4085/" ]
420,412
<p>How Can I change an Image (its an OLE Object) in a Crystal report using C#?</p>
[ { "answer_id": 605894, "author": "Axarydax", "author_id": 72746, "author_profile": "https://Stackoverflow.com/users/72746", "pm_score": 1, "selected": false, "text": "MemoryStream ms; //contains saved bitmap~!!!\nDataTable dt = new DataTable();\ndt.Columns.Add(new DataColumn(\"img\", typ...
2009/01/07
[ "https://Stackoverflow.com/questions/420412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,423
<p>I tried two ways of catching unexpected unhandled exceptions:</p> <pre><code>static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ErrorHandler.HandleException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Application.Run(new OCR()); } catch (Exception ex) { ErrorWindow errorWindow = new ErrorWindow(ex); errorWindow.ShowDialog(); Application.Exit(); } } </code></pre> <p>When i execute the application using visual studio, everything works fine. if i use exe file in the bin\Debug folder, the exceptions are not handled. Application behaves as if catch block wasn't there. I'm clueless what's going on. any ideas?</p> <p>edit: exceptio nis not thron in <strong>Load</strong></p>
[ { "answer_id": 420431, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "OnLoad Load OnLoad Load catch" }, { "answer_id": 420497, "author": "Vilx-", "author_id": 41360, "...
2009/01/07
[ "https://Stackoverflow.com/questions/420423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40872/" ]
420,429
<p>In a C# console application, is there a smart way to have console output mirrored to a text file?</p> <p>Currently I am just passing the same string to both <code>Console.WriteLine</code> and <code>InstanceOfStreamWriter.WriteLine</code> in a log method.</p>
[ { "answer_id": 420462, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 3, "selected": false, "text": "logger.info(\"Message\");\n" }, { "answer_id": 420466, "author": "arul", "author_id": 15409, "aut...
2009/01/07
[ "https://Stackoverflow.com/questions/420429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82/" ]
420,433
<p>Kicking around some small structures while answering <a href="https://stackoverflow.com/questions/414981/directly-modifying-listt-elements">this post</a>, I came across the following unexpectedly:</p> <p>The following structure, using an int field is perfectly legal:</p> <pre><code>struct MyStruct { public MyStruct ( int size ) { this.Size = size; // &lt;-- Legal assignment. } public int Size; } </code></pre> <p>However, the following structure, using an automatic property does not compile:</p> <pre><code>struct MyStruct { public MyStruct ( int size ) { this.Size = size; // &lt;-- Compile-Time Error! } public int Size{get; set;} } </code></pre> <p>The error returned is "The 'this' object cannot be used before all of its fields are assigned to". I know that this is standard procedure for a struct: the backing field for any property must be assigned directly (and not via the property's set accessor) from within the struct's constructor. </p> <p>A solution is to use an explicit backing field:</p> <pre><code>struct MyStruct { public MyStruct(int size) { _size = size; } private int _size; public int Size { get { return _size; } set { _size = value; } } } </code></pre> <p>(Note that VB.NET would not have this issue, because in VB.NET all fields are automatically initialized to 0/null/false when first created.)</p> <p>This would seem to be an unfortunate limitation when using automatic properties with structs in C#. Thinking conceptually, I was wondering if this wouldn't be a reasonable place for there to be an exception that allows the property set accessor to be called within a struct's constructor, at least for an automatic property?</p> <p>This is a minor issue, almost an edge-case, but I was wondering what others thought about this...</p>
[ { "answer_id": 420441, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 7, "selected": true, "text": "public MyStruct(int size) : this()\n{\n Size = size;\n}\n public int Size { get; private set; }\n public int Size {...
2009/01/07
[ "https://Stackoverflow.com/questions/420433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10429/" ]
420,442
<h3>Background Information</h3> <p>For saving out crash dumps, I have a script passed to <code>cdb.exe</code> in the <code>Debugger</code> value of the <code>AeDebug</code> registry key:</p> <pre><code>C:\progra~1\debugg~1\cdb.exe -p %ld -e %ld -g -y SRV*c:\mss*http://msdl.microsoft.com/download/symbols -c "$&lt;d:\tgticker\Dumps\RDFD.cdbscript" </code></pre> <p>Here is the first portion of the script:</p> <pre><code>as /c CrashFirstModule .printf "%mu", @@c++((*(ntdll!_LDR_DATA_TABLE_ENTRY**)&amp;@$peb-&gt;Ldr-&gt;InLoadOrderModuleList.Flink)-&gt;BaseDllName.Buffer) .logopen /t d:\tgticker\dumps\${CrashFirstModule}_process.log * (...) </code></pre> <h3>The Problem</h3> <p>With symbols, this works exactly as I would like, I get log files with sensible names like:</p> <ul> <li><code>LHCBDRDT.exe_process_147c_2009-01-06_23-10-05-371.log</code></li> </ul> <p>However, if symbols are not available, I get a log file name like this:</p> <ul> <li><code>${CrashFirstModule}_process_17a8_2009-01-06_23-10-01-124.log</code></li> </ul> <p>This is because the alias command has failed to set the alias. The alias command is one that I harvested from <a href="http://www.dumpanalysis.org/blog/index.php/2008/08/13/generating-file-name-for-dump-command/" rel="nofollow noreferrer" title="DumpAnalysis.org: Generating file name for .dump command">DumpAnalysis.org</a>. This command pulls the name out of the PEB Header for the image, using <code>ntdll.dll</code>. Without symbols for the OS, it doesn't know where to find the function it is calling from ntdll.dll.</p> <h3>The Question</h3> <p>Does anyone know or have a command to get the name of the image as an alias for use in filenames which would still work in these situations?</p>
[ { "answer_id": 793431, "author": "Mark", "author_id": 37923, "author_profile": "https://Stackoverflow.com/users/37923", "pm_score": 0, "selected": false, "text": "ntdll.dll .foreach(Module {lm 1m}) { aS CrashApp Module; .break }\n .foreach(Module {lm 1m a $exentry}) { aS CrashApp Module ...
2009/01/07
[ "https://Stackoverflow.com/questions/420442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28950/" ]
420,456
<p>Is there something similar to the "Open Command Window Here" Windows Powertoy for Mac OS? I've found a couple plugins through a google search but wanted to see what works best for developers out there.</p>
[ { "answer_id": 431340, "author": "iayork", "author_id": 48808, "author_profile": "https://Stackoverflow.com/users/48808", "pm_score": 2, "selected": false, "text": "on main(filelist)\n tell application \"Finder\"\n try\n activate\n set frontWin to folder o...
2009/01/07
[ "https://Stackoverflow.com/questions/420456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47110/" ]
420,476
<p>As a developer coming from a Windows background, I'd always find the different <a href="http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx" rel="noreferrer">Powertoys</a> and <a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" rel="noreferrer">Sysinternals</a> apps as invaluable tools in aiding programming. Is there something similar for a developer to watch for in the Mac world?</p>
[ { "answer_id": 420507, "author": "stevex", "author_id": 8831, "author_profile": "https://Stackoverflow.com/users/8831", "pm_score": 4, "selected": true, "text": "\nsudo fs_usage\n" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47110/" ]
420,483
<p>I found <a href="http://www.ajaxpro.info/" rel="nofollow noreferrer">this AJAX .NET framework</a> the other day, and so far I am enjoying working with it. However, one thing I can't figure out (the documentation is rather poor atm) is how to pass variables through the AJAX script. This is what I have so far:</p> <pre><code>//default2.aspx.vb &lt;AjaxPro.AjaxMethod()&gt; _ Public Shared Function testSomething(ByVal value As String) As String Return value End Function Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(Default2)) End Sub //default2.aspx &lt;a href="#" onclick="doTest(1);"&gt;test something&lt;/a&gt; &lt;div id="temp" style="margin:15px 15px 0px 5px; padding:10px;"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; function doTest(x){ Default2.testSomething(doTest_callback,x) } function doTest_callback(res,x){ alert(res.value); document.getElementById("temp").innerHTML = "&gt;&gt;&gt;&gt; " + x + " &lt;&lt;&lt;&lt;" } &lt;/script&gt; </code></pre> <p>I have a couple of other test functions that work fine, and they do comparatively more complex operations. Anyone have any insight into how to pass variables with AjaxPro? Alternative methods are welcome as well!</p>
[ { "answer_id": 420779, "author": "Zhaph - Ben Duguid", "author_id": 33051, "author_profile": "https://Stackoverflow.com/users/33051", "pm_score": 0, "selected": false, "text": "<a href=\"#\" onclick=\"doTest(1);\">test something</a>\n<div id=\"temp\" style=\"margin:15px 15px 0px 5px; pad...
2009/01/07
[ "https://Stackoverflow.com/questions/420483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
420,484
<p>The following code is suppose to open CMD from my C# application and open the file text.txt.</p> <p>I tried to set the file path as an environment variable but when notepad opens it looks for %file%.txt instead of text.txt</p> <p>Any idea why?</p> <pre><code>System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false; proc.StartInfo.EnvironmentVariables.Add("file", "c:\\text.txt"); proc.StartInfo.UseShellExecute = false; proc.StartInfo.FileName = "notepad"; proc.StartInfo.Arguments="%file%"; proc.Start(); proc.WaitForExit(); Console.WriteLine(proc.ExitCode); </code></pre>
[ { "answer_id": 420494, "author": "Joe", "author_id": 13087, "author_profile": "https://Stackoverflow.com/users/13087", "pm_score": 1, "selected": false, "text": " System.Diagnostics.Process proc = \n new System.Diagnostics.Process(); \n proc.EnableRaisingEvents = false; \n ...
2009/01/07
[ "https://Stackoverflow.com/questions/420484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
420,510
<p>I'm just curious about this really, does anyone know why they broke convention on this one? </p> <p>Thanks, Ciaran</p>
[ { "answer_id": 11221723, "author": "Adam Cameron", "author_id": 894061, "author_profile": "https://Stackoverflow.com/users/894061", "pm_score": 3, "selected": false, "text": "malloc arrayBaseAddress + (whichElementItIsInTheArray * sizeOfDataType)\n whichElementItIsInTheArray sizeOfDataTy...
2009/01/07
[ "https://Stackoverflow.com/questions/420510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/446733/" ]
420,525
<p>We are migrating to a new server running Windows 2003 and IIS 6. When my PHP code runs, it has a warning on a particular line (which I'm expecting at the moment but will fix shortly). However, when it hits the warning, it immediately halts processing and returns a 500 error in the HTTP header. Normally, I would expect PHP to output the warning, but continue processing the script.</p> <p>Is there something in the configuration for IIS, FastCGI, or PHP that would be returning 500 errors when PHP hits a warning?</p> <p><strong>To clarify:</strong> I don't want to suppress the warnings; I want them to display. I do not want the script to stop processing on warnings.</p>
[ { "answer_id": 420579, "author": "phihag", "author_id": 35070, "author_profile": "https://Stackoverflow.com/users/35070", "pm_score": 0, "selected": false, "text": "error_reporting php.ini E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR\n" }, { "answer_id": 420644, "...
2009/01/07
[ "https://Stackoverflow.com/questions/420525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586/" ]
420,538
<p>So i am building an application that will have lots of windows, all with the same basic layout:</p> <ol> <li>A main Window</li> <li>A logo in the top corner</li> <li>A title block</li> <li>A status displayer down the bottom</li> <li>An area for window specific controls.</li> </ol> <p>At the moment i have to recreate this structure in every window. Ideally i want this layout to be coded in a single place, perhaps into a custom Window subclass for ease of use. Does anyone have any clues for how to get started, or previous experience with similar problems?</p>
[ { "answer_id": 422795, "author": "Ian Oakes", "author_id": 21606, "author_profile": "https://Stackoverflow.com/users/21606", "pm_score": 6, "selected": true, "text": "<ControlTemplate x:Key=\"WindowControlTemplate1\" TargetType=\"{x:Type Window}\">\n <Border \n Background=\"{Te...
2009/01/07
[ "https://Stackoverflow.com/questions/420538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38438/" ]
420,541
<p>What I'm wondering is if it's possible to (for instance) to walk up the stack frames, checking each calling object to see if matches an interface, and if so extract some data from it.</p> <p>Yes, I know it's bad practice, I'm wondering if it's possible.</p>
[ { "answer_id": 420619, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 3, "selected": false, "text": "new StackFrame(1).GetMethod().DeclaringType class stackTest\n{\n public void Test()\n {\n StackFrame sFrame...
2009/01/07
[ "https://Stackoverflow.com/questions/420541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26874/" ]
420,569
<p>In WCF, contracts can be switched to streaming mode, to transfer large messages.</p> <p>After reading and testing it seems to me, that streaming mode can not be used with duplex channels (channels with OneWay-calls and a callback interface).</p> <p>Is this so? Do duplex and streaming can not be used with each other? Or is there a way?</p> <p>(I'm trying to upload a large file to the service and use callback to report progress on this)</p>
[ { "answer_id": 20162436, "author": "Roman Ostashevskyi", "author_id": 3024872, "author_profile": "https://Stackoverflow.com/users/3024872", "pm_score": 4, "selected": true, "text": " [ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(IFreeBoxServiceCallBack))]\n ...
2009/01/07
[ "https://Stackoverflow.com/questions/420569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
420,581
<p>Should my interface and concrete implementation of that interface be broken out into two separate files?</p>
[ { "answer_id": 420668, "author": "tanathos", "author_id": 51295, "author_profile": "https://Stackoverflow.com/users/51295", "pm_score": 0, "selected": false, "text": "partial class" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46780/" ]
420,599
<p>We have an application with hundreds of possible user actions, and think about how enhancing memory leak testing.</p> <p>Currently, here's the way it happens: When manually testing the software, if it appears that our application consumes too much memory, we use a memory tool, find the cause and fix it. It's a rather slow and not efficient process: the problems are discovered late and it relies on the good will of one developer.</p> <p>How can we improve that?</p> <ul> <li>Internally check that some actions (like "close file") do recover some memory and log it?</li> <li>Assert on memory state inside our unit tests (but it seems this would be a tedious task) ?</li> <li>Manually regularly check it from time to time?</li> <li>Include that check each time a new user story is implemented?</li> </ul>
[ { "answer_id": 422728, "author": "Norman Ramsey", "author_id": 41661, "author_profile": "https://Stackoverflow.com/users/41661", "pm_score": 1, "selected": false, "text": "gcov valgrind valgrind valgrind" }, { "answer_id": 19081031, "author": "borx", "author_id": 1529077,...
2009/01/07
[ "https://Stackoverflow.com/questions/420599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25781/" ]
420,612
<p>I'm trying to implement some basic linear algebra operations and one of these operations is the inversion of a triangular (upper and/or lower) matrix. Is there an easy and stable algorithm to do that?</p> <p>Thank you.</p>
[ { "answer_id": 802219, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "inv(L)b inv(L)[1 0 0 ...],\ninv(L)[0 1 0 ....],\ninv(L)[0 0 1 ....]" }, { "answer_id": 57315374, "author": "Guilhe...
2009/01/07
[ "https://Stackoverflow.com/questions/420612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
420,620
<p>How expensive is it to create gdi brushes and pens? Should I create them on an add needed basis and wrap them in a using so they are disposed quickly, or should I create a static class similar to System.Drawing.Brushes class?</p>
[ { "answer_id": 421505, "author": "P Daddy", "author_id": 36388, "author_profile": "https://Stackoverflow.com/users/36388", "pm_score": 4, "selected": true, "text": "OnPaint" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45/" ]
420,623
<p>In My Asp.net webpage I need to display today's date into one of the textbox , so in my form load I wrote the following code </p> <pre><code>textbox1.text = System.DateTime.Today.ToShortDateString(); </code></pre> <p>this line is giving me date like 1/7/09 but I want date like 01/07/09 , Is there anyway I can conver this date into mm/dd/yy format in C#?</p>
[ { "answer_id": 420633, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": " DateTime.Today.ToString(\"MM/dd/yy\")\n" }, { "answer_id": 420635, "author": "Kon", "author_id": 22303, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
420,625
<p>The owner of my company wants to be able to draw lines in Visual Studio.net as he did Visual Basic 6.0. So far the only method I have found is a runtime method using system.drawing which of course only work during runtime, and not quite practical for what he wants to do. </p> <p>Is there any third party control (free or otherwise) that will give him a button at design time to draw lines?</p>
[ { "answer_id": 15354627, "author": "Harabati", "author_id": 2131006, "author_profile": "https://Stackoverflow.com/users/2131006", "pm_score": 2, "selected": false, "text": "Text Autosize False BackColor Enabled False" }, { "answer_id": 39266905, "author": "Yaniv Levi", "a...
2009/01/07
[ "https://Stackoverflow.com/questions/420625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5578/" ]
420,646
<p>I need to execute a http web request from Plesk's Task Scheduler (using shared hosting on Windows/ASP.NET; no Powershell, whatsoever). Thought about using a batch file for this.</p> <p>Is there an easy way to do this?</p>
[ { "answer_id": 29432481, "author": "npocmaka", "author_id": 388389, "author_profile": "https://Stackoverflow.com/users/388389", "pm_score": 4, "selected": false, "text": "jscript/.bat call winhttpjs.bat \"http://requestb.in/xxxxxx\" -method POST -header hdrs.txt -reportfile reportfile2...
2009/01/07
[ "https://Stackoverflow.com/questions/420646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9632/" ]
420,659
<p>These characters show fine when I cut-and-paste them here from the VisualStudio debugger, but both in the debugger, and in the TextBox where I am trying to display this text, it just shows squares.</p> <p>说明\r\n海流受季风影响,3-9 月份其流向主要向北,流速为2 节,有时达3 节;10 月至次年4 月份其流向南至东南方向,流速为2 节。\r\n注意\r\n附近有火山爆发的危险,航行时严加注意\r\n</p> <p>I thought that the TextBox supported Unicode text. Any idea how I can get this text to display in my application?</p>
[ { "answer_id": 4012407, "author": "Pratik Deoghare", "author_id": 58737, "author_profile": "https://Stackoverflow.com/users/58737", "pm_score": 1, "selected": false, "text": "TextBox StreamReader reader = new StreamReader(inputFilePath, Encoding.Default, true)\n RichTextBox" }, { ...
2009/01/07
[ "https://Stackoverflow.com/questions/420659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25640/" ]
420,662
<p>Is there any way to serialize a property with an internal setter in C#?<br> I understand that this might be problematic - but if there is a way - I would like to know.</p> <p><strong>Example:</strong></p> <pre><code>[Serializable] public class Person { public int ID { get; internal set; } public string Name { get; set; } public int Age { get; set; } } </code></pre> <p><strong>Code that serializes an instance of the class <em>Person</em>:</strong></p> <pre><code>Person person = new Person(); person.Age = 27; person.Name = "Patrik"; person.ID = 1; XmlSerializer serializer = new XmlSerializer(typeof(Person)); TextWriter writer = new StreamWriter(@"c:\test.xml"); serializer.Serialize(writer, person); writer.Close(); </code></pre> <p><strong>Result (missing the ID property):</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;Name&gt;Patrik&lt;/Name&gt; &lt;Age&gt;27&lt;/Age&gt; &lt;/Person&gt; </code></pre>
[ { "answer_id": 420698, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 1, "selected": false, "text": "IXmlSerializable" }, { "answer_id": 420702, "author": "Rowland Shaw", "author_id": 50447, "author_...
2009/01/07
[ "https://Stackoverflow.com/questions/420662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936/" ]
420,671
<p>I'd like to edit my Sharepoint Wiki content programmatically. One of the advantages would be to add indexes to the Wiki environment automatically.</p> <p>Has anyone been able to do this? Language doesn't matter, but looking for scripting solution. </p>
[ { "answer_id": 420872, "author": "DylanW", "author_id": 13463, "author_profile": "https://Stackoverflow.com/users/13463", "pm_score": 3, "selected": true, "text": "<A class=ms-wikilink href=\"/MyWikiLibrary/MyLinkName.aspx\">My Link Name</A>\n" }, { "answer_id": 4819447, "aut...
2009/01/07
[ "https://Stackoverflow.com/questions/420671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21275/" ]
420,701
<p>I'm looking for a rich-text editor control that has some way of allowing users to copy-paste images into it, a la Google Mail. I guess I'm hoping there's some way to communicate the binary contents of an image on the clipboard to the browser (and perhaps store these contents in a hidden element somewhere that I can access). If you can't think of a rich-text editor with this functionality included - can anyone think of a way to accomplish this using JavaScript?</p> <p>This only needs to be functional on IE5+, but any solutions that might work on IE are welcome.</p> <p>Any help appreciated - let me know in comments if there's any part of this question which isn't clear.</p> <p>Thanks,</p> <p>Dom</p>
[ { "answer_id": 569147, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 3, "selected": true, "text": "<img>" } ]
2009/01/07
[ "https://Stackoverflow.com/questions/420701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20972/" ]
420,703
<h2>Here's my custom filter:</h2> <pre><code>from django import template register = template.Library() @register.filter def replace(value, cherche, remplacement): return value.replace(cherche, remplacement) </code></pre> <h2>and here are the ways I tried using it in my template file that resulted in an error:</h2> <pre><code>{{ attr.name|replace:"_"," " }} {{ attr.name|replace:"_" " " }} {{ attr.name|replace:"_":" " }} {{ attr.name|replace:"cherche='_', remplacement=' '" }} </code></pre> <p>I looked into <a href="http://docs.djangoproject.com/en/dev/howto/custom-template-tags/" rel="noreferrer">django's docs</a> and <a href="http://www.djangobook.com/en/beta/chapter10/" rel="noreferrer">book</a> but only found example using a single argument... is it even possible?</p>
[ { "answer_id": 423060, "author": "Van Gale", "author_id": 34258, "author_profile": "https://Stackoverflow.com/users/34258", "pm_score": 8, "selected": true, "text": "{% if X|is_in:\"1,2,3,4\" %}\n from django.template import Library\n\nregister = Library()\n\ndef is_in(var, args):\n i...
2009/01/07
[ "https://Stackoverflow.com/questions/420703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48500/" ]
420,705
<p><strong>SETUP</strong></p> <p>I have to insert a couple million rows in either SQL Server 2000/2005, MySQL, or Access. Unfortunately I don't have an easy way to use bulk insert or BCP or any of the other ways that a normal human would go about this. The inserts will happen on one particular database but that code needs to be db agnostic -- so I can't do bulk copy, or SELECT INTO, or BCP. I can however run specific queries before and after the inserts, depending on which database I'm importing to.</p> <p>eg.</p> <pre><code>If IsSqlServer() Then DisableTransactionLogging(); ElseIf IsMySQL() Then DisableMySQLIndices(); End If ... do inserts ... If IsSqlServer() Then EnableTransactionLogging(); ElseIf IsMySQL() Then EnableMySQLIndices(); End If </code></pre> <p><strong>QUESTION</strong></p> <p>Are there any interesting things I can do to SQL Server that might speed up these inserts?</p> <p>For example, is there a command I could issue to tell SQL Server, "Hey, don't bother recording these transactions in the transaction log".</p> <p>Or maybe I could say, "Hey, I have a million rows coming in, so don't update your index until I'm totally finished".</p> <pre><code>ALTER INDEX [IX_TableIndex] ON Table DISABLE ... inserts ALTER INDEX [IX_TableIndex] ON Table REBUILD </code></pre> <p>(Note: Above index disable only works on 2005, not 2000. Bonus points if you know a way to do this on 2000).</p> <p>What about MySQL, and Access?</p>
[ { "answer_id": 420730, "author": "GvS", "author_id": 11492, "author_profile": "https://Stackoverflow.com/users/11492", "pm_score": 1, "selected": false, "text": "alter index [INDEX_NAME] on [TABLE_NAME] rebuild\n" }, { "answer_id": 423093, "author": "Cowan", "author_id": ...
2009/01/07
[ "https://Stackoverflow.com/questions/420705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/245/" ]