instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>From the Java 6 <a href="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html" rel="noreferrer">Pattern</a> documentation:</p> <blockquote> <p>Special constructs (non-capturing)</p> <p><code>(?:</code><i>X</i><code>)</code>&nbsp;&nbsp;&nbsp;<i>X</i>, as a non-capturing group</p> <p>…</p> ...
<p>It means that the grouping is <a href="http://www.regular-expressions.info/atomic.html" rel="noreferrer">atomic</a>, and it throws away backtracking information for a matched group. So, this expression is possessive; it won't back off even if doing so is the only way for the regex as a whole to succeed. It's "indepe...
<p><code>(?&gt;X?)</code> equals <code>(?:X)?+</code>, <code>(?&gt;X*)</code> equals <code>(?:X)*+</code>, <code>(?&gt;X+)</code> equals <code>(?:X)++</code>.</p> <p>Taking away the fact that X must be a non-capturing group, the preceding equivalence is:</p> <p><code>(?&gt;X?)</code> equals <code>X?+</code>, <code>(?&g...
7,329
<p>What is the thread pitch of the Ender 3's bed leveling screws? The diameter measures about 4mm. Are they M4 0.7 (coarse) pitch or 0.5 (fine) pitch? I'd like to develop rigorous formulas for the amount to turn the knobs by after measuring (or visually inspecting, since I can see an accurate 0.2 mm first layer decentl...
<p>I measured mine with a thread gauge and it says the pitch is <strong>0.7 mm</strong>.</p> <p>So, as the stock adjustment wheels have 14 bumps around their circumference, turning by one of those is an adjustment of exactly 0.05 mm (assuming no backlash).</p> <p>I can't speak for anyone else's, but due to the availabi...
<p>I don't know what the value is, but there are a few ways to find out. It is very hard to measure this with a caliper, but it can be done, mark the upper and bottom of e.g. 10 windings and measure this with a caliper. Alternatively measure how much the screw drops after 10 full turns. </p> <p>There are special tools...
1,570
<p>I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc?</p> <p><strong>Update:</strong> I'm primarily looking for pointers as to how a map system is implemented (data structures, algorithms, etc).</p...
<p>Take a look at the <a href="http://www.openstreetmap.org/" rel="noreferrer">open street map project</a> to see how this sort of thing is being tackled in a truely free software project using only user supplied and licensed data and have a <a href="http://wiki.openstreetmap.org/index.php/Main_Page" rel="noreferrer">w...
<p>Another thought occurs to me regarding the cost of each traversal, but would increase the time and processing power required to compute. </p> <p><strong>Example:</strong> There are 3 ways I can take (where I live) to go from point A to B, according to the GoogleMaps. Garmin units offer each of these 3 paths in th...
2,493
<p>I need to diff two log files but ignore the time stamp part of each line (the first 12 characters to be exact). Is there a good tool, or a clever awk command, that could help me out?</p>
<p>Depending on the shell you are using, you can turn the approach <a href="https://stackoverflow.com/questions/44019/an-easy-way-to-diff-log-files-ignoring-the-time-stamps#44028">@Blair</a> suggested into a 1-liner</p> <pre><code>diff &lt;(cut -b13- file1) &lt;(cut -b13- file2) </code></pre> <p>(+1 to <a href="https...
<p>I want to propose a solution for Visual Studio Code:</p> <ol> <li>Install this extension - <a href="https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff" rel="nofollow noreferrer">https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff</a></li> <li>Configure it like this - <a href=...
6,565
<p>A similar question was asked <a href="https://stackoverflow.com/questions/198931/how-do-i-tell-if-net-35-sp1-is-installed">here</a>, but it was specific to .NET 3.5. Specifically, I'm looking for the following:</p> <ol> <li>What is the correct way to determine which .NET Framework versions and service packs are ins...
<p>The registry is <a href="https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" rel="noreferrer">the official way</a> to detect if a specific version of the Framework is installed. </p> <p><img src="https://i.stack.imgur.com/hiLch.png" alt="enter image desc...
<p>See <em><a href="http://msdn.microsoft.com/en-us/library/hh925568.aspx" rel="nofollow">How to: Determine Which .NET Framework Versions Are Installed</a></em> (MSDN).</p> <p>MSDN proposes one function example that seems to do the job for version 1-4. According to the article, the method output is:</p> <pre><code>v2...
24,267
<pre><code>public void PublicMethod(FooBar fooBar) { if (fooBar == null) throw new ArgumentNullException("fooBar", "fooBar cannot be null"); // log the call [added: Thanks S.Lott] _logger.Log("PublicMethod called with fooBar class " + fooBar.Classification); int action = DetermineAction(); ...
<p>I would say no.</p> <p>While it certainly holds true that you in <em>this</em> case knows that it has already been checked for nullability, in two months time the youngest intern will come along and write PublicMethod2 that also calls PrivateMethod, but lo and behold he forgot to check for null.</p>
<p>At least put a comment that PrivateMethod must have a non-null FooBar and that PublicMethod checks this.</p>
22,143
<p>When I load a HTML page with a .MOV embedded video on my App using a UIWebview it appears a broken icon, any idea? The same HTML page on Iphone Safari works fine and the media player is started without problem...</p>
<p>Where is the webpage? Is it embedded in your app? If you not giving the UIWebView a URL to load it from the server where it is make sure you set the baseURL properly so that the webview knows how to handle handle relative URLs.</p>
<p>When using the app sandbox, apple stops WebKit from accessing it's com.apple.security.WebKit.PluginAgent.</p> <p>You must enable these in the entitlements file with the appropriate entitlement of </p> <p>Add this line to the entitlements file as an ARRAY: com.apple.security.temporary-exception.mach-lookup.global-n...
34,866
<p>I have the age-old problem of a <code>div</code> wrapping a two-column layout. My sidebar is floated, so my container <code>div</code> fails to wrap the content and sidebar.</p> <pre class="lang-html prettyprint-override"><code>&lt;div id="container"&gt; &lt;div id="content"&gt;&lt;/div&gt; &lt;div id="sidebar"...
<p>Depending upon the design being produced, each of the below clearfix CSS solutions has its own benefits.</p> <p>The clearfix does have useful applications but it has also been used as a hack. Before you use a clearfix perhaps these modern css solutions can be useful:</p> <ul> <li><a href="https://css-tricks.com/sn...
<p>Have you tried this:</p> <pre><code>&lt;div style="clear:both;"/&gt; </code></pre> <p>I haven't had any problems with this method.</p>
25,975
<p>Really strange observation with my MP Select Mini V2 printing PLA. I've printed a dual-fan shroud so I can have a dedicated part-cooling fan. I've noticed that when I turn it on, the extruder starts stringing everywhere. Little tiny spider-web wisps. No amount of temperature change will make them go away (printing a...
<p>Prior to a move the print cooling fan causes the filament to cool on the outside while the nozzle is still hot, when it then moves it causes a strings to form that will be cooled instantly. This means that the cooling you have is too much and should be reduced.</p> <p>This printer has a single fan to cool the cold-...
<p>The fans are allowing the strings to harden instead of break. Maybe you should use more retraction or wipe before crossing perimeters to reduce material ooze during moves.</p>
1,035
<p>I have a flowlayout panel and on a resize event, I resize all the controls inside the flowlayout panel so they fit the width of the (flowlayoutpanel - padding - scroll bar width). On some resizes, the scroll bar is not shown, hiding most of the controls outside the area of the flowlayoutpanel while on other resizes...
<p>Try the <code>.PerformLayout()</code> method, see if that helps.</p>
<p>By using the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.refresh.aspx" rel="nofollow noreferrer">Refresh</a> method (inherited from Control) you can force the control to invalidate and redraw itself and its children.</p> <p>Edit: Curiously, are you doing this resize to get the effe...
19,971
<p>I'm currently trying to pass a mono threaded program to multithread. This software do heavy usage of "refCounted" objects, which lead to some issues in multithread. I'm looking for some design pattern or something that might solve my problem.</p> <p>The main problem is object deletion between thread, normally delet...
<p>If the count is part of the object then you have an inherent problem if one thread can be trying to <em>increase</em> the reference count whilst another is trying to remove the <em>last</em> reference. There needs to be an extra value on the ref count for each globally accessible pointer to the object, so you can al...
<p>Any object that you are sharing between threads should be protected with a mutex, and the same applies to refcount <em>handles</em> ! That means you will never be deleting the last one handle to an object from two threads. You might be concurrently deleting two distinct handles that happen to point to one object. </...
20,060
<p>I have seen <a href="https://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer">this topic here</a> about John Carmack's magical way to calculate square root, which refers to this article: <a href="http://www.codemaestro.com/reviews/9" rel="nofollow noreferrer">http...
<p>There is a book which gathers many of those 'magic tricks' and that may be interesting for you: <a href="https://rads.stackoverflow.com/amzn/click/com/0201914654" rel="nofollow noreferrer" rel="nofollow noreferrer">The Hacker's Delight</a>.</p> <p>You have for example many tricks like bit twiddling hacks etc... (yo...
<p>I'm a big fan of Bresenham Line, but man the <a href="http://www.andraka.com/cordic.htm" rel="nofollow noreferrer">CORDIC rotator</a> enabled all kinds of pixel chicanery for me when CPUs were slower.</p>
42,861
<p>Does anyone have an example using the table object in YUI library. More specifically, I'd like to dynamically load it from JSON or SQL?</p> <p><a href="http://www.grails.org/YUI+Plugin" rel="nofollow noreferrer">http://www.grails.org/YUI+Plugin</a></p>
<p>I just found this example. Will be trying it out this weekend. Looks like exactly what I was looking for.</p> <p><a href="http://marceloverdijk.blogspot.com/2008/06/grails-yui-datatable-example.html" rel="nofollow noreferrer">http://marceloverdijk.blogspot.com/2008/06/grails-yui-datatable-example.html</a></p>
<p>From the YUI documentation: <a href="http://developer.yahoo.com/yui/examples/datatable/index.html" rel="nofollow noreferrer">DataTable examples</a>. In particular, here's <a href="http://developer.yahoo.com/yui/examples/datatable/dt_xhrjson.html" rel="nofollow noreferrer">an example using JSON and XmlHttpRequest</a>...
15,153
<p>I'm trying to print a cylinder with Flashprint. Problem is, that the .stl file i created (with OpenSCAD) is totally ruined once loaded into Flashprint. With ruined I mean the round outline is now with spikes and steps everywhere. And by loaded I mean directly after loading, not even creating the .gx files. The outpu...
<p>From an electrical standpoint, a two-phase stepper motors (what most 3D printers use) works the same backwards and forwards, the phase just reverses. If you are stalling on only one direction, I would look to see if you have a mechanical bind in that direction. Generally a wiring issue will cause the motor to eith...
<p>Sounds like you are configured for NC switches but are using NO switches, causing them to invert their reported state. Issue a <strong>M119</strong> command and see if the endstop statuses are correct when none are triggered.</p>
775
<p>Jeff actually posted about this in <a href="http://refactormycode.com/codes/333-sanitize-html" rel="noreferrer">Sanitize HTML</a>. But his example is in C# and I'm actually more interested in a Java version. Does anyone have a better version for Java? Is his example good enough to just convert directly from C# to Ja...
<p>Don't do this with regular expressions. Remember, you're not protecting just against valid HTML; you're protecting against the DOM that web browsers create. Browsers can be tricked into producing valid DOM from invalid HTML quite easily. </p> <p>For example, see this list of <a href="http://ha.ckers.org/xss.html" r...
<p>The biggest problem by using jeffs code is the @ which currently isnt available. </p> <p>I would probably just take the "raw" regexp from jeffs code if i needed it and paste it into </p> <p><a href="http://www.cis.upenn.edu/~matuszek/General/RegexTester/regex-tester.html" rel="nofollow noreferrer">http://www.cis.u...
4,437
<p>I've got two collections (generic Lists), let's call them ListA and ListB.</p> <p>In ListA I've got a few items of type A. In ListB I've got some items of type B that have the SAME ID (but not same type) as the items in ListA, plus many more. I want to remove all the items from ListB that have the same ID as the on...
<p>Here are two options. Not sure which one is faster.</p> <pre><code>listB.RemoveAll(listA.Contains); foreach (string str in listA.Intersect(listB)) listB.Remove(str); </code></pre>
<p>simple loop:</p> <pre><code>for (item i: LISTA) { removeItem(i, LISTB); } method removeItem(Item, List) { for (Item i: List) { if (Item == i) List.removeItem(i); } } </code></pre>
30,308
<p>Using Ruby and Thin as a web service. Apache is also loaded. Can't access the web service because listing ports, such as <code>:3000</code> or <code>:6600</code>, in the GET url is not allowed. How is the port requirement removed?</p>
<p>Use Apache ProxyPass.</p> <p>cd /etc/apache2/sites-enabled/ sudo vi 000-default</p> <p>Edit Lines: ServerAdmin webmaster@localhost ProxyPass /breakfast <a href="http://localhost:4567/breakfast" rel="nofollow noreferrer">http://localhost:4567/breakfast</a> DocumentRoot /var/www</p> <p>sudo /etc/init.d...
<p>If you're talking about Apache HTTPD, either leave off the port, or specify "80" for the port.</p> <p>If you're talking about Apache Tomcat, you'll need to set up an HTTP Connector with port=80, but Tomcat will need to be launched as root.</p>
16,674
<p>Partial template specialization is one of the most important concepts for generic programming in C++. For example: to implement a generic swap function:</p> <pre><code>template &lt;typename T&gt; void swap(T &amp;x, T &amp;y) { const T tmp = x; y = x; x = tmp; } </code></pre> <p>To specialize it for a vector...
<p><a href="http://www.digitalmars.com/d/1.0" rel="nofollow noreferrer">D</a> supports partial specialization:</p> <ul> <li><a href="http://www.digitalmars.com/d/2.0/overview.html" rel="nofollow noreferrer">Language overview</a></li> <li><a href="http://www.digitalmars.com/d/2.0/template-comparison.html" rel="nofollow...
<p>Java has generics, which allow you to do similar sorts of things.</p>
49,376
<p>I recently read a discussion regarding whether managed languages are slower (or faster) than native languages (specifically C# vs C++). One person that contributed to the discussion said that the JIT compilers of managed languages would be able to make optimizations regarding references that simply isn't possible in...
<p>There are some benefits of <a href="http://en.wikipedia.org/wiki/Just-in-time_compilation" rel="nofollow noreferrer">JIT compilation</a> mentioned in Wikipedia:</p> <blockquote> <p>JIT code generally offers far better performance than interpreters. In addition, it can in some or many cases offer better performance t...
<p>An object reference in a managed framework is very different from a passed reference in C++. To understand what makes them special, imagine how the following scenario would be handled, at the machine level, without garbage-collected object references: Method "Foo" returns a string, which is stored into various coll...
49,437
<p>I'm currently using Wordpress to run my website. However, with each new release I become more concerned with software bloat and the convoluted table structures used to store my data. Maybe this is a fruitless pursuit. Features are always added to blogging software until it claims to be a CMS--and at that point yo...
<p>You do have the option of sticking with the 2.0 branch. This will be maintained with just bug fixes until 2010. Take a look at <a href="http://wordpress.org/download/legacy/" rel="nofollow noreferrer">http://wordpress.org/download/legacy/</a></p>
<p>None of the previous answers have really addressed the title of this question.</p> <p>How should the tables be constructed for a blog? That entirely depends on what you want to do with it, honestly.</p> <p>One approach could be to have a posts table and a comments table. The posts table could have the title, conte...
13,061
<p>We are migrating a web applicatin from vs05 to vs08. This application is using Telerik web controls. After I converted the project, and run, I get the exception: "A control is already associated with the element". I traced it down to a use control that has Telerik RadCombo box on it. However, I don't see anything ou...
<p>Search for the ID of the problematic combo box in your solution and see where it is used. If you have not set an ID attribute for the control - do so and make sure it is unique.</p> <p>If you are using AJAX requests make sure that you are updating all controls that need to be updated after AJAX. </p>
<p>Not sure if this helps, but we started getting this exception when we moved from 2.0 to 4.0. We were already disposing of the control but the fix was to also set it to undefined.</p> <pre><code>child.control.dispose(); child.control = undefined; </code></pre>
27,342
<p>When I build a site, I'd like to have at least one browser I can show it off in without any hacks or workarounds, and yet still retain maximum functionality. Knowing that none of the browsers have perfect standards adherence, which one comes closest?</p> <p>Also, are there any standards areas in which a single brow...
<p>The way most people I know work is to run Firefox(with Firebug) and develop in that. Firebug is an invaluable tool for debugging. They will usually take what the get there and try to squeak it into IE and other browsers. Not exactly the answer to your question (Its not 100% compliant but its close), but hopefully...
<p>Try Google Chrome it uses the WebKit which is feature complete for the latest standards. </p>
14,194
<p>I want to combine these:</p> <pre class="lang-py prettyprint-override"><code>keys = ['name', 'age', 'food'] values = ['Monty', 42, 'spam'] </code></pre> <p>Into a single dictionary:</p> <pre class="lang-py prettyprint-override"><code>{'name': 'Monty', 'age': 42, 'food': 'spam'} </code></pre>
<p>Like this:</p> <pre><code>keys = ['a', 'b', 'c'] values = [1, 2, 3] dictionary = dict(zip(keys, values)) print(dictionary) # {'a': 1, 'b': 2, 'c': 3} </code></pre> <p>Voila :-) The pairwise <a href="https://docs.python.org/3/library/functions.html#func-dict" rel="noreferrer"><code>dict</code></a> constructor and <a...
<p>method without zip function</p> <pre><code>l1 = [1,2,3,4,5] l2 = ['a','b','c','d','e'] d1 = {} for l1_ in l1: for l2_ in l2: d1[l1_] = l2_ l2.remove(l2_) break print (d1) {1: 'd', 2: 'b', 3: 'e', 4: 'a', 5: 'c'} </code></pre>
25,759
<p>By default the MVC Preview 5 web project comes with a HomeController.vb class. This sets the web URL to <a href="http://www.mywebsite.com/home/" rel="nofollow noreferrer">http://www.mywebsite.com/home/</a> by default. If I just wanted this to be <a href="http://www.mywebsite.com/" rel="nofollow noreferrer">http://...
<p>Answered already so I'm just going to direct you to <a href="https://stackoverflow.com/questions/15470/how-do-i-get-rid-of-home-in-aspnet-mvc">How do I get rid of Home in ASP.Net MVC?</a>. </p> <p><sup>Users with 10k+ rep can also refer to <a href="https://stackoverflow.com/questions/33861/aspnet-mvc-routing-basics...
<p>I'm not sure I understand your question, if what you want is to go to <a href="http://www.mywebsite.com/" rel="nofollow noreferrer">http://www.mywebsite.com/</a> and not have it be trailed by /home, that is the behavior you will get.</p> <p>Is there something else you were looking for?</p>
15,906
<p>I am looking to parse a URL to obtain a collection of the querystring parameters in Java. To be clear, I need to parse a given URL(or string value of a URL object), not the URL from a servlet request. </p> <p>It looks as if the <code>javax.servlet.http.HttpUtils.parseQueryString</code> method would be the obvious c...
<p>I think the idea is to use the HttpServletRequest instead. There is the getParameterMap(), getParameterNames() and getParameterValues() methods to start.</p> <p>There is also the getParameter(String paramname) method to get the value of a specific method.</p> <p>These make no distinction between querystring parame...
<p>As far as I know, there isn't one.</p> <p>It shouldn't be too difficult to write one yourself though. The hardest part, I imagine, would be decoding the URL name/values (which really isn't that hard, if you think about it), and you can use <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLDecoder.html#de...
30,936
<p>I saw the following interesting usage of tar in a co-worker's Bash scripts:</p> <pre><code>`tar cf - * | (cd &lt;dest&gt; ; tar xf - )` </code></pre> <p>Apparently it works much like rsync -av does, but faster. The question arises, how?</p> <p>-m</p> <hr> <p><strong>EDIT</strong>: Can anyone explain <em>why</e...
<p>It writes the archive to standard output, then pipes it to a subprocess -- wrapped by the parentheses -- that changes to a different directory and reads/extracts from standard input. That's what the dash character after the <code>f</code> argument means. It's basically copying all the visible files and subdirector...
<pre><code>tar cf - * </code></pre> <p>This uses tar to send * to stdout</p> <pre><code>| </code></pre> <p>This does the obvious redirect of stdout to...</p> <pre><code>(cd &lt;dest&gt; ; tar xf - ) </code></pre> <p>This, which changes PWD to the appropriate location and then extracts from stdin</p> <p>I do not k...
40,809
<p>New version of Management Studio (i.e. the one that ships with SQL Server 2008) finally has a Transact-SQL IntelliSense feature. However, out-of-the-box it only works with SQL Server 2008 instances.</p> <p>Is there some workaround for this?</p>
<p>There's no known trick 'in the wild' for getting around this, other than using CTP-6 of SQL Server 2008 (in favour of the RTM).</p> <p>the reasons for removing backward compatability (and a lot more discussion besides) are provided at the <a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?F...
<p>Has anyone tried either patching SSMS not to check the version (perhaps try looking at the binary differences between CTP 6 and RTM?), or patching SS 2005 to pretend to be 2008?</p> <p>Unclean, I know, but I don't see any other way.</p>
2,649
<p>A quick search gives me <a href="http://www.tawbaware.com/wc.htm" rel="noreferrer">tawbaware wc</a>, but it does not accept stdout as input stream, meaning I can not use pipe within a <em>DOS</em> session.</p> <p><em>Note:</em> </p> <p>I can not install cygwin or use powershell (which would have allowed a '<code>|...
<p>You can use the original "wc", built for windows: it is part of the <a href="http://gnuwin32.sourceforge.net/packages/coreutils.htm" rel="noreferrer">coreutils</a> package. Get the <a href="http://gnuwin32.sourceforge.net/downlinks/coreutils.php" rel="noreferrer">most recent coreutils exe</a>.</p>
<p><a href="http://sourceforge.net/project/showfiles.php?group_id=163416" rel="nofollow noreferrer">getgnuwin32</a> facilitates downloading and installing of gnuwin32 (which certainly has wc utility).</p>
30,707
<p>I am trying to create a multi dimensional array using this syntax:</p> <pre><code>$x[1] = 'parent'; $x[1][] = 'child'; </code></pre> <p>I get the error: <code>[] operator not supported for strings</code> because it is evaluating the <code>$x[1]</code> as a string as opposed to returning the array so I can append ...
<p>The parent has to be an array!</p> <pre><code>$x[1] = array(); $x[1][] = 'child'; </code></pre>
<p>I think what you want to do is to use $x['parent'] in the end, isn't it ?</p> <p>So it's not exactly $x = array() but more something like :</p> <pre><code>$x = array('parent' =&gt; array()); $x['parent'][] = 'child'; </code></pre>
26,103
<p>I wonder if anyone uses commercial/free java obfuscators on his own commercial product. I know only about one project that actually had an obfuscating step in the ant build step for releases.</p> <p>Do you obfuscate? And if so, why do you obfuscate?</p> <p>Is it really a way to protect the code or is it just a bet...
<p>If you do obfuscate, stay away from obfuscators that modify the code by changing code flow and/or adding exception blocks and such to make it hard to disassemble it. To make the code unreadable it is usually enough to just change all names of methods, fields and classes.</p> <p>The reason to stay away from changing...
<p>I guess it really comes down to <em>what</em> your Java code is for, how it's distributed and who your clients are. We don't obfuscate anything, as we've never found one that was particularly good and it tends to be more trouble than it's worth. If someone has access to our JAR files and has the knowledge to be able...
3,317
<p>I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on Windows XP SP3 and Internet Explorer 7.</p> <p>My add-in is using custom Folder Home Page which displays my custom form, which wraps Outlook View Control.</p> <p>I get COM Exception with 'Exception from HRESULT: 0xXXXXXXXX' description every ti...
<p>After a while, I finally find out what is the solution: change a name of the external storage to something new.</p> <p>During startup of the addin, it loads the non-default PST file, and changes its name (not the name of the pst file, but the name of the root folder) to "Documents".</p> <p>This is code:</p> <pre>...
<p>Dobri Dan, nency :)<br><br>I don't know if I can really offer a "silver bullet" solution given the information here...but here are a few ideas/notes to try out:<br><br>Having worked with Outlook on a few projects in the past, I can tell you that it is a funny bird sometimes when it comes to giving/granting access to...
16,123
<p>Using Vim, I'm trying to pipe text selected in visual mode to a UNIX command and have the output appended to the end of the current file. For example, say we have a SQL command such as:</p> <pre><code>SELECT * FROM mytable; </code></pre> <p>I want to do something like the following:</p> <pre><code>&lt;ESC&gt; V ...
<p>How about copying the selected text to the end of the file, select the copy and run the command? If you do not want to repeat the same commands over and over again, you can record the sequence by using <code>q</code> or add a new command. I have tried the latter as follows:</p> <pre><code>:com -range C &lt;line1&gt...
<p>Try</p> <pre><code>:r | YourCommand </code></pre> <p>For example:</p> <pre><code>:r ! echo foo </code></pre> <p>adds <code>foo</code> to your buffer.</p>
28,505
<p>I was wondering if anyone that has experience in both this stuff can shed some light on the <em>significant</em> difference between the two if any?</p> <p>Any specific strength of each that makes it suitable for any specific case?</p>
<p>This question is quite dated but as it is still getting traffic and answers I though I state my point here again even so I already did it on some other (newer) questions.</p> <p>I'm <em><strong>really really</strong></em> baffled that SimpleTest <strong>still</strong> is considered an alternative to phpunit. Maybe i...
<p>when there are thousands functions to test at one go, phpunit is way to go, simple test is falling short as it web based. </p> <p>I am still using simple web to for small scale test . </p> <p>But both are good</p>
5,452
<p>Has anyone found a way to get gcc to build/install on SCO6? With 2.95 and 4.3 I get to the point where it needs to use (2.95) or find (4.3) the assembler and that's where it fails.</p> <p>If anyone has figured this out I would appreciate the info!</p> <p>Thanks</p>
<p>I have came across to the same error message. After digging for a while, found out that one can supply xsd files in addition to wsdl file. So included/imported .xsd files in addition to .wsdl at the end of the wsdl command as follows:</p> <blockquote> <p>wsdl.exe myWebService.wsdl myXsd1.xsd myType1.xsd myXsd2.xs...
<p>In case someone hits this wall, here is what caused the error in my case:</p> <p>I have an operation:</p> <pre><code>&lt;wsdl:operation name="FormatReport"&gt; &lt;wsdl:documentation&gt;Runs a report, which is returned as the response&lt;/wsdl:documentation&gt; &lt;wsdl:input message="FormatReportRequest" /&gt...
10,304
<p>I'm trying to use <strong>NIS</strong> for authentication on a st of machines. I had to change one of the user ID numbers for a user account on the NIS server (I changed the userid for <code>username</code> from 500 to 509 to avoid a conflict with a local user account with id 500 on the clients). The problem is that...
<p>John O pointed me in the right direction. </p> <p>He is right. If you set "files: 0" in /etc/ypserv.conf, you can get ypserv to not cache files. If you have to restart ypserv after each make, this is the problem.</p> <p>The real solution is to look in /var/log/messages for this error: </p> <pre><code>ypserv[]...
<p>hmm, you're not supposed to have to restart the ypserver to have updates take effect; the <em>make</em> in /var/yp ought to do the trick. you might want to check the Makefile in /var/yp to be sure it's triggering on the right conditions (namely, passwd.by* should check the timestamp on /etc/passwd in some fashion,...
5,268
<p>We have been using the Client Access ODBC drivers when accessing AS/400 data from our .net applications and SQL DTS/SSIS packages. Are there third party drivers that provide better performance or functionality?</p>
<p>Our company is using the same Client Access drivers. As far as we know there are no other ones available. One issue we ran into last year was that there were no 64-bit drivers available so our servers that have applications connecting to the AS/400 must be 32-bit.</p>
<p>I'm not sure if it's better performance but a quick google turns up <a href="http://www.hitsw.com/products_services/sql400/odbc400/odbc400.html" rel="nofollow noreferrer">Hit ODBC/400</a>.</p>
38,014
<p>I have a HTML table that's generated in a JSP by the displaytag tag library. I would like to suppress any zeros that appear in the table, i.e. they should be replaced by a blank cell. Is there any straightforward way to achieve this?</p>
<p>I discovered that this can be achieved using a custom implementation of ColumnDecorator.</p> <pre><code>public class SuppressZeroDecorator implements DisplaytagColumnDecorator { /* (non-Javadoc) * @see org.displaytag.decorator.DisplaytagColumnDecorator#decorate(java.lang.Object, javax.servlet.jsp.PageCont...
<p>To my knowledge there isn't an "straightforward" way of handling this. The only data-related config property is whether to display nulls or not. </p> <p>You're better off handling this before the data gets to to the displaytag tag. Perhaps in the servlet that provides the data or a view helper class.</p>
41,181
<p>Basically what I want to do it this: a pdb file contains a location of source files (e.g. <code>C:\dev\proj1\helloworld.cs</code>). Is it possible to modify that pdb file so that it contains a different location (e.g. <code>\more\differenter\location\proj1\helloworld.cs</code>)?</p>
<p>You can use the source indexing feature of the Debugging Tools for Windows, which will save references to the appropriate revisions of the files in your source repository as an alternate stream in the PDB file.</p>
<p>It is certainly possible, as On Freund has already pointed out. But if it is only so that the sources can be located and loaded during debugging, then a better way would be to set the source path correspondingly. Once set in a debugger, it will preemt all hard coded paths inside PDBs.</p> <p> In windbg (for instanc...
4,763
<p>I usually hate posting these types of questions as normally I find that the best way to really learn is to figure out the answer yourself. </p> <p>However, I need an answer to this question really quickly as I have a client who can't run her business due to this problem.</p> <p>Yesterday my ASP.NET host provider m...
<p>Not sure if this will help, but I once had a client with the same type of problem. Their webhosting company made some changes, resulting in their website throwing similar kinds of errors. Managed to get things working again by adding the following just inside the System.Web section in web.config:</p> <pre><code>&...
<p>Is your web application calling a web service or accessing external web sites? If so, you might need to talk with your hosting provider and ask for the URI to be added to the list of allowed connection endpoints.</p>
30,500
<p>I'm writing a small tool in C# which will need to send and receive data to/from a website using POST and json formatting. I've never done anything like this before in C# (or any language really) so I'm struggling to find some useful information to get me started.</p> <p>I've found some information on the WebReques...
<p>WebRequest and more specifically the HttpWebRequest class is a good starting point for what you want to achieve. To create the request you will use the WebRequest.Create and cast the created request to an HttpWebRequest to actually use it. You will then create your post data and send it to the stream like:</p> <pre...
<p>in 3.5 there is a built-in jsonserializer. The webrequest is the right class your looking for.</p> <p>A few examples:</p> <ul> <li><a href="https://web.archive.org/web/20200925065333/http://geekswithblogs.net/JuanDoNeblo/archive/2007/10/24/json_in_aspnetajax_part2.aspx" rel="nofollow noreferrer">Link</a></li> <li><a...
11,667
<p>I've got some code that resizes an image so I can get a scaled chunk of the center of the image - I use this to take a <code>UIImage</code> and return a small, square representation of an image, similar to what's seen in the album view of the Photos app. (I know I could use a <code>UIImageView</code> and adjust the ...
<p>Update 2014-05-28: I wrote this when iOS 3 or so was the hot new thing, I'm certain there are better ways to do this by now, possibly built-in. As many people have mentioned, this method doesn't take rotation into account; read some additional answers and spread some upvote love around to keep the responses to this ...
<p>I wasn't satisfied with other solutions because they either draw several time (using more power than necessary) or have problems with orientation. Here is what I used for a scaled square croppedImage from a UIImage * image.</p> <pre><code>CGFloat minimumSide = fminf(image.size.width, image.size.height); CGFloat fin...
19,225
<p>For example, if I have:</p> <p>&lt;div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur urna felis, convallis quis, placerat in, elementum quis, libero. Nam quis lacus. Vivamus rhoncus quam et metus. Praesent et velit eget sem vestibulum volutpat. Integer sed risus. Integer quis libero id diam bi...
<p>The unreasonable way involves calculating from the x,y coordinates of the mouse and then counting in an internal map of the paragraph. This will of course break when the next user uses a different font/size.</p> <p>Look up those annoying intellitag ad popups that come when you rollover a keyword. You will notice ...
<p>I don't think it's possible. You'd have to surround each word in some kind of identifiable tag like a span. </p>
42,545
<p>I want to make some prints of pressure resistants. I am currently trying to print a simple cylinder to find the best parameters to make my prints airtight (by airtight I mean, it needs to resist to 10 bar).</p> <p>Here is the test model that I have made for this:</p> <p><a href="https://i.stack.imgur.com/IQyNO.png" ...
<p>This is going to be hard. Even holding a vacuum is hard (I've tried it and not succeeded). I'm not sure what the mechanism of air molecules getting thru the print is - whether it's defects in inter-layer bonding, defects at seams, imperfect mating with the fitting, or even permeability of the plastic itself. It migh...
<h2>Not without postprocessing</h2> <p>FDM is pretty much welding plastic to plastic. Many many layers. Each of them is a potential breaking point, a corner for stress to arise and break the print.</p> <h2>Easy with a hollow body</h2> <p>Printing a hollow item that can be filled with resin is comparatively easy. Once f...
2,198
<p>Assume my objects are in perfect working order (i.e. TDD makes me think they work).</p> <p>I have a list that I create like this (except indented properly):</p> <pre><code>var result = from v in vendors from p in v.Products orderby p.Name select p; </code></pre> <p>This work...
<p>(Edited for clarity.)</p> <p>The problem is the foreach loop, and the fact that the "a" variable is being captured and then changed each time. Here's a modification which will work, by effectively introducing a "new" variable for each iteration of the loop, and capturing that new variable.</p> <pre><code>foreach (...
<pre><code>var result = from v in vendors from p in v.Products where requiredAttributes.All(a =&gt; p.Attributes.Contains(a)) orderby p.Name select p; </code></pre> <p>HTH.</p>
23,081
<p>I've seen a few examples on how to do build deployment, however I have something unique that I'd like to do:</p> <ol> <li>Deploy the build to a folder that has the build number (eg. Project\Builds\8423)</li> <li>Alter the version number in the .NET AssmblyInfo.cs to match the build number</li> </ol> <p>Has anyone ...
<p>Deploying a build to a folder with the build number is pretty straightforward. <a href="http://confluence.public.thoughtworks.org/display/CCNET/NAnt+Task" rel="nofollow noreferrer">CruiseControl.NET's NAnt task</a> automatically passes a number of properties to your NAnt script. The <em>CCNetLabel</em> property is...
<p>I agree with BumperBox, a separate assembly to do the heavy(?) lifting of incrementing the build number is the route I took a couple of years ago, too. It has the advantage of being able to cope with other external factors, too. For example, you might want to increment the release or build numbers if a certain cri...
18,946
<p>Is it possible to check out subdirectories of a repository in Git?</p> <p>Imagine I am setting up a new WordPress installation. I will create two new directories for my plugin and theme customization:</p> <ul> <li><code>wordpress/wp-content/plugins/myplugins/</code> </li> <li><code>wordpress/wp-content/themes/myth...
<p><a href="http://schacon.github.io/git/git-read-tree.html#_sparse_checkout" rel="noreferrer">Sparse checkouts</a> are <a href="http://schacon.github.io/git/RelNotes/1.7.0.txt" rel="noreferrer">now in Git 1.7</a>.</p> <p>Also see the question “<a href="https://stackoverflow.com/q/4114887/578288">Is it possible to do ...
<p><strong>There is an inspiration here. Just utilize <code>shell regex</code> or <code>git regex</code>.</strong></p> <pre><code>git checkout commit_id */*.bat # *.bat in 1-depth subdir exclude current dir, shell regex git checkout commit_id '*.bat' # *.bat in all subdir include current dir, git regex </code></pr...
21,723
<p>I have been working with hibernate/JPA on JBoss for some months now and have one question that I can't find an answer or solution for.</p> <p>It seems like when creating new entity beans I'm not able to do a query before I at least have called EntityManager.persist(entityBean), or else I get the following error:</p...
<p>It seems logical that you cannot query for something which is not in the database yet, no? What you can do is to start using transactions. In a simple case your session will have one transaction which will be open until you close your session. At that moment transaction will be commited and all your changes will be ...
<p>I am aware that I can't query what has not yet been persisted - and this is not the case either. What I want to find is other Entity beans. Not just the same type, but any type of the Entity beans that I have. And then I get the TransientObjectException.</p> <p>Did I mention I use JBoss? I believe that using J2EE a...
35,931
<p>When using <code>call_user_func_array()</code> I want to pass a parameter by reference. How would I do this. For example</p> <pre><code>function toBeCalled( &amp;$parameter ) { //...Do Something... } $changingVar = 'passThis'; $parameters = array( $changingVar ); call_user_func_array( 'toBeCalled', $paramete...
<p>To pass by reference using <code>call_user_func_array()</code>, the parameter in the array must be a reference - it does not depend on the function definition whether or not it is passed by reference. For example, this would work:</p> <pre><code>function toBeCalled( &amp;$parameter ) { //...Do Something... } ...
<p>Except you are using deprecated functionality here. You'll generate a warning in PHP5 making it less than perfect.</p> <blockquote> <p>Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of runtime function name. If you would like to enable c...
37,674
<p>I know I can specify one for each form, or for the root form and then it'll cascade through to all of the children forms, but I'd like to have a way of overriding the default Java Coffee Cup for all forms even those I might forget.</p> <p>Any suggestions?</p>
<p>You can make the root form (by which I assume you mean <code>JFrame</code>) be your own subclass of <code>JFrame</code>, and put standard functionality in its constructor, such as:</p> <pre><code>this.setIconImage(STANDARD_ICON); </code></pre> <p>You can bundle other standard stuff in here too, such as memorizing ...
<p>Extend the JDialog class (for example name it MyDialog) and set the icon in constructor. Then all dialogs should extend your implementation (MyDialog).</p>
12,876
<p>How to convert last 3 digits of number into 0</p> <p>example 3444678 to 3444000</p> <p>I can do like </p> <p>(int)(3444678/1000) * 1000= 3444000</p> <p>But division and multiplication could be costly...</p> <p>Any other solution????</p>
<p>You could try</p> <pre><code>n - (n % 1000) </code></pre> <p>but the modulus operator might be as costly as a division. In any case, this sounds an awful lot like a micro-optimization. Is this really your bottleneck?</p>
<pre><code>int takeAway(int num) { for (int i = 1; i =&lt; 3; i++) { num = num/10; } return num; } int addZeroes(int num) { for (int i = 1; i =&lt; 3; i++) { num = num*10; } return num; } </code></pre> <p>Then you just call takeAway then addZeroes. Couldn't be simpler...
36,784
<p>I have created a site, which parses XML files and display its content on the appropriate page. Is my site a dynamic web page or static web page?</p> <p>How do dynamic and static web pages differ?</p> <p>I feel it's dynamic, because I parse the content from xml files; initially i don't have any content in my main p...
<p>I would describe your pages as dynamic. "Static" usually means that the file sitting on the web server is delivered as-is to the user; since you're assembling the pages from data files, I'd call them dynamic even if you're not building in any dynamically-changing data.</p> <p>I don't think this is a hard and fast d...
<p>Static web pages would be plain HTML content that are delivered. If you are processing any type of XML files at the server side and generating content accordingly, this is a dynamic page. Static pages change content when the page is actually edited &amp; modified.</p> <p>First result on Google if you had searched f...
35,433
<p>I am using ASP.NET to transmit a .jar file. This code works perfectly on IE. However on Firefox the file downloads, corrupt. What is the best way to fix it? Below is the code I am using.</p> <pre><code>private void TransferFile() { try { string filePath = Server.MapPath("SomeJarFIle.jar"); ...
<p>I don't see a case for ".jar" in the ReturnExtension() function (which I think might be better off named "ReturnMimetype"). Could that be the problem, or did you just forget to paste it in?</p> <p>The mimetype for .jar is supposed to be <strong>application/java-archive</strong>. Details here: <a href="http://en.wik...
<p>I only see two things, it doesn't appear you have a mime type for the .jar file extension.</p> <p>Two I personally use writefile rather than transmit, but I'm not sure of the difference.</p>
25,317
<p>Does anybody know, if closures will be in Java 7? </p>
<p>At Devoxx 2008, <a href="http://java.dzone.com/articles/java-7-update-mark-reinhold-de" rel="nofollow noreferrer">Mark Reinhold made it clear</a> that closures <em>will not</em> be included in Java 7.</p> <hr> <p>Wait! Closures <em>will</em> be included in Java 7. Mark Reinhold <a href="http://blogs.oracle.com/mr/...
<p>Closure won't definitively be present in Java 7, but if you are looking for a lighter solution to have closure in java right now check out how they have been implemented in the lambdaj library:</p> <p><a href="http://code.google.com/p/lambdaj/wiki/Closures" rel="nofollow noreferrer">http://code.google.com/p/lambdaj...
14,235
<p>I recently upgraded from Delphi 4 to Delphi 2009. With Delphi 4 I had been using <a href="http://web.archive.org/web/20001205122400/http&#58;//www.eccentrica.org/gabr/gpprofile/gpprofile.htm" rel="noreferrer">GpProfile by Primoz Gabrijelcic</a> as a profiler and <a href="http://web.archive.org/web/20031204135824/htt...
<p>For the price, you cannot beat FastMM4 as a memory tracker. It's simple to use yet powerful and well integrated with Delphi.<br> I guess that you know that, without downloading, installing or changing anything else, just putting this line</p> <pre><code>ReportMemoryLeaksOnShutDown := True; </code></pre> <p>anywher...
<p>The FastMM4 memory manager <a href="https://stackoverflow.com/questions/1701671/how-to-monitor-or-visualize-memory-fragmentation-of-a-delphi-application/1701917#1701917">mentioned in this older answer</a> ("<strong>How to monitor or visualize memory fragmentation of a delphi application</strong>") keeps a list of al...
37,200
<p>My company unwittingly switched from cvs to subversion and now we're all wishing we had cvs back. I know there's tools to migrate history and changes from cvs to svn and there's no equivalent to do the reverse. Any suggestions or ideas on how to do this?</p>
<p>I originally added this as a comment to someone else's answer, but then realized that it was an answer, of sorts. I have done these sorts of transitions before, where there was no existing way to convert from one SCM system to another.</p> <p>It's not rocket science to write a script that takes the list of commits ...
<p>the only 2 drawbacks of subversion I can think of users coming from CVS are</p> <ul> <li>the speed of checkouts over http(s)</li> <li>the lack of modulaliases</li> </ul> <p>the first one can be solved by using svn(+ssh) which is the more comparable format as CVS uses its own protocol as well. the second one is a l...
19,342
<p>I am working on a WPF application that opens and displays XPS documents. When the application closes, the specification is the application should delete the opened XPS document for clean up. However, when opening a certain XPS document, the application throws an exception that the file is still in use when it tries ...
<p>Make the xpsDocument a member, then don't call close() on it :)</p>
<p><a href="http://blogs.msdn.com/junfeng/archive/2008/04/21/use-htrace-to-debug-handle-leak.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/junfeng/archive/2008/04/21/use-htrace-to-debug-handle-leak.aspx</a></p> <p>You can figure out who holds the handle and the unmanaged stack using WinDbg</p> <p>EDIT: And of...
35,860
<p>I am looking for a good way to transfer non-trivial (10G > x >10MB) amounts of data from one machine to another, potentially over multiple sessions.</p> <p>I have looked briefly at</p> <ul> <li>*ftp (sftp, tftp, ftp)</li> <li>http</li> <li>torrents (out because I will not have a seed network in general)</li> <li>r...
<p>I use rsync (over SSH) to transfer anything that I think might take more than a minute. </p> <p>It's easy to rate-limit, suspend/resume and get progress reports. You can automate it with SSH keys. It's (usually) already installed (on *nix boxes, anyway).</p> <p>Depending on what you need, rsync can probably ada...
<p>Well, HTTP is a good option, in that it supports restarting partial transfers by using <a href="http://en.wikipedia.org/wiki/Byte_serving" rel="nofollow noreferrer">byte ranges</a>. FTP or TFTP are good because you can get server software that's extremely simple to configure, rather than having to lock down somethin...
28,100
<p>Just could not get this one and googling did not help much either.. </p> <p>First something that I know: Given a string and a regex, how to replace all the occurrences of strings that matches this regular expression by a replacement string ? Use the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String....
<pre><code>[^a-zA-Z]+ </code></pre> <p>Will do it nicely.</p> <p>You just need a <a href="http://www.regular-expressions.info/repeat.html" rel="nofollow noreferrer">greedy quantifier</a> in order to match as many non-alphabetical characters you can, and replace the all match by one '+' (a - by default - greedy quanti...
<pre><code>String unwantedCharactersRegex = "[^a-zA-Z]" </code></pre> <p>This matches a single non-letter. So each single non-letter is replaced by a +. You need to say "one or more", so try</p> <pre><code>String unwantedCharactersRegex = "[^a-zA-Z]+" </code></pre>
40,119
<p>I was writing some <strong>ASP.NET</strong> control when I came to the scenario where I needed to remove items from a list, only when they matched a certain condition.</p> <p>The <code>RemoveAll</code> method of the generic <code>List</code> class does a good job, but removes <em>all</em> items that match the condi...
<p>If you want to specify both a limit for number of items to remove and a condition to select the items to remove, you can use this approach:</p> <pre><code>int limit = 30; // Suppose you want to remove 30 items at most list.RemoveAll(item =&gt; ShouldIRemoveThis(item) &amp;&amp; limit-- &gt; 0); </code></pre>
<p>Can you use LINQ? If so, you can just use the .Take() method and specify how many records you want (maybe as total - N).</p>
3,719
<p>I have a repair part that I need to print with ABS and I know that I have warping problems with ABS.</p> <p>I'm now trying to mitigate this by printing a circle around my object and use more brim. You can consider this as a manually designed skirt, but I want the brim to be on both sides of the skirt.</p> <p>However...
<p>When there's a cut in the outer ring (the manual skirt), Slic3r will fill the area as expected:</p> <p><a href="https://i.stack.imgur.com/Lb2np.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lb2np.png" alt="Brim in the gap" /></a></p>
<p><a href="https://i.stack.imgur.com/t2WwV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t2WwV.png" alt="enter image description here" /></a></p> <p>Prusa Slicer 2.2.0 in print settings skirt and brim, set distance from object to zero</p> <p>Other slicers should have same capability. As long as yo...
1,697
<p>Trying to install the RMagick gem is failing with an error about being unable to find ImageMagick libraries, even though I'm sure they are installed.</p> <p>The pertinent output from gem install rmagick is:</p> <pre><code>checking for InitializeMagick() in -lMagick... no checking for InitializeMagick() in -lMagick...
<p>problem solved.</p> <p>RMagick was unable to find ImageMagick because I neglected to build the shared objects (there were no .so files installed as you can see from the "ls" in the original question). The solution was to add <code>--with-shared</code> to my configure options.</p> <p>This however caused other probl...
<p>The linker cannot find libMagick in the standard places. Maybe you installed ImageMagick in a non standard place you have to specify via LDFLAGS?</p>
15,931
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/8127/pre-build-task-deleting-the-working-copy-in-cruisecontrol-net">Pre-build task - deleting the working copy in CruiseControl.NET</a> </p> </blockquote> <p>I would like to delete my working directory during t...
<p>One of two ways.</p> <ol> <li>If you're already using an MSBuild file or something similar, add the action to the MSBuild file.</li> <li>Instead of directly executing some command, create a batch file that executes that command and then deletes the directory, and have CCnet call that batch file instead.</li> </ol>
<p>My guess is that you want to delete the working directory <em>before</em> CruiseControl.NET gets the latest code from source control. If this is the case, then the only way to accomplish this is to write a custom source control provider for CruiseControl.NET that first deletes the working directory and then gets the...
4,659
<p>I am using the following jquery code:</p> <pre><code>$("#top ul li.corner").mouseover(function(){ $("span.left-corner").addClass("left-corner-hover"); $("span.right-corner").addClass("right-corner-hover"); $("span.content").addClass("content-hover"); }).mouseout(function(){ $("span.left-corner").rem...
<pre><code>py&gt; data = "0010011010011101" py&gt; data = [data[8*i:8*(i+1)] for i in range(len(data)/8)] py&gt; data ['00100110', '10011101'] py&gt; data = [int(i, 2) for i in data] py&gt; data [38, 157] py&gt; data = ''.join(chr(i) for i in data) py&gt; data '&amp;\x9d' </code></pre>
<h1>Python 3 and number.to_bytes</h1> <p>With Python 3 you can convert numbers to bytes natively with <a href="https://docs.python.org/3/library/stdtypes.html#int.to_bytes" rel="nofollow noreferrer">number.to_bytes</a>. The byte array can be written directly to a file.</p> <pre><code>&gt;&gt;&gt; import math,sys &gt;&...
42,315
<p>I've built a nice website system that caters to the needs of a small niche market. I've been selling these websites over the last year by deploying copies of the software using Capistrano to my web server.</p> <p>It occurs to me that the only difference in these websites is the database, the CSS file, and a small s...
<p>There are advantages to using separate DBs (including those you already listed):</p> <ul> <li>Fulltext searches will become slow (depending on your server's capabilities) when you have millions of large text blobs to search.</li> <li>Separating the DBs will keep your table indexing speed quicker for each client. I...
<p>I would go for a single database, using client IDs - you should be able to make the refactoring less painful by using some form of base model, and a named scope to scope any actions to that client's ID.</p> <p>You could use an indexing library, such as Ferret, or something along those lines, to deal with the issue ...
45,511
<p>When parsing HTML for certain web pages (most notably, any windows live page) I encounter a lot of URL’s in the following format.</p> <p>http\x3a\x2f\x2fjs.wlxrs.com\x2fjt6xQREgnzkhGufPqwcJjg\x2fempty.htm</p> <p>These appear to be partially UTF8 escaped strings (\x2f = /, \x3a=:, etc …). Is there a .Net API that ...
<p>What you posted is not valid HTTP. As such, of course <code>HttpUtility.UrlDecode()</code> won't work. But irrespective of that, you can turn this back into normal text like this:</p> <pre><code>string input = @"http\x3a\x2f\x2fjs.wlxrs.com\x2fjt6xQREgnzkhGufPqwcJjg\x2fempty.htm"; string output = Regex.Replace(inpu...
<p>Did you try <a href="http://msdn.microsoft.com/en-us/library/system.web.httputility.urldecode.aspx" rel="nofollow noreferrer">HttpUtility.UrlDecode</a>?</p>
46,974
<p>Starting with the following LINQ query:</p> <pre><code>from a in things where a.Id == b.Id &amp;&amp; a.Name == b.Name &amp;&amp; a.Value1 == b.Value1 &amp;&amp; a.Value2 == b.Value2 &amp;&amp; a.Value3 == b.Value3 select a; </code></pre> <p>How can I remove (at runtime) one or more of the conditions i...
<p>Rather than try to change existing where clauses, I'd refactor it to this:</p> <pre><code>from a in things where a.Id == b.Id where a.Name == b.Name where a.Value1 == b.Value1 where a.Value2 == b.Value2 where a.Value3 == b.Value3 select a; </code></pre> <p>That then becomes:</p> <pre><code>things.Where(a =&...
<p>Try to separate things. First isolate the where condition from the rest of your query then process it and use standard query methods instead of the built in syntactic sugar. Eg.:</p> <pre><code> IQueryable&lt;MyClass&gt; things = null; MyClass b = new MyClass(); Expression&lt;Func&lt;MyClass, bool&gt...
42,193
<p>I know that codeIgniter turns off GET parameters by default. </p> <p>But by having everything done in POST, don't you get annoyed by the re-send data requests if ever you press back after a form submission?</p> <p>It annoys me, but I'm not sure if I want to allow GET purely for this reason.</p> <p>Is it such a b...
<p>When I first started working with CodeIgniter, not using GET really threw me off as well. But then I realized that you can simulate GET parameters by manipulating the URI using the built-in <a href="http://codeigniter.com/user_guide/libraries/uri.html" rel="noreferrer">URI Class</a>. It's fantastic and it makes your...
<p>GET parameters are cached by the web browser, POST is not. So with a POST you don't have to worry about caching, so that is why it is usually prefered. </p>
43,403
<p>I was just shopping for filament, and saw some glowing claims about PETG being as easy to work with as PLA, but as strong as ABS, and less brittle. Anyone know if that's actually true, or what the tradeoffs are?</p>
<p>PETG is great stuff to work with. It is stronger than ABS also. It prints slower than ABS and PLA. The formulas vary quite a bit from vendor to vendor. I have used 3 brands, and each of their properties vary. </p> <p>From my experience you do have to be careful with moisture. You'll be able to tell you have moistur...
<p>I love PETG. When I first started I always used ABS because I thought it was the best and didn't see the point in using PLA. However, after a few years of playing around I no longer use ABS. I use PLA for when I am testing and PETG when I want to print something that will be used, ike parts or models. </p> <p>PETG ...
160
<p>What do I put in my order by?? I want to order by Name. I have moved the orderby after the distinct because I read that it needs to be done last.</p> <pre><code> var result = (from r in db.RecordDocs where r.RecordID == recordID select new { ...
<p>Just do</p> <pre><code>.OrderBy(doc =&gt; doc.Name) </code></pre>
<p>Another option, if you really prefer the query expression syntax would be to chain your query construction across multiple statements:</p> <pre><code>var query = from r in db.RecordDocs where r.RecordID == recordID select new { DocTypeID = r.Document.DocType.DocTypeID, Name = r.Document....
31,756
<p>I need a WiX 3 script to display to display only 2 dialogs: Welcome &amp; Completed. Thats it no need for EULA, folder selection etc. All help appreciated.</p>
<p>All you need to do is add this in your WIX script, it will give you the WelcomeDlg before the installation and show the Installation progress, then the Exit Dialog. Don't forget to add the WixUIExtension.dll to your references.</p> <pre><code>&lt;UI Id="UserInterface"&gt; &lt;Property Id="WIXUI_INSTALLDIR" Value...
<p>If you are using Visual Studio and Wix 3.8 then you could create Wix Setup project and use text below as content of Product.wxs. In my case I needed to copy python and text file into destination dir. Thanks again for original masterpiece, comrade CheGueVerra:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&...
24,498
<p>I'm getting the error: wintypes.dcu not found several times a day in the Delphi 2009 IDE, after this error code completion stops working, also I can't open any unit's source code with Ctrl + Click, then I have to reopen the IDE to fix it.</p> <p>Anyone has a clue about what can be causing this?</p> <p>The only IDE...
<p>wintypes.pas and winprocs.pas has been replaced with windows.pas (since a long time). You should use Unit Aliases to replace all wintypes with windows.</p>
<p>Why wintypes.dcu cannot be found any longer, I do not know. But the other two are obvious follow up errors: if Delphi cannot compile the code due to syntax errors (and a missing file is considered a syntax error), it stops code completion and cannot locate source code any longer using Ctrl + Click.</p>
36,039
<p>I am developing on a LAMP(erl) stack and know of several ways to store obscured passwords. I'd like to hear from those who feel they have a best practice, given MySQL 4.1.1 and Perl 5.8, and the reasons why it's the best.</p> <p>One option I have read about, using the MySQL ENCODE() and DECODE() functions, sounds ...
<p>I think a salted hash with a proper hash function like <a href="http://search.cpan.org/~dido/SHA256-0.01b/SHA256.pod" rel="nofollow noreferrer">SHA-256</a> is the best. Passwords that are reversible are not as safe as those who cannot be reversed. Without an external Perl module, you can use instead the built in SHA...
<p>If you can decrypt a password, your security is flawed. You should always hash the password with a salt, MD5 is popular but there are superior hashing such as SHA and SHA-256.</p>
41,081
<p>I have got this error when using Enterprise Library 3.1 May 2007 version. We are developing a product and have a common lib directory beneath the Subversion Trunk directory</p> <p>&lt;>\Trunk\Lib\ into which we put all the third party DLLs. Inside this we have Microsoft\EnterpriseLibrary\v3.1 in which we have copi...
<p>I used to get that when I developed against the signed version of the dll and deployed where only the unsigned version was available.</p> <p>Also, <a href="http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx" rel="noreferrer">fuslogvw.exe</a>. EVERY. TIME.</p>
<p>maybe you should check the Assembly- and FileVersion of the dll. if they do not match this exception can occur.</p>
45,871
<p>I have a visual studio solution with the following projects:</p> <ol> <li>UI</li> <li>DataAccess</li> <li>BusiessLogic</li> <li>BusinessObjects</li> </ol> <p>I now have a bunch of code that generates reports that are sent out via email or saved as csv files.</p> <p>These ReportGenerators classes take in business ...
<p>I would create a separate reporting project. It doesn't belong in the UI (I assume they run in the background) - it is effectively a 'reporting logic' layer. </p> <p>If you think about how you might want to support reportng, you may want a backend service but you might want to expose the data via a web service as w...
<p>A agree with manwood's post - you should build them as reports (put a sproc behind the reports if necessary) for the following reasons:</p> <ul> <li><p>You can run the reports and display them through the ReportViewer control. This is fairly straightforward to do.</p></li> <li><p>You (and more importantly other pe...
37,532
<p>Is there a way to Invoke an overloaded method using reflection in .NET (2.0). I have an application that dynamically instantiates classes that have been derived from a common base class. For compatibility purposes, this base class contains 2 methods of the same name, one with parameters, and one without. I need t...
<p>You have to specify which method you want: </p> <pre><code>class SomeType { void Foo(int size, string bar) { } void Foo() { } } SomeType obj = new SomeType(); // call with int and string arguments obj.GetType() .GetMethod("Foo", new Type[] { typeof(int), typeof(string) }) .Invoke(obj, new object[...
<p>Use the GetMethod overload that takes a System.Type[], and pass an empty Type[];</p> <pre><code>typeof ( Class ).GetMethod ( "Method", new Type [ 0 ] { } ).Invoke ( instance, null ); </code></pre>
27,598
<p>I am using ActiveReports with ASP.NET but I think answer for any similar reporting component will do.</p> <p>I have two resultset to merge and show in a single report, like:</p> <pre><code>Table 1: Name Job Start End Jack Some service 1992 1997 Jack Some Sales Exp 1998 2007 Jane Some programm...
<p>Use subreports... Create a main report that will have two subreports. One subreport for job history and one subreport for training history. The main report will need a query that will return a list of people. Then for each Person in the detail of the main report, set a parameter on each of the child subreports that ...
<p>You should select this two tables with "left-join", create a "GroupHeader/Footer" section in report and set "DataField" on "GroupHeader" section to field, which should be used as grouping.</p> <p>Look at the samples from ActiveReports, they surely has a sample for grouping.</p>
35,112
<p>In order to improve my open source project, I need testers. I have created my project independently, so up to now I have been the sole coder and tester. I have tested the thing to death, but as we all know it is dangerous as a developer to test your own code. I'm looking for ideas on how I can get some other eyes t...
<p>Are you looking for "testers" or "users"? There's a world of difference.</p> <p>A tester uses <em>his</em> time and energy to find <em>your</em> bugs. How many people are willing to do that? At a rough guess, I'd say zero.</p> <p>A user uses <em>your</em> software to solve <em>his</em> problems. He reports bug...
<p>Release an early version, announce it on <a href="http://freshmeat.net/" rel="nofollow noreferrer">freshmeat</a>, and wait for the world to beat a path to your door?</p>
18,210
<p>I've been 3D printing for a while and I've noticed that, when printing small parts, my colored plastics (PLA, PLA+ and ABS) have better layer adhesion than black ones.</p> <p>Did you notice this?</p> <p>What could be the cause?</p>
<p>Not inherently.</p> <p>There are two things at work that might cause one color to test weaker than others even as its properties otherwise are functionally identical:</p> <ol> <li>A bad print among good ones.</li> <li>A bad roll among good ones.</li> </ol> <p>Let's take a look at both, then do a little excursus into...
<p>Not inherently.</p> <p>There are two things at work that might cause one color to test weaker than others even as its properties otherwise are functionally identical:</p> <ol> <li>A bad print among good ones.</li> <li>A bad roll among good ones.</li> </ol> <p>Let's take a look at both, then do a little excursus into...
1,184
<p>Is it possible (in Vb.Net 2005), without manually parsing the dataset table properties, to create the table and add it to the database?</p> <p>We have old versions of our program on some machines, which obviously has our old database, and we are looking for a way to detect if there is a missing table and then gener...
<p>See this MSDN Forum Post: <a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/4929a0a8-0137-45f6-86e8-d11e220048c3/" rel="nofollow noreferrer">Creating a new Table in SQL Server from ADO.net DataTable</a>. </p> <p>Here the poster seems to be trying to do the same thing as you, and p...
<p>Here is the code: </p> <pre class="lang-cs prettyprint-override"><code>SqlConnection con = new SqlConnection("Data Source=.;uid=sa;pwd=sa123;database=Example1"); con.Open(); string sql = "Create Table abcd ("; foreach (DataColumn column in dt.Columns) { sql += "[" + column.ColumnName + "] " + "nvarchar(50)"...
3,715
<p>When setting up a rollover effect in HTML, are there any benefits (or pitfalls) to doing it in CSS vs. JavaScript? Are there any performance or code maintainability issues I should be aware of with either approach?</p>
<p>CSS is fine for rollovers. They're implemented basically using the <code>:hover</code> pseudo-selector. Here's a really simple implementation:</p> <pre><code>a{ background-image: url(non-hovered-state.png); } a:hover{ background-image: url(hovered-state.png); } </code></pre> <p>There are a few things you n...
<p>I'd stay on the CSS side of the house, but I've done very little Javascript.</p> <p>CSS seems to be easier to standardize across browsers than Javascript, though that may be changing with the advent of Chrome's V8 and Firefox's upcoming new rendering tool.</p>
21,144
<p>The IntelliJ IDEA short-cut to reformat source code is <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd>. This happens to lock the screen in KDE (Gnome too?). How can I disable this so IntelliJ receives the key sequence?</p>
<p>Under the K menu, go to the Control Center.</p> <p>Regional &amp; Accessibility | Keyboard Shortcuts | Shortcut Schemes tab, Global Shortcuts tab.</p> <p>In the search box, type "lock", which should narrow the visible shortcuts and show the <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd> one ("Lock Session").</p> <p>...
<p>Another option is to change the Idea keymap to use Default for KDE. You can go to <em>File -> settings -> keymap</em> and then select the <strong>Default for KDE</strong> option from the drop down </p>
25,918
<p>.Net Compact Framework</p> <p>Scenario: User is on a screen. Device can't finds a printer and asks the user if they want to try again. If they click "No", the current screen is closed and they are returned to the parent menu screen. If they click the "No" button multiple times, the first click will be used by the N...
<p>Random thoughts:</p> <ul> <li>Disable the some of the controls on the parent dialog while a modal dialog is up. I do not believe that you can disable the entire form since it is the parent of the modal dialog.</li> <li>Alternatively I would suggest using a Transparent control to catch the clicks but transparency i...
<p>you can skip pending clicks by clearing the windows message queue with Application.DoEvents();</p> <p>We use the following custom Event class to solve your problem (preventing multiple clicks and showing a wait cursor if necessary):</p> <pre><code>using System; using System.Windows.Forms; public sealed class Even...
18,532
<p>I hit this error while my web application was trying to execute a SELECT INTO on a MSSQL 2005 database. I really have two questions:</p> <ol> <li>What does this error mean and how does this happen?</li> <li>Is there a way to prevent these errors by coding in a different way?</li> </ol>
<p>Besides the obvious, that somebody changed the table while the code was executing, it could be a naming conflict with temp tables created in the SQL. It could be that there are two temp tables with different schemas, but they have the same name.</p>
<p>You have to specify dbo. as the schema for the first table.</p>
19,620
<p>Does anyone use "space saver" style vacuum storage bags to keep fillament dry? I picked up some Ziploc space bags, but they are larger than ideal. Would probably fit 2.5 spools. I would love a smaller version just big enough for one spool.</p>
<p>I've read people are using them, makes sense, the less air you contain, the less moisture would be in the bag. Myself, I'm using IKEA ziplock bags (and moisture absorbing sachets), they come in many sizes.</p>
<p>I have a commercially available product known as a foodsaver (TM) which removes the air from the bag and really squeezes tightly around the spool. The width of the bags I use barely takes the typical spool but it does fit with a little elbow grease.</p> <p>I include a bag of desiccant in each bag to pull any residu...
1,369
<p>I have a winform app that calls a web service to check for updates. This works in dev and it also works everywhere else I've tried it, just not on the installed copy on my machine (which happens to be the same in dev).</p> <p>The error is:</p> <p>Cannot execute a program. The command being executed was "C:\WINDOW...
<p>The ".cmdline" file is an autogenerated file produced by the .NET framework. The application is attempting to real-time compile an XML Serializer used to parse the data from the web service.</p> <p>Have you verified that you can execute "csc.exe" from a command-line window? Even just typing "C:\WINDOWS\Microsoft.NE...
<p>If AppLocker is enforced, please allow below (add as path exception) </p> <p><code>c:\windows\MICROSOFT.NET\FRAMEWORK\V2.0.50727\CSC.EXE</code> <code>c:\windows\MICROSOFT.NET\FRAMEWORK\V2.0.50727\CVTRES.EXE</code></p>
8,764
<p>Does Geronimo provides a standalone transaction manager? And if it does, is it possible to use it in Tomcat?</p>
<p><a href="http://openejb.apache.org/" rel="nofollow noreferrer">Apache OpenEJB</a> is embedded implementation of Geronimo EJB container that includes Transaction Manager. OpenEJB can be embedded into Tomcat which is one of its intended usages.</p>
<p>AFAIK, Geronimo uses <a href="http://jencks.codehaus.org/Transaction+Manager" rel="nofollow noreferrer">Jencks</a> that can be used standalone. But I can't say it's heavily documented. I'd rather consider using <a href="http://www.atomikos.com/" rel="nofollow noreferrer">Atomikos</a> or <a href="http://www.jboss.org...
24,632
<p>I have a class file that contains all the classes that are needed for a certain web application. Currently I'm at line 7269 and it contains numerous classes. I'm not particularly worried but I've started to notice that when working on this file Visual Studio responds slower. I'm thinking that this may be caused by t...
<p>Egad.</p> <p>It's highly recommended by just about everyone that classes are contained in a file per class.</p> <p>Lines isn't very relevant directly, but it can be a symptom that you're creating an overly complex god class and need to break the logic up. Unit test driven development forces this when done correctl...
<p>1 class, 1 File, annakata is absolutely right.</p> <p>In some cases really big classes you might consider using partial classes to split them in different files.</p> <p>With only one really big file... that must be a nightmare to work in a team, how do you guys do it? I am guessing no source control and every chan...
48,943
<p>VB 6: How can I execute a .bat file but wait until its done running before moving on?</p>
<p>You will need to use Win32 API calls to <a href="http://msdn.microsoft.com/en-us/library/bb762154(VS.85).aspx" rel="noreferrer">ShellExecuteEx</a> and WaitForSingleObject on the process handle returned from ShellExecuteEx in the SHELLEXECUTEINFO structure. This is old code which I've pulled out of a project. It was...
<p>Similarly, using the intrinsic Shell() function:</p> <pre><code>Private Const INFINITE = &amp;HFFFF Private Const SYNCHRONIZE = &amp;H100000 Private Const PROCESS_QUERY_INFORMATION = &amp;H400 Private Declare Function CloseHandle Lib "kernel32" ( _ ByVal hObject As Long) As Long Private Declare Function GetEx...
37,269
<p>Is there a way to attach an event to a foreign / separate window from an .NET process that when the foreign window is closed or is about to close my application can be notified?</p> <p>I found this <a href="http://msdn.microsoft.com/en-us/library/ms229658.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en...
<p>There's an article on <a href="http://www.codeproject.com/KB/system/WilsonSystemGlobalHooks.aspx" rel="nofollow noreferrer">CodeProject</a> that looks at using global hooks to receive windows messages from other applications.</p> <p>Can you <a href="http://support.microsoft.com/kb/305369" rel="nofollow noreferrer">...
<p>Look into SetWindowsHookEx with the WH_CBT parameter. There will be a HCBT_DESTROYWND entry.</p>
20,461
<p>Everyone (at least everyone who uses a compiled language) has faced compilation errors but how many times do you get to actually crash the compiler? </p> <p>I've had my fair share of <strong>"internal compiler errors"</strong> but most went away just by re-compiling. Do you have a (minimal) piece of code that crash...
<p>I write the compiler we use, so it crashes sometimes.</p>
<p>VC++ has crashed on me when compiling C++ if template usage is messed up (e.g., missing out on a closing ">").</p>
23,629
<p>I do remember seeing someone ask something along these lines a while ago but I did a search and couldn't find anything. </p> <p>I'm trying to come up with the cleanest way to clear all the controls on a form back to their defaults (e.g., clear textboxes, uncheck checkboxes).</p> <p>How would you go about this?</p>...
<p>What I have come up with so far is something like this:</p> <pre><code>public static class extenstions { private static Dictionary&lt;Type, Action&lt;Control&gt;&gt; controldefaults = new Dictionary&lt;Type, Action&lt;Control&gt;&gt;() { {typeof(TextBox), c =&gt; ((TextBox)c).Clear()}, ...
<p>Below are methods I use to clear text from a <strong>type</strong> of control that implements ITextBox.</p> <p>I noticed in the example default boolean values are set. I'm sure you can modify it to set default values of boolean components.</p> <p>Pass the Clear method a control type (TextBox, Label... etc) and a c...
38,075
<p>I very rarely meet any other programmers!</p> <p>My thought when I first saw the token was "implies that" since that's what it would read it as in a mathematical proof but that clearly isn't its sense.</p> <p>So how do I say or read "=>" as in:-</p> <pre><code>IEnumerable&lt;Person&gt; Adults = people.Where(p =&g...
<p>I usually say 'such that' when reading that operator.</p> <p>In your example, p => p.Age > 16 reads as "P, such that p.Age is greater than 16."</p> <p>In fact, I asked this very question on the official linq pre-release forums, and Anders Hejlsberg responded by saying</p> <blockquote> <p>I usually read the => o...
<p>My two cents:</p> <pre><code>s =&gt; s.Age &gt; 12 &amp;&amp; s.Age &lt; 20 </code></pre> <p>"Lambda Expression with parameter s is { <code>return s.Age &gt; 12 &amp;&amp; s.Age &lt; 20;</code> }"</p> <p>I like this because it reminds me of where lamdba expression comes from</p> <pre><code>delegate(Student s) { ...
34,525
<p>So far I've found the following components for building ASP.NET MVC views:</p> <ul> <li><a href="http://developer.yahoo.com/yui/" rel="nofollow noreferrer">Yahoo UI (YUI)</a> </li> <li><a href="http://extjs.com/products/extjs/" rel="nofollow noreferrer">Ext JS</a></li> <li><a href="http://www.webplicity.net/flexigr...
<p>Check out <a href="http://bartreyserhove.blogspot.com/2008/08/aspnet-mvc-and-jqgrid.html" rel="nofollow noreferrer">JQGrid</a></p>
<ul> <li><a href="http://www.urautoloads.com/ci/index.aspx" rel="nofollow noreferrer">JQuery</a> </li> <li><a href="http://plugins.jquery.com/" rel="nofollow noreferrer">JQuery Pugins</a></li> </ul> <p>There are some grid plugins, which I have not used:</p> <ul> <li><a href="http://www.webplicity.net/flexigrid/" rel=...
30,330
<p>I have just started playing with the ASP.Net MVC framework, and today I created a simple UserControl that uses some CSS. Since the CSS was declared in a separate file and included in the View that called the UserControl, and not in the UserControl itself, Visual Studio could not find any of the CSS classes used in t...
<p>If you look at a skinable toolkit like Yahoo UI it documents the classes used by each control and then provides a single skin file for the entire toolkit. By swapping out the single skin file you can change looks for your entire site.</p> <p>I would assume that 99.9% of the time you would want to custom skin your c...
<p>A quick point... it's ok for your Views to be aware of HTML... that's what they are for. What I would recommend (if you want to be ubber cool), is to add a parameter to your "<a href="http://www.singingeels.com/Articles/Building_Custom_ASPNET_MVC_Controls.aspx" rel="nofollow noreferrer">MVC UserControl</a>" that spe...
44,931
<p>I am trying to format a date with: </p> <pre><code>&lt;fmt:formatDate value="${newsletter.createdOn}" pattern="MM/dd/yyyy"/&gt; </code></pre> <p>newsletter is an object with a <code>createdOn</code> property which is <code>java.util.Date</code>.</p> <p>When I invoke the previous sentence I get: </p> <p>According...
<p>Try </p> <pre><code>&lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt; </code></pre>
<p>Are you using the <code>fmt-1_0-rt.tld</code> or <code>fmt-1_0.tld</code> taglib.</p> <p>The difference is the settings for <code>rtexprvalue</code></p> <p>In one, this is false, in the other it is true.</p>
35,602
<p>Is there any way to change the background color of the Solution Explorer in Visual Studio using a Theme? - or any other way for that matter?</p> <p>I can change it by changing windows-wide color settings, but obviously that affects too much.</p>
<p>Just created VS extension for that in under an hour, search extension manager for "SExColor". Enjoy ;)</p>
<p>Not by any means of configuration from Visual Studio itself.</p> <p>You can however probably "hack" the window object from the Win32 API (look up "window enumeration"). Once you have the window handle, you can set all characterstics you want.</p> <p>Regards</p> <p>/Robert</p>
22,925
<p>I have two fields on my web page ie: BookAuthor and BookDescription.On submit,the page searches against lucene index using the given search criteria.</p> <p>If the user does not type in anything in the two fields and submits the page, how do make Lucene.Net return all the books from my index irrespective of BookAut...
<p>the correct way to do this is to use a MatchAllDocsQuery: </p> <p><a href="http://lucene.apache.org/java/2_9_4/api/core/org/apache/lucene/search/MatchAllDocsQuery.html" rel="nofollow">http://lucene.apache.org/java/2_9_4/api/core/org/apache/lucene/search/MatchAllDocsQuery.html</a></p>
<p>I'm not sure if this is the correct way but you could add another non nullable term to the index (say BookIsPublished) with a default value and if no search term is entered by the user return all matching items on the BookIsPublished constant field.</p>
44,340
<p>Starting a new project and would like to use one of the MVC framworks. <a href="http://www.asp.net/mvc/" rel="nofollow noreferrer">ASP.NET MVC</a> is still in preview but <a href="http://springframework.net/" rel="nofollow noreferrer">Spring.net</a> is in production and has a history with Java. I'd like to know th...
<p>I am a little confused by the question. Spring.Net is a dependency injection framework that you can use in ASP.NET MVC. I kind of based my answer off what you are actually asking though. The difference between ASP.NET MVC and another MVC framework that runs in ASP.NET.</p> <p>If you are worried about using ASP.N...
<p>I have an impression that Spring.NET never really took off, or at least not as much as <a href="http://www.castleproject.org/MonoRail/" rel="nofollow noreferrer">Castle Project Monorail</a>. </p> <p>From what I understand, Spring.NET has also departed from Java Spring's implementation, so there will a steeper than ...
6,463
<p>How do you retain the indentation of numbered lists? I have a page where the numbers are pushed off the page. How can I prevent this?</p> <pre><code>&lt;ol style="padding: 0"&gt; &lt;li&gt;Item 1&lt;/li&gt; &lt;li&gt;Item 2&lt;/li&gt; &lt;li&gt;Item 3&lt;/li&gt; &lt;/ol&gt; </code></pre>
<p>With a CSS rule like this:</p> <pre><code>ol { margin-left: 30px; } </code></pre> <p>Here's some information about the <a href="http://redmelon.net/tstme/box_model/" rel="nofollow noreferrer">CSS box model</a>.</p>
<p>What about using:</p> <pre><code>li { list-style-position: outside; } </code></pre>
27,497
<p>Is it possible to suppress warnings in Eclipse for JDK1.4 project?</p> <p>EDIT: Longer version. There is a project which requires JDK1.4 (no annotations). Only way of suppressing warnings I know is using annotation @SuppressWarnings - no can do in JDK1.4. Is there any way to remove some warning notifications in som...
<p>If you mean that you are writing Java 1.4 code, and you are getting warnings because you aren't using generics, set your Java Compiler settings to 1.4. You can do this on a per-project basis, or for the whole workspace.</p> <p>Window->Preferences->Java->Compiler->Compiler Compliance Level = 1.4</p> <p>To disable s...
<p>Setting the compiler to 1.4 compliance in the properties of the project should do the trick. Just right click your project and select "Properties" at the bottom and then search for "Compiler".</p>
21,230