instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have heard of some methods, but none of them have stuck. Personally I try to avoid complex types in C and try to break them into component typedef.</p> <p>I'm now faced with maintaining some legacy code from a so called 'three star programmer', and I'm having a hard time reading some of the ***code[][].</p> <p>H...
<p>This article explains a relatively simple 7 rules which will let you read any C declaration, if you find yourself wanting or needing to do so manually: <a href="http://www.ericgiguere.com/articles/reading-c-declarations.html" rel="noreferrer">http://www.ericgiguere.com/articles/reading-c-declarations.html</a></p> <...
<p>Common readability problems include <a href="http://www.newty.de/fpt/fpt.html" rel="nofollow noreferrer">function pointers</a> and the fact that <a href="http://home.netcom.com/~tjensen/ptr/ch2x.htm" rel="nofollow noreferrer">arrays are really pointers</a>, and that <a href="http://irc.essex.ac.uk/www.iota-six.co.uk...
11,468
<p>How do you concatenate bits in VHDL? I'm trying to use the following code:</p> <p>Case b0 &amp; b1 &amp; b2 &amp; b3 is ...</p> <p>and it throws an error</p> <p>Thanks</p>
<p>The concatenation operator '&amp;' is allowed on the right side of the signal assignment operator '&lt;=', only</p>
<p>Here is an example of concatenation operator:</p> <pre><code>architecture EXAMPLE of CONCATENATION is signal Z_BUS : bit_vector (3 downto 0); signal A_BIT, B_BIT, C_BIT, D_BIT : bit; begin Z_BUS &lt;= A_BIT &amp; B_BIT &amp; C_BIT &amp; D_BIT; end EXAMPLE; </code></pre>
25,705
<p>I have a storyboard(1) that does some basic animations in 2 seconds. I want the storyboard(1) to do all the property animations I have set it up to do (this all works fine). But at 3 seconds into the storyboard(1) I want to begin storyboard(2) and exit storyboard(1) without user interaction at all.</p> <p>Only th...
<p>Normally in order to control animations during the timeline you would use "keyframes". Keyframe animations allow you to define specific values for the property you are animating at specific times. In WPF every animation has a corresponding keyframe animation, like 'DoubleAnimation' has 'DoubleAnimationUsingKeyFrames...
<p>Thanks Megakemp, that's what I was afraid of having to do. I didn't want to have to manage two copies of a storyboard in XAML. If I have to add a control and manage it via storyboard(1) I will have to remember to copy and paste the changes to this other storyboard(2). I guess those are the hoops you have to jump ...
24,818
<p>I am looking to build a Single-signon system for a couple web apps that used form based authentication. </p> <p>They way that I envision it is that my sso system would handle authentication against active directory pass the verification through to the desired web app when ever the used clicked a link through my sso...
<p>When a user accesses an application URL without a session cookie, he is redirected to the SSO system. He then logs into the SSO form, which then redirects him back to your app with a ticket ID that you can look up in the SSO system to get cridentials.</p> <p>Also, take a look at <a href="http://www.atlassian.com/so...
<p>Check out <a href="http://www.ja-sig.org/products/cas/index.html" rel="nofollow noreferrer">JA-SIG CAS</a>. Even if you build your own, you should look at their architecture for ideas on how to implement.</p>
37,235
<p>Suppose you have a collection of <code>Foo</code> classes:</p> <pre><code>class Foo { public string Bar; public string Baz; } List&lt;Foo&gt; foolist; </code></pre> <p>And you want to check this collection to see if another entry has a matching <code>Bar</code>.</p> <pre><code>bool isDuplicate = false; f...
<pre><code>fooList.Exists(item =&gt; item.Bar == SomeBar) </code></pre> <p>That's not LINQ, but a Lambda expression, but nevertheless, it uses a v3.5 feature. No problem:</p> <pre><code>fooList.Exists(delegate(Foo Item) { return item.Bar == SomeBar}); </code></pre> <p>That should work in 2.0.</p>
<p>You probably want to use C5.HashSet, and implement Equals and GetHashCode() for Foo.</p>
16,299
<p>I want to allow users to embed badges on their personal site or blogs with a snippet of javascript. The badge is customized on our site based on information in their profiles that at some point is "approved". </p> <p>Is there a best practice to check what website the javascript is embedded on and if it does not mat...
<p>Two methods come to mind immediately:</p> <ol> <li><p>Configure your server to log the "Referer" header of all requests for the javascript and even check it against a list of approved urls, and return an error code (<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4" rel="nofollow noreferrer"...
<p>You could check the top url using:</p> <pre><code>var topUrl = top.location.href; </code></pre>
43,550
<p>Am I able to integrate Apache Nutch crawler with the Solr Index server?</p> <p><strong>Edit:</strong></p> <p>One of our devs came up with a solution from these posts</p> <ol> <li><a href="http://wiki.apache.org/nutch/RunningNutchAndSolr" rel="noreferrer">Running Nutch and Solr</a></li> <li><a href="http://www.mai...
<p>If you're willing to upgrade to nutch 1.0 you can use the solrindex as described in this article by Lucid Imagination: <a href="http://www.lucidimagination.com/blog/2009/03/09/nutch-solr/" rel="noreferrer">http://www.lucidimagination.com/blog/2009/03/09/nutch-solr/</a>.</p>
<p>It's still an <a href="https://issues.apache.org/jira/browse/NUTCH-442" rel="nofollow noreferrer">open issue</a>. If you're feeling adventurous you could try applying those patches yourself, although it looks like <a href="http://www.mail-archive.com/nutch-user@lucene.apache.org/msg10872.html" rel="nofollow noreferr...
25,979
<p>I've successfully used the Windows SendMessage method to help me do various things in my text editor, but each time I am just copying and pasting code suggested by others, and I don't really know what it means. There is always a cryptic message number that is a parameter. How do I know what these code numbers mean...
<p>This is the windows message code.<br> They are defined in the header files, and generally available translated as an include of some sort with different languages. </p> <p>example:<br> WM_MOUSEMOVE = &amp;H200<br> MK_CONTROL = &amp;H8<br> MK_LBUTTON = &amp;H1<br> MK_MBUTTON = &amp;H10<br> MK_RBUTTON = &amp;H2<br> ...
<p>Try out the <a href="http://codeplex.com/clrinterop" rel="nofollow noreferrer">PInvoke interop Assistant</a>. This tool has a search functionality that allows you to browse through all of the defined windows messages. It will then generate the correct C#/VB.Net code for those values.</p> <p>It's also not limited t...
25,265
<p>I have a multiline text string (e.g. "Stuff\nMore Stuff\nYet More Stuff"), and I want to paint it, along with a bitmap into a tooltip. Since I am painting the bitmap, I need to set OwnerDraw to true, which I am doing. I am also handling the Popup event, so I can size the tooltip to be large enough to hold the text ...
<p>I assume that if you define the bounding rectangle to draw in (calculating the image offset yourself) you could just: </p> <pre><code> RectangleF rect = new RectangleF(100,100,100,100); e.Graphics.DrawString(myString, myFont, myBrush, rect); </code></pre>
<p>to calculate the Height of an owner drawn string s given a certain width w, we use the following code:</p> <pre><code>double MeasureStringHeight (Graphics g, string s, Font f, int w) { double result = 0; int n = s.Length; int i = 0; while (i &lt; n) { StringBuilder line = new StringBuilder()...
34,136
<p>I'm using LINQ to Entities (not LINQ to SQL) and I'm having trouble creating an 'IN' style query. Here is my query at the moment:</p> <pre><code>var items = db.InventoryItem .Include("Kind") .Include("PropertyValues") .Include("PropertyValues.KindProperty") ...
<p>You need to either use this one:</p> <pre><code>.Where(string.Format("it.ID in {0}", string.Join(",", valueIds.ToArray()))); </code></pre> <p>or construct the WHERE part dynamically, as in <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3917617&amp;SiteID=1" rel="noreferrer">this</a> post. </p> <h...
<p>My workaround is to convert the entities result to a List and <strong>after</strong> that apply the Contains().</p> <p>Example:</p> <pre><code>var items = db.InventoryItem .Include("Kind") .Include("PropertyValues") .Include("PropertyValues.KindProperty") ...
42,576
<p>In designing a fluid layout, how do you use borders without ruining the layout.</p> <p>More specifically, I have a HTML widget which consists of five divs. I would like the five divs to take up all the room in the containing element. I would also like to have a 1px border around each.</p> <p>I tried: .box { floa...
<p>See <a href="http://www.quirksmode.org/css/box.html" rel="noreferrer">this article</a>.</p> <p>Basically, in the "traditional" CSS box model, the width of a box element only specifies the width of the <em>content</em> of the box, excluding its border (and padding).</p> <p>In CSS3, you can switch to a different box...
<p>This will get you fairly close but not 100% of the way (pun intended). To give an element 100% height it needs to know "100% of what?". All parent elements must also be given 100% height and this includes the body. Or as the W3C put it: "If the height of the containing block is not specified explicitly (i.e., it dep...
39,414
<p>I'm using a ListView in C# to make a grid. I would like to find out a way to be able to highlight a specific cell, programatically. I only need to highlight one cell.</p> <p>I've experimented with Owner Drawn subitems, but using the below code, I get highlighted cells, but no text! Are there any ideas on how to ...
<p>You can do this without owner-drawing the list:</p> <pre><code>// create a new list item with a subitem that has white text on a blue background ListViewItem lvi = new ListViewItem( "item text" ); lvi.UseItemStyleForSubItems = false; lvi.SubItems.Add( new ListViewItem.ListViewSubItem( lvi, "subitem", Color.Whit...
<p>In my case, I wanted to highlight specific rows, including all the fields. So every row in my listview with "Medicare" in the first column gets the entire row highlighted:</p> <pre><code>public void HighLightListViewRows(ListView xLst) { for (int i = 0; i &lt; xLst.Items.Count; i++) ...
26,455
<p>How can I initialize a const / static array of structs as clearly as possible?</p> <pre><code>class SomeClass { struct MyStruct { public string label; public int id; }; const MyStruct[] MyArray = { {"a", 1} {"b", 5} {"q", 29} }; }; </code></pre>
<p>Firstly, do you <em>really</em> have to have a mutable struct? They're almost always a bad idea. Likewise public fields. There are some very occasional contexts in which they're reasonable (usually both parts together, as with <code>ValueTuple</code>) but they're pretty rare in my experience.</p> <p>Other than that...
<p>I'd use a static constructor on the class that sets the value of a static readonly array.</p> <pre><code>public class SomeClass { public readonly MyStruct[] myArray; public static SomeClass() { myArray = { {"foo", "bar"}, {"boo", "far"}}; } } </code></pre>
39,873
<p>When a .Net service crashes, does the ServiceBase.OnStop method get called? Will the service be marked as stopped regardless of whether or not the OnStop method is called?</p>
<p>use try-catch and call OnStop yourself; don't rely on 'auto-stop', even if it was 'guaranteed' it is still not a good idea. Services should be as robust as possible.</p>
<p>If by crashes you mean that there is an unhandled exception in your service then the answer is no OnStop will not be called. In general the service will be marked as stopped. But Steven is correct, every 'root' method must have a try-catch block surrounding any code that could throw an exception, your service should...
49,187
<p>I'm sure this is really simple if you know anything about binary files, but I'm a newbie on that score.</p> <p>How would I extract the data from NASA .hgt files? Here is a description from www2.jpl.nasa.gov/srtm/faq.html:</p> <blockquote> <p><b>The SRTM data files have names like "N34W119.hgt". What do the l...
<p>A tested numpy example:</p> <pre><code>import os import math import numpy fn = 'DMV/N51E000.hgt' siz = os.path.getsize(fn) dim = int(math.sqrt(siz/2)) assert dim*dim*2 == siz, 'Invalid file size' data = numpy.fromfile(fn, numpy.dtype('&gt;i2'), dim*dim).reshape((dim, dim)) </code></pre>
<p>If you have photoshop you might be able to play around with the raw import to get it to read these files and save them out to something more useful. I have had some success doing this sort of thing in the past.</p>
46,603
<p>I want to show the processing information or log in the original page when the submitted request is being served until it completes the execution. I thought it would be meaningful to the user to know what is happening behind the request.</p> <p>I don't find a clue to do so though, can you guys help me out as how pe...
<p>there are two ways i could imagine handling this:</p> <ol> <li><p>have your backend script (python) output the information of a long process to a log of some sort (text file, database, session, etc...) and then have javascript grab the information via ajax and update the current page.</p></li> <li><p>same deal, but...
<p>you may use python threading, which will create a new process in background</p> <p>and display your messages on that thread</p> <p>hope it helps ;)</p>
39,694
<p>I've written a stored proc that will do an update if a record exists, otherwise it will do an insert. It looks something like this:</p> <pre><code>update myTable set Col1=@col1, Col2=@col2 where ID=@ID if @@rowcount = 0 insert into myTable (Col1, Col2) values (@col1, @col2) </code></pre> <p>My logic behind writing...
<p>Your assumption is right, this is the optimal way to do it and it's called <a href="http://en.wikipedia.org/wiki/Upsert" rel="noreferrer">upsert/merge</a>.</p> <p><a href="http://www.sqlservercentral.com/articles/T-SQL/61773/" rel="noreferrer">Importance of UPSERT - from sqlservercentral.com</a>: </p> <blockquote>...
<p>Your logic seems sound, but you might want to consider adding some code to prevent the insert if you had passed in a specific primary key.</p> <p>Otherwise, if you're always doing an insert if the update didn't affect any records, what happens when someone deletes the record before you "UPSERT" runs? Now the recor...
3,446
<p>I have the following problem:</p> <pre><code> # line is a line from a file that contains ["baa","beee","0"] line = TcsLine.split(",") NumPFCs = eval(line[2]) if NumPFCs==0: print line </code></pre> <p>I want to print all the lines from the file if the second position of the list has a value == 0.</p> ...
<p>Let me explain a little what you do here.</p> <p>If you write:</p> <pre><code>NumPFCs = eval(line[2]) </code></pre> <p>the order of evaluation is:</p> <ul> <li>take the second character of the string line, i.e. a quote '"'</li> <li>eval this quote as a python expression, which is an error.</li> </ul> <p>If you ...
<p>Your question is kind of hard to read, but using eval there is definitely not a good idea. Either just do a direct string comparison:</p> <pre><code>line=TcsLine.split(",") if line[2] == "0": print line </code></pre> <p>or use int</p> <pre><code>line=TcsLine.split(",") if int(line[2]) == 0: print line </...
42,027
<p>I'm building an English web dictionary where users can type in words and get definitions. I thought about this for a while and since the data is 100% static and I was only to retrieve one word at a time I was better off using the filesystem (ext3) as the database system instead of opting to use MySQL to store defini...
<p>What are your grounds for your belief that this decision will matter to the overall performance of the solution? WHat does it do other than provide definitions?</p> <p>Do you have MySQL as part of the solution anyway, or would you need to add it should you select it as the solution here?</p> <p>Where is the defini...
<p>A DB sounds perfect for your needs. I also don't see why memcached is relevant (how big is your data? Can't be more than a few GB... right?)</p>
32,038
<p>Can someone please tell me how to display error message in C# during execution of AfterInstallEvent?</p> <p>My project uses the Microsoft set-up and deployment project and then I have created a class that is called when the AfterInstall event is fired. </p> <p>MessageBox.Show(); doesn't work..."The name 'MessageB...
<p>The real solution is to use scope. Something like this: global::System.Windows.Forms.MessageBox.Show(ex,"Error",MessageBoxButtons.OK, MessageBoxIcon.Error);</p> <p>Cheers</p>
<p>This is very old but I'll answer anyway:</p> <p><strong>It's just a missing reference.</strong></p> <p>Add a reference to <strong>System.Windows.Forms</strong> to the project containing the class. Also add <strong>"using System.Windows.Forms;"</strong> to the top of your class file.</p> <p>As far as I know there ...
44,699
<p>I have an aspx page where i am Processing a large number of records from a table and doing some manipulation.after each manipuation,(each record),I have a Response.Write("Record : "+rec); Response.Flush()</p> <p>I have set Response.Buffer property to false. It is working fine But If i want to render the output as ...
<p>Most browsers will not render tables until the table is complete. You can try making the table fixed format, css table-layout: fixed, along with specifying column sizes.</p>
<p>I would guess that the table doesn't exist from the browser's perspective until you write out the end table tag.</p> <p>You could write out a bunch of divs with a stylesheet controlling their width.</p> <pre><code>.column1 { width: 40px; } .column2 { width: 40px; } Response.Write("&lt;div id=\"column1\"&gt;some t...
44,801
<p>thanks in advance for your help. I am wondering if there is a (design) pattern that can be applied to this problem. </p> <p><b>I am looking to parse, process, and extract out values from text files with similar, but differing formats.</b></p> <p>More specifically, I am building a processing engine that accepts O...
<p>This sounds like a candidate for the Strategy pattern. An example in C# can be found <a href="http://www.dofactory.com/Patterns/PatternStrategy.aspx" rel="noreferrer">here</a> and another one <a href="http://www.c-sharpcorner.com/UploadFile/rmcochran/strategyPattern08072006095804AM/strategyPattern.aspx" rel="norefer...
<p>First, create your "Online Poker Hand History" <strong>model</strong>. This model will represent the data and will be able to process this data independently from the source. Then create <strong>providers</strong> for each of the different source formats that must be capable of converting the file's information into...
43,359
<p>This is a bit of a weird question, and I imagine the answer might simply be "no." But here goes anyway:</p> <p>I'm writing some code that generates shapes for 3D printing via "implicit surfaces," i.e. a mathematical function f(x,y,z) that is positive inside the shape and negative outside it. This works pretty well ...
<h2>No, not natively</h2> <p>To the current point, all slicers in frequent use do use some kind of 3D model with explicit surfaces to cut up into slices and then solve the path functions to create the G-code. The model can be in STL or OBJ or some other format, depending on the slicer, but at this point (November 2019)...
<p>This is a partial answer that I might make into a full answer if I follow it up later. (I'm posting in case someone else has the same question, in which case this might be helpful despite being incomplete.)</p> <p>It seems that the 3mf format has a <a href="https://github.com/3MFConsortium/spec_slice/blob/master/3M...
1,400
<p>I am creating a Windows Forms control derived from UserControl to be embedded in a WPF app. I have generally followed the procedures given in <a href="http://www.codeproject.com/KB/WPF/WPFOpenGL.aspx?display=Print" rel="nofollow noreferrer">this link</a>.</p> <pre><code>public ref class CTiledImgViewControl : publi...
<p>The <code>OnPaint</code> won't normally get called in a <code>UserControl</code> unless you set the appropriate style when it is constructed using the <code>SetStyle</code> method. You need to set the <code>UserPaint</code> style to true for the <code>OnPaint</code> to get called.</p> <pre><code>SetStyle(ControlSty...
<p>I solved the issue, in case anyone is interested. It was because my WinForms control was embedded in a ViewBox. I changed it to a grid and immediately started getting paint events. I guess when asking questions about WPF, you should always include the XAML in the question!</p>
18,193
<p>I'm looking for a method, or a code snippet for converting std::string to LPCWSTR</p>
<p>The solution is actually a lot easier than any of the other suggestions:</p> <pre><code>std::wstring stemp = std::wstring(s.begin(), s.end()); LPCWSTR sw = stemp.c_str(); </code></pre> <p>Best of all, it's platform independent.</p>
<p>It's so easy, no need to apply any custom method. Try with this:</p> <pre><code>string s = &quot;So Easy Bro&quot; LPCWSTR wide_string; wide_string = CA2T(s.c_str()); </code></pre> <p>I think, it will works.</p>
4,684
<p>I'm looking for any idea of what could cause this problem. I'm printing (1.75mm PLA @ 220C) a 14cm x 14cm box, sliced with Simplify3D. Relevant settings are 3 bottom layers, 3 top layers, 3 outline/perimeter shells, and 15% orthagonal infill every other layer.</p> <p>The first 3 layers print fine. Here's the fir...
<p>I doubt this is a printer or filament issue. Rather, I suspect it might be related to how your slicer handles <em>bridging</em> scenarios (which basically is what laying down layers over infill is).</p> <p>You could try to:</p> <ol> <li><p>Increase the infill percentage and/or use an infill pattern that provides b...
<p>The infill percentage is a bit low. </p> <p>Even with infill percentages that are higher than 15% (I use 25%), a single layer on top of infill will not create a good top. It takes at least two and looks really good with three. The first layer is often patchy looking! </p> <p>If you're stopping your print after one...
399
<p>I'd like to study up on the latest technologies for writing Windows desktop apps. My last experience was with VC++ 6 using MFC. The landscape seems more complex these days, I'm not sure if I should learn .NET, don't really know what Windows forms, WPF are etc. All I want to do is be able to write some simple Wind...
<p>I would go with .NET and WPF. WinForms is still available, but is really a legacy branch of .NET at this point, and not worth learning if you are starting from scratch. WPF offers a lot of good features, and is pretty use to get up and running with.</p> <p>I found "<a href="https://rads.stackoverflow.com/amzn/cli...
<p>If you've got a C++ background and aren't afraid of pointers/stack/heap etc, then this <a href="http://www.amazon.co.uk/CLR-Via-Applied-Framework-Programming/dp/0735621632" rel="nofollow noreferrer">book</a> (CLR vi C#) will give you a superb understanding of .Net. It is very readable and will provide the foundatio...
35,710
<p>A client has asked whether or not I can provide some support for his intranet which runs on Oracle Application Server Portal. Not having used this technology before I thought I'd ask if anyone else has and what they thought of developing for it. </p> <p>I'm a c#/ASP.NET developer so I note with apprehension that th...
<p>Oracle Portal was never meant to be a "platform," but instead to fulfull a specific need. When Portal was not the right solution directly, the pointer was to JDev and BC4J, plus needed other stuff. I have done extensive Oracle Portal development and for what it is, it did just fine (i.e. a "portal" to core data and ...
<p>The only experience I've had with an Oracle Portal was obliquely, when I inherited a system that used one for a relatively simple maintenance web application. A large part of my opinion of Oracle's stuff comes from my background with SQL Server/ASP.NET, but Oracle is just plain harder to set up and administer and k...
31,220
<p>This probably sounds really stupid but I have noo idea how to implement jquery's rounded corners (<a href="http://www.methvin.com/jquery/jq-corner-demo.html" rel="nofollow noreferrer">http://www.methvin.com/jquery/jq-corner-demo.html</a>). My javascript-fu is complete fail and I can't seem to get it to work on my pa...
<ol> <li><p>This thing does not work in Safari &amp; Google Chrome.</p> </li> <li><p>You need to include <a href="http://jqueryjs.googlecode.com/files/jquery-1.2.6.js" rel="nofollow noreferrer">jquery.js</a> in your page. Don't forget to have a separate closing tag.</p> <p><code>&lt;script type=&quot;text/javascript&qu...
<p>1) Ensure jquery is loaded 2) Ensure corners lib is loaded 3) In the ready callback, use a selector to grab the div you want to effect and call the corners method</p> <pre><code>$(document).ready(function() { $("#idofdiv").corners(); }); </code></pre>
33,977
<p>i kinda know how to create a Custom Web Part. But now i need to create a Smart Part. Any idea how it works or what a easy way is to create it? Maybe some nice links to articles?</p> <p>Please Help</p> <p>Regards Etienne</p>
<p>Pls have a look at <a href="http://www.codeplex.com/smartpart" rel="nofollow noreferrer">Codeplex</a>, is it something like that you are looking for ?</p>
<p>My web parts are created using WebUserControls. For example, you can programming all functionality in a standard asp.net application (ascx, aspx) on the same server of SharePoint and then, load the user controls in web parts and access the aspx pages copying them to layouts folder.</p>
35,888
<p>I am not as familiar with Oracle as I would like to be. I have some 250k records, and I want to display them 100 per page. Currently I have one stored procedure which retrieves all quarter of a million records to a dataset using a data adapter, and dataset, and the dataadapter.Fill(dataset) method on the results f...
<p>Something like this should work: <a href="http://weblogs.asp.net/fbouma/archive/2007/05/21/api-s-and-production-code-shouldn-t-be-designed-by-scientists.aspx" rel="noreferrer">From Frans Bouma's Blog</a> </p> <pre><code>SELECT * FROM ( SELECT a.*, rownum r__ FROM ( SELECT * FROM ORDERS WHERE Cus...
<p>In my project I used <strong>Oracle 12c and java</strong>. The paging code looks like this:</p> <pre><code> public public List&lt;Map&lt;String, Object&gt;&gt; getAllProductOfferWithPagination(int pageNo, int pageElementSize, Long productOfferId, String productOfferName) { try { if(pageNo==1){ ...
29,911
<p>Recently an application I wrote started not working on Internet Explorer. There has been no change to the underlying (ruby on rails) code.</p> <p>In IE 6 or IE 7, I can make one request (HTTP Post) to the app, but when I try to make a 2nd request, I get an "Operation Aborted" message. Everything works fine in fire...
<p>I found this Microsoft support article:</p> <p><a href="http://support.microsoft.com/?scid=kb;en-us;927917&amp;x=9&amp;y=18" rel="nofollow noreferrer">BUG: Error message when you visit a Web page or interact with a Web application in Internet Explorer: "Operation aborted"</a></p> <blockquote> <p><strong>SYMPTOMS...
<p>You could try to debug the issue using <a href="http://www.fiddlertool.com/" rel="nofollow noreferrer">Fiddler</a>. It's free HTTP Proxy tool for Internet Explorer.</p> <p>It lists every detail of the request and response. Maybe you can see the actual cause of that behaviour inspecting the whole HTTP traffic.</p> ...
36,619
<p>My application is logically divided into server, which contain my Grails domain objects and controllers; and client, where I have my Ext GWT classes that build all the UI pages.</p> <p>For UI requests, I am using an AJAX call to a controller method that returns, for instance, a list of domain objects as a JSON stru...
<p>There isnt a good way - you need a java object that is GWT serializable. The only real solution that I can see is to write a plugin (or add to the GWT plugin) a way to autogenerate the data transfer object, perhaps using annotations in a grails domain object. </p> <p>A similar method is being used to autogenerate t...
<p>Alternatively, you can send your data to the clientside as either json or xml. you can create a REST api for your serverside.</p>
29,535
<p>I am new to web programming and have been exploring issues related to web security.</p> <p>I have a form where the user can post two types of data - lets call them &quot;safe&quot; and &quot;unsafe&quot; (from the point of view of sql).</p> <p>Most places recommend storing both parts of the data in database after sa...
<p>You know the "safe" data you're talking about? It isn't. It's <em>all</em> unsafe and you should treat it as such. Not by storing it al in files, but by properly constructing your SQL statements.</p> <p>As others have mentioned, using prepared statements, or a library which which simulates them, is the way to go, e...
<p>What do you consider "safe" and "unsafe"? Are you considering data with the slashes escaped to be "safe"? If so, please don't.</p> <p>Use bound variables with SQL placeholders. It is the only sensible way to protect against SQL injection.</p>
22,518
<p>With the recent news about F# being included with Visual Studio 2010, I got to thinking ... how soon before I see functional programming take hold in the usual "line of business app" space?</p>
<p>I would add the subjective tag to that one ;)</p> <p>Personally, I don't think it will become the norm although it will be used in areas where it is well suited.</p> <p>I don't think it will become the norm because it is best suited to certain layers of the application, but isn't well suited to other layers like U...
<p>Depends what your business is, I guess. It's already getting there in my line, which includes quantitative analysis in a financial context, much of which involves writing functions. In an order-processing context, to pick something commonplace, I don't see much use for a functional language. But I could be wrong.</p...
47,362
<p>I am attempting to send an email using VB.NET.</p> <p>There are two requirements:</p> <ol> <li>The email be saved in their "Sent Items" folder in Outlook (their only email client).</li> <li>A PDF (generated on the fly) is attached to the email.</li> </ol> <p>I am currently creating a new <a href="http://msdn.micr...
<p>I think you'd need to do 1 of the following to get the exact functionality you want:</p> <ul> <li>Outlook Interop</li> <li>Exchange event sink</li> </ul> <p>As a much easier alternative, how about BCC the user (which will get to their Inbox) and configure an Outlook rule to move it to sent items?</p>
<p>You'll have to use the exchange server API or have a local copy of Outlook and use the outlook client API in order to make this happen. SMTP Client and exchange really have very little to do with each other, other than the fact that the Exchange server knows what to do with an SMTP message. </p> <p>You might be bet...
28,113
<p>I am looking for a way to slide a UIPickerView (and UIDatePickerView) up over a view (UITableView in particular) when a particular button press takes place.</p> <p>I understand how to get the events for clicks into the UITableView, but there doesn't seem to be a good way to have the UIPickerView slide up on top of ...
<p>Modally presented view controllers slide up from the bottom to cover the current view.</p> <p>See the documentation for -presentModalViewController:animated: in the UIViewController Class Reference. You would invoke this method on your UITableViewController and pass the UIPickerViewController as the first parameter...
<p>Have you tried using UIView's animation blocks do do this? See the <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIView_Class/UIView_Class.pdf" rel="nofollow noreferrer">Apple docs</a> on +[UIView beginAnimations:context:] and +[UIView commitAnimations]. Basically, wrap your calls ...
43,575
<p>What is the algorithm for storing the pixels in a spiral in JS?</p>
<p><a href="http://www.mathematische-basteleien.de/spiral.htm" rel="nofollow noreferrer">http://www.mathematische-basteleien.de/spiral.htm</a></p> <pre><code>var Spiral = function(a) { this.initialize(a); } Spiral.prototype = { _a: 0.5, constructor: Spiral, initialize: function( a ) { if (a !...
<p>There are a couple of problems with this question. The first is that you're not really being specific about what you're doing. </p> <p>1) Javascript isn't really a storage medium, unless you're looking to transmit the pixels using JSON, in which case you may want to rephrase to explicitly state that.</p> <p>2) T...
44,832
<p>I'm using 3.5 SP1 on my machine, while our customers currently use 3.5 without SP1. I don't know any way in VS2008 to target the solution or project to 3.5 without SP1, only the 3.5 with SP1 I have installed.</p> <p>If we use functions or constructors not available in 3.5 w/o SP1 the code will not work properly.</p...
<p>I just had the same problem, and I found a solution. For our application, it was a call to System.Threading.WaitHandle.WaitOne(Int32) that got us in trouble. For more details on how references to API's that were introduced in service pack releases can leak into your code without Visual Studio noticing, see <a href="...
<p>string Fx35RegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5"; object Fx35ServicePack = Registry.GetValue(Fx35RegistryKey, "SP", null);</p> <p>if (Fx35ServicePack == null || (int)Fx35ServicePack &lt; 1) throw new Exception(".NET Framework 3.5 SP1 is required.");</p>
28,866
<p>I'm working on a program that searches entire drives for a given file. At the moment, I calculate an MD5 hash for the known file and then scan all files recursively, looking for a match.</p> <p>The only problem is that MD5 is painfully slow on large files. Is there a faster alternative that I can use while retainin...
<p>I hope you're checking for an MD5 match only if the file size already matches.</p> <p>Another optimization is to do a quick checksum of the first 1K (or some other arbitrary, but reasonably small number) and make sure those match before working the whole file.</p> <p>Of course, all this assumes that you're just lo...
<p>Use MD5CryptoServiceProvider and BufferedStream</p> <pre><code> using (FileStream stream = File.OpenRead(filePath)) { using (var bufferedStream = new BufferedStream(stream, 1024 * 32)) { var sha = new MD5CryptoServiceProvider(); byte[] checksum ...
36,758
<p>I have a datagridview that accepts a list(of myObject) as a datasource. I want to add a new row to the datagrid to add to the database. I get this done by getting the list... adding a blank myObject to the list and then reseting the datasource. I now want to set the focus to the second cell in the new row.</p> <p>T...
<p>You can set the focus to a specific cell in a row but only if the SelectionMode on the DataGridView is set to CellSelect. If it is, simply do the following:</p> <pre><code>dataGridView.Rows[rowNumber].Cells[columnNumber].Selected = true; </code></pre>
<p>In WinForms, you should be able to set the </p> <pre><code>Me.dataEvidence.SelectedRows </code></pre> <p>property to the row you want selected.</p>
12,345
<p>HI,</p> <p>I have 3 tables: <strong>Clips</strong>, <strong>Books</strong> and relationships between <strong>ClipBook</strong></p> <p><strong>Problem is:</strong> i need get <strong>book</strong> that has <strong>bookID=4</strong> with some clips i mean many-to-many</p> <p>in simple text sql it will be something ...
<p>You can use this command:</p> <pre><code>svn st | cut -c8- | xargs ls </code></pre> <p>This will cut the first 8 characters leaving only a list of file names, without Subversion flags. You can also add <code>grep</code> before <code>cut</code> to filter only some type of changes, like <code>/^M/</code>. <code>xarg...
<p>Not quite what you're asking, but perhaps you should be looking into commit hooks in subversion?</p> <p>You could create a hook to block check-ins of any code that contains tabs at the start of a line, or contains tabs at all.</p> <p>In the repo directory on your subversion server there'll be a directory called ho...
36,889
<p>i get this error </p> <pre><code>{"Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL."} </code></pre> <p>when i try to execute this linq to sql</p> <pre><code>var query = from p in db.Posts let categories = GetCategoriesByPostId(p.P...
<p>LINQ-to-SQL only translates a subset of operations - and it trying (and failing) to write ConvertTimeFromUtc as TSQL. Some operations have TSQL counterparts (dateadd/datediff/etc) - but not all. You might choose to do your projection (select) using the raw value, and only do the ConvertTimeFromUtc once you have the ...
<p>LINQ-to-SQL only translates a subset of operations - and it trying (and failing) to write ConvertTimeFromUtc as TSQL. Some operations have TSQL counterparts (dateadd/datediff/etc) - but not all. You might choose to do your projection (select) using the raw value, and only do the ConvertTimeFromUtc once you have the ...
43,072
<p>I received a Monoprice Maker Select v2 (I3 V2 clone) from my wife for Christmas. The sample .gcode files that came with the printer generally print great with no noticeable defects.</p> <p>However, when I try to print miniatures for use with table-top gaming (D&amp;D, primarily), I tend to get a lot of oozing and ...
<p>I've not done much miniatures printing, but I have the same printer and I happen to have the exact same filament loaded. Also, I've been doing a lot of tuning lately, including <a href="https://www.thingiverse.com/thing:921948" rel="nofollow noreferrer">this z-brace mod</a> which has improved my overall print quali...
<p>I have an Alunar(Anet) Prusa i3 printer I bought from amazon 7 months ago. I have not done much for ultra high detail prints, but it does seem to print everything I've thrown at it quite well. It took sometime for me to get it dialed in. I've found that <strong>Bed Level, Z-axis height,</strong> and <strong>Print Sp...
499
<p>I want to convert user-submitted date format (mm/dd/yyyy) to a MySQL date format (YYYY-mm-dd). Submission is via a simple PHP form direc tto MySQL database. </p>
<pre><code>$mysql_date = date('Y-m-d H:i:s', strtotime($user_date)); </code></pre>
<p>An alternative method as of PHP 5.2</p> <pre><code>$datetime = new DateTime($user_date); echo $datetime-&gt;format('Y-m-d H:i:s'); </code></pre> <p><a href="http://www.php.net/manual/en/book.datetime.php" rel="nofollow">DateTime</a> is Y38k and timezone friendly.</p>
46,233
<p>How do I apply 'use base' in Perl to inherit subs from some base module?</p> <p>I'm used to C++ inheritance mechanics, and all the sites I googled for this caused more confusion then help. I want to do something like the following:</p> <pre><code>#! /usr/bin/perl #The base class to inherit from use strict; use war...
<p>The C++ mechnics aren't much different than the Perl mechanics: To use inheritance, you need two classes: the base class and the inheriting class. But you don't have any descendent class. </p> <p>You are also lacking a constructor. Unlike C++, Perl will not provide a default constructor for you.</p> <p>Your base c...
<p>OO syntax uses the <code>-&gt;</code> operator to separate the message and arguments from the receiver of the message. A short illustration below. </p> <pre><code>You-&gt;do_something( @params ); OR $you-&gt;do_something( @params ); package A; sub do_neat_thing { my ( $class_or_instance, @args ) = @_; ...
32,233
<p>Objective: use the standard Win32 MonthCal control, and paint days such as holidays in RED.</p> <p>It seems like the Win32's native approach would be use the <a href="http://msdn.microsoft.com/en-us/library/bb760935(VS.85).aspx" rel="nofollow noreferrer">MCN_GETDAYSTATE</a> notification, which seems to allow only p...
<p>Well if your application doesn't use any MFC, but is written in pure win32 calls, an MFC control to do what you want is out of the question. So you can make a control with MFC or with win32 - obviously the MFC control will use win32 under the hood but 15 years of Windows developer convention says that when someone t...
<p>Can't be done. That control only supports showing some days in bold.</p> <p>What platform are you targeting (desktop or WM?) If desktop, is it really win32 or is an MFC solution acceptable?</p>
12,628
<p>I have a Visual Studio 2008 solution with two projects (a Word-Template project and a VB.Net console application for testing). Both projects reference a database project which opens a connection to an MS-Access 2007 database file and have references to System.Data.OleDb. In the database project I have a function w...
<p>I have a visual Basic program with Visual Studio 2008 that uses an Access 2007 database and was receiving the same error. I found some threads that advised changing the advanced compile configuration to x86 found in the programs properties if you're running a 64 bit system. So far I haven't had any problems with my ...
<p>I've got the same error on a fully updated Windows Vista Family 64bit with a .NET application that I've compiled to 32 bit only - the program is installed in the programx86 folder on 64 bit machines. It fails with this error message even with 2007 access database provider installed, with/wiothout the SP2 of the sam...
29,515
<p>I find print_r in PHP extremely useful, but wonder if there is anything remotely equivalent in Perl?</p>
<p>Note @tchrist recommends <a href="http://search.cpan.org/~gaas/Data-Dump-1.21/lib/Data/Dump.pm" rel="noreferrer">Data::Dump</a> over <a href="http://search.cpan.org/~jhi/perl-5.8.0/ext/Data/Dumper/Dumper.pm" rel="noreferrer">Data::Dumper</a>. I wasn't aware of it, but from the looks of it, seems like it's both far e...
<p>I use <a href="http://search.cpan.org/dist/Data-Dump/lib/Data/Dump.pm" rel="nofollow noreferrer">Data::Dump</a>, it's output is a bit cleaner than Data::Dumper's (no $VAR1), it provides quick shortcuts and it also tries to DTRT, i.e. it will print to STDERR when called in void context and return the dump string when...
28,365
<p>I did this Just for kicks (so, not exactly a question, i can see the downmodding happening already) but, in lieu of Google's newfound <a href="http://www.google.com/search?hl=en&amp;q=1999999999999999-1999999999999995&amp;btnG=Search" rel="nofollow noreferrer">inability</a> to do <a href="http://www.google.com/searc...
<p>in C#, try (double.maxvalue == (double.maxvalue - 100)) , you'll get true ...</p> <p>but thats what it is supposed to be:</p> <p><a href="http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems</a> </p> <p>thinking abou...
<blockquote> <p>2^64 is not the maximum value of a double. 2^64 is the number of unique values that a double (or any other 64-bit type) can hold. Double.MaxValue is equal to 1.79769313486232e308.</p> </blockquote> <p>Not even; the IEEE encodings use multiple encodings for the same values. Specifically, NaN is repre...
4,675
<p>I am using VS 2008/C# and binding a local List of helper classes as the DataSource for a DataGridView control. Calling the Remove() method on my List of helper classes fires the CellFormatting event of the DataGridView, which makes sense (a bit). </p> <p>When removing whatever happens to be the DataBoundItem of t...
<p>I've had this problem in the past, and if I remember correctly there's one of two things you can do. When you remove the record from the collection, set the datasource property on your datagridview to null, and then rebind it to your list. That should do the trick.</p> <p>Alternatively, you can handle the DataError...
<p>It is a very old problem, but i solved it by handling the row-remove event, as follows.</p> <pre><code>private void dgViewItems_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e) { dataAdapter.Update((DataTable)bindingSource1.DataSource); } </code></pre> <p>and it worked.</p>
21,792
<p>In this class for example, I want to force a limit of characters the first/last name can allow.</p> <pre><code>public class Person { public string FirstName { get; set; } public string LastName { get; set; } } </code></pre> <p>Is there a way to force the string limit restriction for the first or last nam...
<p>necro time... It worth mentioning though.</p> <pre><code>using System.ComponentModel.DataAnnotations; public class Person { [StringLength(255, ErrorMessage = "Error")] public string FirstName { get; set; } [StringLength(255, ErrorMessage = "Error")] public string LastName { get; set; } } </code>...
<p>COnvert the property from an auto property and validate it yourself, you could then throw an argument exception or something similar that they would have to handle before submission.</p> <p>NOTE: if languages other than .NET will be calling you most likely want to be validating it on the service side as well. Or a...
26,156
<p>In my SWT Java app I often want to return information from inside a Display.syncExec() call. The best way I've found so far to do this is:</p> <pre><code>final ArrayList&lt;Integer&gt; result = new ArrayList&lt;Integer&gt;(); GUI.display().syncExec(new Runnable(){ public void run() { MessageBox mb = /* ... */; ...
<p><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html" rel="nofollow noreferrer"><code>ArrayList</code> is not thread-safe</a>. You can obtain a thread-safe <code>List</code> with <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList%28java.util.List%29" r...
<p>ArrayList is <em>not</em> thread-safe. From the relevant <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html" rel="nofollow noreferrer">Javadoc</a>:</p> <blockquote> <p>Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and...
10,190
<p>I have the following C# singleton pattern, is there any way of improving it? </p> <pre><code> public class Singleton&lt;T&gt; where T : class, new() { private static object _syncobj = new object(); private static volatile T _instance = null; public static T Instance { ...
<p>According to Jon Skeet in <a href="https://csharpindepth.com/articles/Singleton" rel="nofollow noreferrer">Implementing the Singleton Pattern in C#</a> the code you posted is actually considered as bad code, because it appears broken when checked against the ECMA CLI standard.</p> <p>Also watch out: everytime you i...
<p>You don't need all that, C# already has a good singleton pattern built-in.</p> <pre><code>static class Foo </code></pre> <p>If you need anything more interesting than that, chances are your new singleton is going to be just different enough that your generic pattern is going to be useless.</p> <p>EDIT: By "anythi...
12,529
<p>Is there an app that can change the order of images inside an icon?</p> <p>Thanks!</p>
<p>What you'll need to do that is a resource editor. A <a href="http://www.google.com/search?q=resource+editor&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" rel="nofollow noreferrer">google search</a> will reveal many free ones out there. The <a href="http://www.bome.com/Re...
<p>You can change the image order using <a href="http://www.qualibyte.com/pixelformer/" rel="nofollow noreferrer">Pixelformer</a> (an icon/bitmap editor). Import the icon, reorder the images as you wish, then export it back.</p>
16,710
<p>The discussion of Dual vs. Quadcore is as old as the Quadcores itself and the answer is usually "it depends on your scenario". So here the scenario is a Web Server (Windows 2003 (not sure if x32 or x64), 4 GB RAM, IIS, ASP.net 3.0).</p> <p>My impression is that the CPU in a Webserver does not need to be THAT fast b...
<p>For something like a webserver, dividing up the tasks of handling each connection is (relatively) easy. I say it's safe to say that web servers is one of the most common (and ironed out) uses of parallel code. And since you are able to split up much of the processing into multiple discrete threads, more cores actu...
<p>The more the better. As programming languages start to become more complex and abstract, the more processing power that will be required.</p> <p>Atleat Jeff believes <a href="https://blog.stackoverflow.com/2008/04/our-dedicated-server/">Quadcore is better</a>.</p>
2,584
<p><strong>Edit</strong>: Solved, there was a trigger with a loop on the table (read my own answer further below).</p> <hr> <p>We have a simple delete statement that looks like this:</p> <pre><code>DELETE FROM tablename WHERE pk = 12345 </code></pre> <p>This just hangs, no timeout, no nothing.</p> <p>We've looked ...
<p>One piece of information missing is the number of indices on the table you are deleting the data from. As SQL Server uses the Primary Key as a pointer in every index, any change to the primary index requires updating every index. Though, unless we are talking a high number, this shouldn't be an issue.</p> <p>I am g...
<p>Ok, this is embarrasing.</p> <p>A collegue had added a trigger to that table a while ago, and the trigger had a bug. Although he had fixed the bug, the trigger had never been recreated for that table.</p> <p>So the server was actually doing nothing, it just did it a huge number of times.</p> <p>Oh well...</p> <p...
7,994
<p>I have been maintaining an installation for a while but I am not really an expert. now I've been asked to come up with a solution for this:</p> <p>Our software is always sold together with a computer as it has to be run in a very controlled environment. The installer needs administrative privileges to be executed. ...
<p>Check out <a href="http://www.joeware.net/freetools/tools/cpau/index.htm" rel="nofollow noreferrer">CPAU</a>. It allows you to create an encrypted command that will run the installation as administrator.</p> <p><strong>EDIT</strong>: <a href="http://www.commandline.co.uk/sanur/" rel="nofollow noreferrer">This</a> i...
<p>If you are looking for a toolkit to do this kind of thing, well, Microsofts MSI technology has this built in: Administrator access is required to install the initial MSI file, additional patches (MSPs I think) are digitally signed by the original MSI and are thus deemed safe - users can install them without requirin...
31,036
<p>What is the concept of erasure in generics in Java?</p>
<p>It's basically the way that generics are implemented in Java via compiler trickery. The compiled generic code <em>actually</em> just uses <code>java.lang.Object</code> wherever you talk about <code>T</code> (or some other type parameter) - and there's some metadata to tell the compiler that it really is a generic ty...
<p>There are good explanations. I only add an example to show how the type erasure work with a decompiler.</p> <p>Original class,</p> <pre><code>import java.util.ArrayList; import java.util.List; public class S&lt;T&gt; { T obj; S(T o) { obj = o; } T getob() { return obj; } ...
40,431
<p>I have a new object with a collection of new objects within it on some property as an IList. I see through sql profiler two insert queries being executed.. one for the parent, which has the new guid id, and one for the child, however, the foreign-key on the child that references the parent, is an empty guid. Here is...
<p>You may need to add NOT-NULL="true" to your mapping class:</p> <pre><code>&lt;bag name="BackerEntries" table="BackerEntry" cascade="all" lazy="false" order-by="Priority"&gt; &lt;key column="BackerId" not-null="true"/&gt; &lt;one-to-many class="BackerEntry" /&gt; &lt;/bag&gt; </code></pre> <p>as well as make su...
<p>I had this problem and it took me forever to figure out. The Child table has to allow nulls on it's parent foreign key. NHibernate likes to save the children with NULL in the foreign key column and then go back and update with the correct ParentId.</p>
17,652
<p>I'm looking to execute a series of queries as part of a migration project. The scripts to be generated are produced from a tool which analyses the legacy database then produces a script to map each of the old entities to an appropriate new record. THe scripts run well for small entities but some have records in the ...
<p>If possible have the export tool modified to export a BULK INSERT compatible file.</p> <p>Barring that, you can write a program that will parse the insert statements into something that BULK INSERT will accept.</p>
<p>It sounds like this is generating a single <code>INSERT</code> for each row, which is really going to be pretty slow. If they are all wrapped in a transaction, too, that can be kind of slow (although the number of rows doesn't sound that big that it would cause a transaction to be nearly impossible - like if you we...
22,151
<p>Actually, this question seems to have two parts:</p> <ul> <li>How to implement pattern matching?</li> <li>How to implement <a href="http://erlang.org/doc/reference_manual/expressions.html#6.9" rel="noreferrer">send and receive</a> (i.e. the Actor model)?</li> </ul> <p>For the pattern matching part, I've been looki...
<p>One of the important things about erlang is how the features are used to make robust systems.</p> <p>The send/recieve model is no-sharing, and explicitly copying. The processes themselves are lightweight threads.</p> <p>If you did desire the robust properties of the erlang model, you would be best to use real proc...
<p>I would definitely be interested in looking at your "acedia" library and would love to help in any way that I could. Erlang has some wonderful constructs and C++ could definitely benefit from such a library.</p>
6,166
<p>I'm writing a page that can use a couple of different themes, and I'm going to store some information about each theme in the web.config. </p> <p>Is it more efficient to create a new sectionGroup and store everything together, or just put everything in appSettings?</p> <p><b>configSection solution</b></p> <pre><...
<p>For more complex configuration setup, I would use a custom configuration section that clearly defines the roles of each section for example</p> <pre><code>&lt;appMonitoring enabled="true" smtpServer="xxx"&gt; &lt;alertRecipients&gt; &lt;add name="me" email="me@me.com"/&gt; &lt;/alertRecipient&gt; &lt;/appMo...
<p>There will be no measurable difference in terms of efficiency.</p> <p>AppSettings is great if all you need are name/value pairs.</p> <p>For anything more complex, it's worth creating a custom configuration section.</p> <p>For the example you mention, I'd use appSettings.</p>
25,062
<p>I have a report with many fields that I'm trying to get down to 1 page horizontally (I don't care whether it's 2 or 200 pages vertically... just don't want to have to deal with 2 pages wide by x pages long train-wreck). That said, it deals with contact information.</p> <p>My idea was to do:</p> <pre><code>Name: ...
<p>Alter the report's text box to:</p> <pre><code>= Fields!Addr1.Value + VbCrLf + Fields!Addr2.Value + VbCrLf + Fields!Addr3.Value </code></pre>
<p>Try this one :</p> <pre><code>= Fields!Field1.Value + System.Environment.NewLine + Fields!Field2.Value </code></pre>
4,613
<p>I have been using Flex for a while and have not used remoting as of yet. Currently my apps use a webservice that generates xml that I use for databinding. </p> <p>What would be the benefit to using remoting over an xml webservice in this use case? Is there a general guideline when I should choose remoting over webs...
<p>Speaking personally I use remoting because I prefer AMF to SOAP/XML for the simple reason of speed and packet size. </p> <p>Ted has a good discussion in the relative merits of XML vs. AMF <a href="http://www.onflex.org/ted/2006/12/xmle4x-vs-amf.php" rel="nofollow noreferrer">here</a></p> <p>Something to consider ...
<p>If you plan to use the data on other applications (meaning that yours is only one of several frontends) you could use the XML otherwise you will save some time by using remoting.</p>
31,107
<p>I have a flash application running Flash 9 (CS3). Application is able to control the Softkeys when this flash application is loaded in the supported mobile device. But, the application doesn't have control when the same is embedded in HTML page and browsed via supported mobile device. Any ideas how to make this w...
<p>There is no special way to receive soft key events when embedded in HTML - if the browser/OS gives the events to Flash, then you can catch them like any other key event:</p> <pre><code>var myListener = new Object(); myListener.onKeyDown = function() { var code = Key.getCode(); if (code==ExtendedKey.SOFT1) {...
<p>If you use a switch statement, you can have more than one keycode associated with an action, you make a desktop version for testing too. I have done it myself.</p>
17,312
<p>From one apache server file_get_contents returns the contents of a url straight away. On another apache server file_get contents won't return the contents of the same url until the keep-alive limit of the server hosting that url has been expired. The 2 php servers are retrieving the same url but through different ...
<p>Does using <code>fopen</code> manually work faster?</p> <p>Rather than spending hours working out why <code>file_get_contents</code> doesn't work, you might be better-off swapping it out.</p> <p>If <code>fopen</code> isn't any faster, there's probably a config or filesystem issue. If it is faster, it's likely a ph...
<p>I'm not totally familiar with that php function, however i have seen similar situations caused by the output not being flushed back to the stream. I believe data is usually flushed to the stream once it reaches a certain size or when the stream is closed. It's possible this size is configured differently on each of ...
22,569
<p>Is there a simple process in SQL 2005 for spitting all of my stored procedures out to individual .sql files. I'd like to move them into VSS, but am not too excited by the prospect of clicking on each one to get the source, dumping it into a text file and so on.. </p>
<p>In SQL Management Studio right click on the database, go to tasks -> Generate Scripts, walkthrough the wizard. One of the pages will let you script each object to its own file.</p>
<p>Try to use <a href="http://msdn.microsoft.com/en-us/library/ms162169.aspx" rel="nofollow">Sql Server SMO</a>. An example is included below:</p> <pre><code>//C:\Program Files\Microsoft SQL Server\{version}\SDK\Assemblies\ using Microsoft.SqlServer; using Microsoft.SqlServer.Server; using Microsoft.SqlServer.Manageme...
43,807
<p>How do you go about doing a daily build and striving for a zero-defect environment? Does it mean I never get to go home until I've killed all the bugs in my new code? Or does it mean I just don't check my code back in until I've fully tested it, which leaves the code effectively branched for a much longer time?</p> ...
<p>Simple: Never check in code with <strong>(known)</strong> bugs in it. This doesn't mean you check in once per day. Check in when you have a meaningful change implemented so the other developers can get access to it.</p> <p>We always integrate locally, run our tests against the code, and when all passes, we check in...
<p>Depending on what you're building, adopting an approach that defects are not allowed may not be appropriate. My personal opinion is that it rarely, if ever, is. </p> <p>The whole point of a defect management system is exactly that - to allow you to manage defects. If the defect is a show-stopping one then sure, you...
20,030
<p>I know this is still gray territory and it is asked so many times within the 3D printing and maker community but I'm curious about the limits of 3D models and were it touches on Free Use and infringement. I'm not trying to push the envelope, I just want to be clear on the matter.</p> <p>Is it legal if a design is r...
<p>Whether or not you sell, distribute, release, license, profit from, claim ownership, etc... of something does not matter for copyright law. Copyright prohibits the very act of well, <em>copying</em>. Specifically, if a work is protected by copyright, you can't (among other things)</p> <blockquote> <ul> <li><p>make a...
<p>Well I think it's a good question, but like what was already stated this question is extremely broad. I am however curious as well. If I take what has already been said literally and apply it to a 3D model of a palm tree, for example. From what y'all are saying, everyone that has ever made a 3D model after the first...
547
<p>Right now my heated bed is down and I had no time to try and fix it and I am trying to print something for a friend. I am having the PLA lift around the edges which I have NEVER experienced. The glue is not helping like it did with the heat. And I also tried rubbing alcohol on the masking tape I use, heard that help...
<p>Most of the same reccomendations that apply for adhesion to a hot bed apply for a cold one. The first ones to come to mind:</p> <ul> <li>really dial in the nozzle height</li> <li>make the first layer taller than the rest (e.g.: 0.2mm if the rest of your print is 0.1mm)</li> <li>print the first layer very slowly</l...
<p><strong>Fresh</strong> 3M blue painter’s tape coated in a watered down solution of Elmer’s white glue works wonders - even when cold - for PLA.</p> <p>The tape needs to be re-applied and coated for each print for it to <strong>really</strong> stick, but it beats every other print surface I have tested for PLA other...
824
<p>I have a lengthy user-interface operation on my form which is triggered whenever an event is fired. Rather than have the UI block while the operation takes place, I'd like to perform the operation in another thread, and abort that thread and start again if the event fires again.</p> <p>However, to safely alter con...
<p>First - don't disable the cross-thread checks... forms have thread affinity...</p> <p>Second - try to avoid aborting threads; it isn't nice - you should prefer clean shutdown (such as the cancellation that BackgroundWorker supports)</p> <p>One option might be to write a wrapper method that:</p> <ul> <li>accepts a...
<p>You can avoid the use of Invoke using the object SynchronizationContext that was introduced in framework 2. Ok , it's the same thing, you substitute one thing for another, but in fact, it is more efficient and robust. Anyway, cross-threads need checks, because you can never access a control created in another thread...
38,776
<p>I have just assembled the Creality3D Ender-4 kit a couple of days ago. I completed some rewiring and everything seems to be wired correctly, I'm able to auto-home successfully, but this is the problem I'm having:</p> <p>I tried printing a <a href="https://makerware.thingiverse.com/thing:1278865" rel="nofollow noref...
<p>The <strong>first problem</strong> is solved by removing the tick mark at <code>Origin at center</code>. Most printers have their origin at a corner (not Delta's, their origin is in the top center).</p> <p>The <strong>second problem</strong> is a little more difficult to solve. Please note that a kit should be loa...
<p>Fix was actually pretty simple.</p> <p>I just removed the printer that I had setup on CURA following the manual provided by Creality (found on the provided SD Card) and started from scratch.</p> <p>The one that worked was actually setting up the printer as a <a href="https://www.inky.mx/MPRESORA-CREALITY-CR-10-,72...
938
<p>For some reason, I am having trouble thinking of a good way to rewrite this function so it uses constant stack space. Most online discussions of tree recursion cheat by using the Fibonacci function and exploiting the properties of that particular problem. Does anyone have any ideas for this "real-world" (well, more ...
<p>This may look ugly but it's a way to do it in trampoline-style (no system stack overflow), and without using gotos.</p> <pre><code>push x,1 on homemade stack while stack length &gt; 1 n = pop if (n==1) x = pop if (type(x)==NIL || type(x)==TEXT) push x // this is the &quot;return value&quot; els...
<p>The best I can come up with is something like this:</p> <pre><code>(define (doaction vars action) (cond ((symbol=? action 'frob) (cond ((foo? (first vars)) (first vars)) ((bar? (first vars)) (doaction (list (f (first vars)) (doaction (g x) 'frob)) 'macerate)...
40,729
<p>Is it possible to call a JavaScript function from the IMG SRC tag to get an image url?</p> <p>Like this:</p> <pre><code>&lt;IMG SRC="GetImage()" /&gt; &lt;script language="javascript"&gt; function GetImage() {return "imageName/imagePath.jpg"} &lt;/script&gt; </code></pre> <p>This is using .NET 2.0.</p>
<p>Nope. It's not possible, at least not in all browsers. You can do something like this instead:</p> <pre><code>&lt;img src="blank.png" id="image" alt="just nothing"&gt; &lt;script type="text/javascript"&gt; document.getElementById('image').src = "yourpicture.png"; &lt;/script&gt; </code></pre> <p>Your favouri...
<p>No. The Img's SRC attribute is not an event, therefore the inline JS will never fire.</p>
14,251
<p>I have a hosting account with servergrid.com. I want to backup my database, they say I have to use Sql Server Integration Service to backup the database and I would need a commercial version of Sql Server management studio. </p> <p>I have Sql Server 2005 Developer Edition. I have no idea how to do SSIS backup. I tr...
<p>SSIS is not really a database backup tool. </p> <p>If you have a fixed number of tables, you can <strong>export</strong> the data from SQL Server to comma-separated or raw files - i.e. do the data export using SSIS. It is easy to create such package using SSIS project if you have small number of tables. But if you ...
<p>You have a local drive on this machine, correct?</p> <p>Get access to the sql prompt, through their tools or <a href="http://msdn.microsoft.com/en-us/library/ms162773.aspx" rel="nofollow noreferrer">sqlcmd</a>.</p> <p>BACKUP DATABASE MYDB TO DISK = 'E:\backups\mydb.bak'</p> <p>Then FTP that file offsite.</p> <p>...
42,600
<p>What is the difference between UTF and UCS.</p> <p>What are the best ways to represent not European character sets (using UTF) in C++ strings. I would like to know your recommendations for:</p> <ul> <li>Internal representation inside the code <ul> <li>For string manipulation at run-time</li> <li>For using the str...
<blockquote> <p>What is the difference between UTF and UCS.</p> </blockquote> <p>UCS encodings are fixed width, and are marked by how many bytes are used for each character. For example, UCS-2 requires 2 bytes per character. Characters with code points outside the available range can't be encoded in a UCS encoding.<...
<p>UTC is Coordinated Universal Time, not a character set (I didn't find any charset called UTC).</p> <p>For internal representation, you may want to use <code>wchar_t</code> for each character, and std::wstring for strings. They use exactly 2 bytes for each character, so seeking and random access will be fast.</p> <...
24,400
<p>Say I have the classic 4-byte signed integer, and I want something like</p> <pre><code>print hex(-1) </code></pre> <p>to give me something like</p> <blockquote> <p>0xffffffff</p> </blockquote> <p>In reality, the above gives me <code>-0x1</code>. I'm dawdling about in some lower level language, and python commandline...
<p>This will do the trick:</p> <pre><code>&gt;&gt;&gt; print(hex (-1 &amp; 0xffffffff)) 0xffffffff </code></pre> <p>or, a variant that always returns fixed size (there may well be a better way to do this):</p> <pre><code>&gt;&gt;&gt; def hex3(n): ... return &quot;0x%s&quot;%(&quot;00000000%s&quot;%(hex(n&amp;0xffff...
<p>Try this function:</p> <pre><code>'%#4x' % (-1 &amp; 0xffffffff) </code></pre>
28,302
<p>I have an abstract Class <strong>Monitor.java</strong> which is subclassed by a Class <strong>EmailMonitor.java</strong>. </p> <p>The method:</p> <pre><code>public abstract List&lt;? extends MonitorAccount&gt; performMonitor(List&lt;? extends MonitorAccount&gt; accounts) </code></pre> <p>is defined in <strong>Mon...
<p>No, it's not overriding it properly. Overriding means you should be able to cope with any valid input to the base class. Consider what would happen if a client did this:</p> <pre><code>Monitor x = new EmailMonitor(); List&lt;NonEmailAccount&gt; nonEmailAccounts = ...; x.performMonitor(nonEmailAccounts); </code></pr...
<p>Here is my own solution. I suspect this is the same thing Jon Skeet was trying to get at... without the typo (see my comment in reply to his answer). </p> <p>the <b>Monitor.java</b> class:</p> <pre><code>public abstract class Monitor &lt;T extends MonitorAccount&gt; { ... public abstract List&lt;T&gt; performM...
29,658
<p>Just installed AnkhSVN and I see the equivalent of "svn up" but I'd prefer to run "svn st" first so that I don't just blindly update.</p>
<p>The next release of AnkhSVN will enable the 'Recent Changes' tab in the pending changes window. This allows the equivalent of 'svn st -u' (It shows outgoing and incoming changes).</p> <p>We are still working on the usability of this view in the <a href="http://ankhsvn.net/daily/" rel="nofollow noreferrer">daily bu...
<p>There's a pending changes window you can add that will show what files you have changed in your local working copy. I usually keep it in the set of docked windows where the output window is. In general, you can also tell what status a file is in by the icon next to the file. For example, a plus sign means that it...
48,603
<p>I deleted a branch in TFS and just found out that I need the changes that were on it.</p> <p>How do I recover the branch or the changes done on it?</p>
<p>Specifically in Visual Studio go to "Tools-Options" then Select "Source Control-visual Studio Team Founation Server" and check the "Show deleted items in the Source Control explorer".</p> <p>Having done that - you can then right click a folder and say "Undelete"</p>
<p>As described in the <a href="http://blogs.msdn.com/jimlamb/articles/tfsfaq.aspx" rel="noreferrer">TFS FAQ</a>:</p> <p><strong>Are Deletes physical or logical? Can accidental deletes be recovered?</strong></p> <p>Deletes are fully recoverable with the “undelete” operation. You wouldn’t want to do a SQL restore beca...
7,203
<p>For example, mysql quote table name using </p> <pre><code>SELECT * FROM `table_name`; </code></pre> <p>notice the ` </p> <p>Does other database ever use different char to quote their table name</p>
<p>This use of quotes is called delimited identifiers. It's an important part of SQL because otherwise you can't use identifiers (e.g. table names and column names) that:</p> <ul> <li>Include whitespace: "my table"</li> <li>Include special characters and punctuation: "my-table"</li> <li>Include international charact...
<p>SQL Server uses [square brackets] or "double quotes" when QUOTED_IDENTIFIER option is ON.</p> <p>I believe double quotes are in the SQL-92 standard.</p>
26,345
<p>We are busy developing a Java web service for a client. There are two possible choices:</p> <ul> <li><p>Store the encrypted user name / password on the web service client. Read from a config. file on the client side, decrypt and send.</p></li> <li><p>Store the encrypted user name / password on the web server. Read ...
<p>Being on the intranet certainly does not justify dismissing security. Most damage done to information is by insiders. Look at the value of what's being protected, and give due consideration to security.</p> <p>It sounds like there's a third-party application, for which you have one set of credentials, and some clie...
<p>Being on the intranet certainly does not justify dismissing security. Most damage done to information is by insiders. Look at the value of what's being protected, and give due consideration to security.</p> <p>It sounds like there's a third-party application, for which you have one set of credentials, and some clie...
44,017
<p>Most of my part is printing very well, but I have problems in the bottom layer and in layers that are the first layers, but not necessarily layer 0.</p> <p>Looking at the <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/" rel="nofollow noreferrer">print quality troubleshooting</a>, I can't ...
<p>I know you said you don't want to change the Z height, but it does look like you're printing a bit too far from the plate. I would recommend adjusting your Z-offset if you can, or adjusting the limit switch (or whatever your Z-homing mechanism is)</p>
<p>Definitely the corner of your bed where print was worse is slightly unleveled (a little too low), because if you look the hole, it has artifacts too, probably because the nozzle was depositing the melted filament from a higher distance than on the "good" part.</p> <p>You can see later in that hole, that the layers ...
1,281
<p>I'm trying to achieve something google isn't able to give answer. I'm trying to create an asp.net usercontrol that when I put content into it's open close tag will include it for me to be still able to acess it's content by ID from the Parent. Here is an exemple of what I want to achieve.</p> <p>Usercontrol:</p> <...
<p>Ok I fixed it here is the solution I used :</p> <p>In MyUserConstrol.ascx file I have put a placeholder where I wanted innerHTML to show :</p> <pre><code>&lt;asp:PlaceHolder runat="server" ID="plhContent" /&gt; </code></pre> <p>Then in the MyUserControl.ascx.cs file I added those attribute to the class:</p> <pre...
<p>Add a public property in the user control's code behind file. If you need design time support there's more work involved, but for simple scenarios like the one you outlined it should be enough.</p> <p>Then just access it in the parent page to set the value and read it in the user control and use that value to rende...
49,075
<p>Please provide tips for effectively using git with svn. What are your "best practices"?</p>
<p>When you create the clone, use <code>--prefix=svn/</code>. It creates nicer branch names.</p> <p>Also, don't neglect the <code>--trunk</code>, <code>--tags</code>, and <code>--branches</code> arguments when doing <code>clone</code> or <code>init</code>.</p> <p>Fetching is one of the more time-consuming steps, so s...
<p>I've been blogging a bit about how to live with Subversion and Git in parallel, and I've also put up a couple of rudimentary screencasts. Gathered everything here: <a href="http://www.tfnico.com/presentations/git-and-subversion" rel="nofollow noreferrer">http://www.tfnico.com/presentations/git-and-subversion</a></p>...
18,817
<p>I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo".</p> <p>I thought I could do this using generics, using the following syntax:...
<p>Why don't you just use a <code>List(Of Foo)</code>... It is already in VB.NET under <code>System.Collections.Generic</code>. To use, simply declare as such:</p> <pre><code>Private myList As New List(Of Foo) 'Creates a Foo List' Private myIntList As New List(Of Integer) 'Creates an Integer List' </code></pre> <p>Se...
<p>You needed to implement a default property for the collection like this:</p> <pre><code>Default Public Property Item(ByVal Index As Integer) As Foo Get Return CType(List.Item(Index), Foo) End Get Set(ByVal Value As Foo) List.Item(Index) = Value End Set </code></pre> <p>End Property</p>
23,067
<p>In Xcode, I can use <kbd>CMD</kbd>-<kbd>R</kbd> to run (or <kbd>CMD</kbd>-<kbd>Y</kbd> to debug), and my app will compile, install on the phone &amp; start-up. (I've already prepped my phone &amp; Xcode so this part works as expected.)</p> <p>What I'd <strong><em>LIKE</em></strong> to do is type CMD-&lt;something ...
<p>Hey Olie, I haven't tried this because I don't have an iPhone to deploy to at the moment, but this /should/ work:</p> <p>You can create a script which runs xcodebuild in your current project directory and give it the install target. Assuming you're going to want to debug at sometime, use the Debug configuration, ot...
<p>Have you looked into using <a href="http://en.wikipedia.org/wiki/Automator" rel="nofollow noreferrer">Automator</a>? Here's a <a href="http://developer.apple.com/tools/xcode/automatorforxcode.html" rel="nofollow noreferrer">good write up</a> on how to automate XCode to build and what not.</p>
34,385
<p>Is there a way to detect the true border, padding and margin of elements from Javascript code? If you look at the following code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; &lt;!-- .some_class { padding-left: 2px; border: 2px solid green; } ...
<p>It's possible, but of course, every browser has its own implementation. Luckily, PPK has done all the hard work for us:</p> <p><a href="http://www.quirksmode.org/dom/getstyles.html" rel="noreferrer">http://www.quirksmode.org/dom/getstyles.html</a></p>
<h2>With jQuery:</h2> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var $elm = $('.box'); var hPadding = $elm.outerWidth() - $elm.width(); var vPadding = $elm.outerHeight() - $...
45,447
<p>What are some scenarios where MultiView would be a good choice? The MultiView control along with its View controls simply seem to extend the notion of Panels.</p> <p>Both Panels and MultiViews seem prone to abuse. If your UI concerns and biz logic concerns are properly separated, why lump views together in a sing...
<p>I have used MultiViews as a more flexible basis for a Wizard control.</p> <p>I do agree that lumping lots of views together is a code smell. In the case of a wizard there are often lots of pieces of state you want to share throughout the process. The multiview allows this state to be simply stored in the viewstate...
<p>Any time that you want to show different content on a page based on some condition. At work I've created a tab control that just uses a MultiView and another simple control I made that looks like tabs. Each tabs puts a link (which is styled) in the other control that is wired up to set the active view to the correct...
19,202
<p>My path to a 'fulltime'- developer stated as a analyst using VBA with Excel, Access, and then onto C#. I went to college part time once I discovered I had a passion for coding not business.</p> <p>I do about most of my coding in C#, but being an ASP.NET developer I also write in HTML, JavaScript, SQL etc. . . the...
<p>If you want to be one of the best you need to specialise. If you become very good in many skills then you may never become truly excellent in one. I know because I have taken this route myself and have found it difficult to get employment at times. After all, who wants someone who is capable at many languages when ...
<p>Why don't you swap stacks and look at the LAMP stack?</p> <p>Or how about a functional language like haskell?</p> <p>Or write a DSL?</p> <p>Or an app for your phone?</p>
4,336
<p>A Sprint cellular modem plugs into a laptop - often the PCMCIA slot. To connect, the user opens a program called the Connection Manager. This program has a menu option to display the serial number and phone number of the modem that's currently inserted.</p> <p>Does that imply that the serial/phone number of the mod...
<p>You could send the mail asynchronous. That way the timeout should not interrupt your sending.</p> <p>This article should help you get started with that: <a href="http://www.eggheadcafe.com/articles/20030720.asp" rel="nofollow noreferrer">Sending Emails Asynchronously in C#</a>.</p> <p>There is another approach her...
<p>Definitely spawn it off on a background worker process so they go out asynchronously. </p> <p>BTW, 5-10 seconds per e-mail seems way slow to me. On my server it takes just fractions of a second per e-mail. </p>
8,118
<p>Is there a good equivalent implementation of <code>strptime()</code> available for Windows? Unfortunately, this POSIX function does not appear to be available.</p> <p><a href="http://www.opengroup.org/onlinepubs/009695399/functions/strptime.html" rel="noreferrer">Open Group description of strptime</a> - summary: i...
<p>An open-source version (BSD license) of <code>strptime()</code> can be found here: <a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD" rel="noreferrer"><a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD" rel="noreferrer">http://cvsweb.netbsd.org/bsdweb....
<p>One alternative is to use <code>GetSystemTime</code> and send the time information to a function that parses it according to your format using <code>vsnprintf_s</code>. In the example below there is one function that creates a time string with milli second precision. It then sends the string to a function that forma...
41,660
<p>I was wondering if this seemed to familiar to any experience NHibernate developers or if someone could give me an idea as to where to start to try and resolve this issue:</p> <p>I inherited an NHibernate site written in ASP.NET 1.1 using NHibernate 0.6 and .NET remoting to the DAL layer residing on the database ser...
<p>Problem was non thread-safe nhibernate session factory. Changed project to use an http module to use one nhibernate session per request (and made sure not to open a session for rquests on non .as*x files) and all is well.</p>
<ul> <li>verify your connection settings.</li> <li>if you can, cache objects as much as you can to avoid battering the server</li> <li>make sure you've got your tables indexed...that's a huge one</li> <li>make sure log4net's logging is turned to warn/error so you're not writing an encyclopedia to the logs</li> </ul>
22,781
<p>I'm working on a quick project to monitor/process data. Essentially that's just monitors, schedules and processors. The monitor checks for data (ftp, local, imap, pop, etc) using a schedule and sends new data to a processor. They all have interfaces.</p> <p>I'm trying to find a sane way to use config to configure w...
<p>From Python 2.7 onwards you can specify the time to be used in the gzip header. N.B. filename is also included in the header and can also be specified manually.</p> <pre><code>import gzip content = b"Some content" f = open("/tmp/f.gz", "wb") gz = gzip.GzipFile(fileobj=f,mode="wb",filename="",mtime=0) gz.write(cont...
<p>In lib/gzip.py, we find the method that builds the header, including the part that does indeed contain a timestamp. In Python 2.5, this begins on line 143:</p> <pre><code>def _write_gzip_header(self): self.fileobj.write('\037\213') # magic header self.fileobj.write('\010') # comp...
33,090
<p>I am using VS 2008 with a very simple UpdatePanel scenario. But i cannot get UpdatePanel to work and cant seem to find out why</p> <p>I have in fact reverted to a very simple example to validate it is not my code: <a href="http://ajax.net-tutorials.com/controls/updatepanel-control/" rel="nofollow noreferrer">http:...
<p>If it's working locally, but not when deployed to a remote server, that usually indicates that you're using ASP.NET 2.0 and the ASP.NET AJAX extensions aren't installed on the remote server.</p> <p>If it's a server you have administrative control over, you can download the installer here: <a href="http://www.micro...
<p>Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.</p> <p>-Edoode</p>
15,962
<p>I have never much cared about self intersecting meshes when slicing with Cura. Geometry like the one below are often practical. I for instance add lots of rivets that self intersect with the base geometry:</p> <p><a href="https://i.stack.imgur.com/cRZqk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cRZq...
<p>Self intersecting meshes are considered dirty, yes. The reason you haven't had trouble before is probably that the software you were using was cleaning your mesh for you, behind the scenes. Generally speaking, these meshes can be cleaned without too much trouble by software like netfabb (<a href="https://www.netfabb...
<p>You can download MeshLab from <a href="https://sourceforge.net/projects/meshlab/" rel="nofollow noreferrer">https://sourceforge.net/projects/meshlab/</a> and use it to head stls.</p> <p>This video has healing instructions: <a href="https://www.youtube.com/watch?v=eLGIRAgLz4w" rel="nofollow noreferrer">https://www.y...
467
<p>With Symfony's Action Security if a user has not been identified he will be forwarded to the default login action as defined in the applications settings.yml file. How would I forward the user to the originally requested action after the user is successfully authenticated?</p>
<p>On first hit to your login action, store referer to the user session:</p> <pre><code>if(!$this-&gt;getUser()-&gt;hasParameter('referer')) { $this-&gt;getUser()-&gt;setParameter('referer',$this-&gt;getRequest()-&gt;getReferer()); } </code></pre> <p>and then when login succeeds, redirect user to stored referer wit...
<p>A related problem, but instead trying to perform the forward from a different action:</p> <p>If you have an action protected by sfGuard which is attempting to redirect to the referrer, you will get a redirect loop after signing in. This is because the sign-in page of sfGuard wil become the referrer. A parameter or ...
46,782
<p>Originally there was the DAL object which my BO's called for info and then passed to UI. Then I started noticing reduced code in UI and there were Controller classes. What's the decent recomendation.</p> <p>I currently structure mine</p> <pre><code>Public Class OrderDAL Private _id Integer Private _order ...
<p>I think there are several alternatives listed in this excellent book: <a href="https://rads.stackoverflow.com/amzn/click/com/0321127420" rel="nofollow noreferrer" rel="nofollow noreferrer">Patterns of Enterprise Application Architecture</a>. Some patterns that may be of interest to you:</p> <ul> <li><a href="http:/...
<p>Well your application shouldn't be instantiating seperate versions of the data acces layer, so you have that under control. The Psuedo code you posted is really hard to read though.</p> <p>The question is, what is your data access layer, and how much is there? That's going to dictate a good bit of what you do. If...
18,290
<p>Our SEO team would like to open up our main dynamic search results page to spiders and remove the 'nofollow' from the meta tags. It is currently accessible to spiders via allowing the path in robots.txt, but with a 'nofollow' clause in the meta tag which prevents spiders from going beyond the first page.</p> <p><c...
<p>To be honest you are looking at <strong>nofollow</strong> wrong. Chances are the search spiders are already especially Google, Yahoo, and MSN searching the nofollow pages, because they still have to hit those pages to see if they have a noindex.</p> <p>The real problem is <strong>nofollow</strong> doesn't actually...
<p>Google bots are pretty intelligent about not traversing an entire database of dynamically-generated pages, as long as the URLs give some hint that they are dynamic (i.e. file extension of .asp or .jsp, etc. and numeric ids as query parameters). If you use rewrite rules to make your URLs "friendly", then the bots ha...
44,843