instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>So I'm working on a project that will allow users to enter <strong>poker hand histories</strong> from sites like PokerStars and then display the hand to them.</p>
<p>It seems that regex would be a great tool for this, however I rank my regex knowledge at "slim to none".</p>
<p>So I'm using PHP and looping through ... | <p>Look at the PCRE section in the PHP Manual. Also, <a href="http://www.regular-expressions.info/" rel="nofollow noreferrer">http://www.regular-expressions.info/</a> is a great site for learning regex. Disclaimer: Regex is very addictive once you learn it.</p>
| <pre><code>Seat [number]: [letters&numbers&characters] ([number] in chips)
</code></pre>
<p>Your Regex should look something like this</p>
<pre><code>Seat (\d+): ([a-zA-Z0-9]+) \((\d+) in chips\)
</code></pre>
<p>The brackets will let you capture the seat number, name and number of chips in groups.</p>
| 3,729 |
<p>I'm using <a href="http://www.c6software.com/Products/PopBox/" rel="nofollow noreferrer">PopBox</a> for magnifying thumbnails on my page.
But I want my website to work even for users which turned javascript off.</p>
<p>I tried to use the following HTML code:</p>
<pre><code><a href="image.jpg">
<img ... | <p>Just put the onclick on the a-tag:</p>
<pre><code><a href="image.jpg onclick="Pop()"; return false;"><img ...></a>
</code></pre>
<p>Make sure to return <code>false</code> either at the end of the function (here <code>Pop</code>) or inline like in the above example. This prevents the user from bei... | <p>The <code>href</code> attribute is not required for anchors (<code><a></code> tags), so get rid of it...</p>
<pre><code> <a id="apic001" href="pic001.png"><img src="tn_pic001.png"></a>
<script type="text/javascript">
document.getElementById("apic001").removeAttribute("href");
</s... | 8,901 |
<p>I'm in the process of maintaining a Ruby on Rails app and am looking for an easy way to find the hostname or IP address of the box I'm on (since it's a VM and new instances may have different hostnames or IP addresses). Is there a quick and easy way to do this in Ruby on Rails?</p>
<p>Edit: The answer below is corr... | <p>From <a href="http://coderrr.wordpress.com/2008/05/28/get-your-local-ip-address/" rel="noreferrer">coderrr.wordpress.com</a>:</p>
<pre><code>require 'socket'
def local_ip
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily
UDPSocket.open do |s... | <p>try: <a href="http://apidock.com/rails/v2.3.8/ActionController/Request/remote_ip" rel="nofollow noreferrer">Request.remote_ip</a></p>
<blockquote>
<p>remote_ip()</p>
<p>Determine originating IP address. REMOTE_ADDR is the standard but will
fail if the user is behind a proxy. HTTP_CLIENT_IP and/or
HTTP_X_... | 6,411 |
<p>I'm writing a desktop application that communicates with a web service. Would you name all web-service functions that that fetch data <strong>Load</strong>XXXX, since they take a while to execute. Or would you use <strong>Get</strong>XXXX, for instance when getting just a single object.</p>
| <p>Use MyObject.GetXXXX() when the method returns XXXX.</p>
<p>Use MyObject.LoadXXXX() when XXXX will be loaded into MyObject, in other words, when MyObject keeps control of XXXX.</p>
<p>The same applies to webservices, I guess.</p>
| <p>Always use Get, except perhaps when actually loading something (eg, loading a file into memory).</p>
| 13,727 |
<p>i have a wordpress blog and want to give people the same user experience for adding comments that is in stackoverflow. There are a number of comments ajax plugins out there but i can't find a working one that allows you to inline on the main page, go in and add comments without first drilling down into a seperate s... | <p>I was never able to get AJAXed Wordpress to do what me (and apparently the questioner) want to do.</p>
<p>I use a custom solution that makes use of a plug-in called <a href="http://kashou.net/blog/inline-ajax-comments" rel="nofollow noreferrer">Inline Ajax Comments</a>. I had a heck of a time finding a download li... | <p>You might want to try <a href="http://wordpress.org/extend/plugins/ajax-comment-posting/" rel="nofollow noreferrer">Ajax Comment Posting</a>. It works for me.</p>
<blockquote>
<p>There are many comment-related plugins
in Wordpress plugin directory.
However, if you'd like to find just a
simple comment-postin... | 23,944 |
<p>I wonder if They can work perfectly together...</p>
| <p>Yes VS'08 and VS'05 will work nicely when installed on the same machine.</p>
<p>Now, if only they made the .NET 2.0 support in VS'08 use the same solution/project file version number as VS'05 so you could easily move back and forth VS versions with the same project without modification.</p>
| <p>Yes, they work well together. Refer to <a href="http://msdn.microsoft.com/en-us/library/ms246609.aspx" rel="nofollow noreferrer">Installing Visual Studio Versions Side-by-Side on MSDN</a> for more information.</p>
<p>You may need to install VS2005 before VS2008 though, or you're file associations may end up not wo... | 17,189 |
<p>I have a netbook running Linux and a large collection of computer books and reference material as HTML. I'd like some compact way of storing these books which can be browed without unpacking them first. This would save space and reduce wear on my small SSD.</p>
<p>If there was some way to convince Firefox to browse... | <p>There is the FUSE zip thing here :
<a href="http://code.google.com/p/fuse-zip/" rel="nofollow noreferrer">http://code.google.com/p/fuse-zip/</a></p>
<p>Gvfs should also support zip files.</p>
| <p>You can use <a href="http://www.openoffice.org/" rel="nofollow noreferrer">OpenOffice.org</a> to open the html pages, and then save them as OO documents. OO documents are essentially a zip files.</p>
<p>Another option is to use OO to save as pdf.</p>
<p>You can even do this from a command line using this <a href="... | 36,664 |
<p>Does anyone know any good and free .NET Windows Controls Library</p>
| <p>I think <a href="http://www.componentfactory.com/" rel="noreferrer">Component Factory</a> has got some.</p>
| <p>Mono <a href="http://www.mono-project.com/WinForms" rel="nofollow noreferrer">WinForms</a> lags behind Microsoft, but includes many of the familiar controls. If you are ready to try something different, Mono has other <a href="http://www.mono-project.com/Gui_Toolkits" rel="nofollow noreferrer">Gui ToolKits</a>.</p>
| 34,144 |
<p>There's an open source library that I would like to use for my iPhone app. The library is written in C and compiles with Makefiles. I would like to use a static library.</p>
<p>If I add the .a file to my project dependencies, it works well with the simulator, but it doesn't link when targeting the iPhone SDK (cer... | <p>For autoconf based library, I would vote for Christopher Stawarz's build script:</p>
<p><a href="http://pseudogreen.org/blog/build_autoconfed_libs_for_iphone.html" rel="nofollow noreferrer">http://pseudogreen.org/blog/build_autoconfed_libs_for_iphone.html</a></p>
<p>With this script, you can automate the whole pro... | <p>After several attempts to use the arm GCC compiler with the tips provided <a href="http://www.simplifymedia.com/blog/?p=16" rel="nofollow noreferrer">here</a>, I gave up. In my case, it is much simpler to simply port the library to XCode than trying to compile a static library for the iPhone.</p>
| 45,291 |
<p>We run full re-indexes every 7 days (i.e. creating the index from scratch) on our Lucene index and incremental indexes every 2 hours or so. Our index has around 700,000 documents and a full index takes around 17 hours (which isn't a problem).</p>
<p>When we do incremental indexes, we only index content that has cha... | <p>Mat, since you seem to have a good idea how long your current process takes, I suggest that you remove the <code>optimize()</code> and measure the impact.</p>
<p>Do many of the documents change in those 2 hour windows? If only a small fraction (50,000/700,000 is about 7%) are incrementally re-indexed, then I don't ... | <p>An <code>optimize</code> operation reads and writes the entire index, which is why it's so IO intensive!</p>
<p>The idea behind optimize operations is to re-combine all the various segments in the Lucene index into one single segment, which can greatly reduce query times as you don't have to open and search several... | 14,591 |
<p>curious if anyone might have some insight in how I would do the following to a binary number:</p>
<p>convert </p>
<pre><code> 01+0 -> 10+1 (+ as in regular expressions, one or more)
01 -> 10
10 -> 01
</code></pre>
<p>so,</p>
<pre><code>10101000010100011100
01010100101010100010
</code></pr... | <p>Let's say x is your variable. Then you'd have:</p>
<pre><code>unsigned myBitOperation(unsigned x)
{
return ((x<<1) | (x>>1)) & (~x);
}
</code></pre>
| <p>Twidle in C/C++ is ~</p>
| 19,127 |
<p>As part of some error handling in our product, we'd like to dump some stack trace information. However, we experience that many users will simply take a screenshot of the error message dialog instead of sending us a copy of the full report available from the program, and thus I'd like to make some minimal stack trac... | <p>You should be able to get a StackTrace object instead of a string by saying</p>
<pre><code>var trace = new System.Diagnostics.StackTrace(exception);
</code></pre>
<p>You can then look at the frames yourself without relying on the framework's formatting.</p>
<p>See also: <a href="http://msdn.microsoft.com/en-us/li... | <p>As alternative, log4net, though potentially dangerous, has given me better results than System.Diagnostics. Basically in log4net, you have a method for the various log levels, each with an Exception parameter. So, when you pass the second exception, it will print the stack trace to whichever appender you have con... | 7,495 |
<p>Can someone share a simple example of using the <code>foreach</code> keyword with custom objects?</p>
| <p>Given the tags, I assume you mean in .NET - and I'll choose to talk about C#, as that's what I know about.</p>
<p>The <code>foreach</code> statement (usually) uses <code>IEnumerable</code> and <code>IEnumerator</code> or their generic cousins. A statement of the form:</p>
<pre><code>foreach (Foo element in source)... | <p>From <a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/foreach-in" rel="nofollow noreferrer">MSDN Reference</a>:</p>
<p>The foreach statement is not limited to <code>IEnumerable</code> types and can be applied to an instance of any type that satisfies the following conditions:</p>... | 45,403 |
<p>I have a Gridview boundfield where i set ReadOnly to true because i don't want user to change its value. However on the objectdatasource control's update method that boundfield became null when i try to use it as parameter in update method. Is there a way to set that value during updating?</p>
| <p>When you mark a field as read-only on the GridView it renders on the page as a span element, not an input. Therefore the value is not available on PostBack. If you can construct the update statement so that it doesn't expect this field, that would be the best way to deal with this. If the update statement is auto... | <p>Another approach is to add a new query to your tableadapter. Create an update query that just uses the fields desired to be updated. When selecting the update method on the ODS pick the update query. The BoundFields that are not part of the update query can now be turned to readonly=true and it should work.</p>
| 40,799 |
<p>I frequently need to debug .NET binaries on test machines (by test-machine, I mean that the machine doesn't have Visual Studio installed on it, it's frequently re-imaged, It's not the same machine that I do my development on, etc). </p>
<p>I love the Visual Studio debugger, but it's not practical for me to install ... | <p>I've finally found extensions for Windbg that do just what I wanted: <a href="http://www.stevestechspot.com/">Sosex.dll</a>, lets me use windbg to debug managed applications with very minimal installation required. I've used it for more than a year now, and It's worked, without fault, for every debugging scenario I... | <p>Maybe you can try using <a href="http://www.objectis-software.com/product/ostudio-live-tuning-live-debugging-functional-tests/" rel="nofollow">Live Tuning</a> combined with an <a href="http://www.objectis-software.com/product/ocf-server-makes-your-application-accessible/" rel="nofollow">Ocf Server</a>?</p>
<p>It's ... | 19,785 |
<p>How can I write a C++ function returning true if a real number is exactly representable with a double?</p>
<pre><code>bool isRepresentable( const char* realNumber )
{
bool answer = false;
// what goes here?
return answer;
}
</code></pre>
<p>Simple tests:</p>
<pre><code>assert( true==isRepresentable( "0.5... | <p>Parse the number into the form a + N / (10^k), where a and N are integers, and k is the number of decimal places you have. </p>
<p>Example: 12.0345 -> 12 + 345 / 10^4, a = 12, N = 345, k = 4</p>
<p>Now, 10^k = (2 * 5) ^ k = 2^k * 5^k</p>
<p>You can represent your number as exact binary fraction if and only if ... | <p>Convert the string into a float with a larger scope than a double. Cast that to a double and see if they match.</p>
| 32,805 |
<p>I maintain a vb.net forms application that prints various labels to label printers. (Label printers are just like any printer, just smaller print area/lower resolution) </p>
<p>The system uses a legacy printing method that's supported in the printer hardware, but has been out of general use for over a decade. I'... | <p>Have a look at this thread <a href="https://stackoverflow.com/questions/182670/visual-print-design-for-net">Visual Print Design for .NET</a>.</p>
<p>Also, you might consider a PDF template that you can inject with the values, then print the PDF, not perfect, but it could work depending on your needs.</p>
| <p>When I looked for a similar need, I ran across some solutions that were marketed as <a href="http://www.neodynamic.com/Products/ImageDraw-SDK-NET/ImageDraw_SDK_NET.aspx?tabid=95&prodid=8" rel="nofollow noreferrer">business card</a> designers that looked like it'd fit the bill.</p>
| 27,977 |
<p>In the past I've done web application development using Visual Studio. Initially I'd use the design view, editing the page visually. But over time I learned more and more (X)HTML, CSS, and Javascript. I became familiar with the tags for ASP.NET server controls and their common attributes.</p>
<p>I got to the point w... | <p>I do 95% of my web dev stuff using Dreamweaver's code editor. But, for the other 5%, the WYSIWYG stuff really comes in handy. </p>
<p>Plus, it's not your money anyway. I'd say get it and if the WYSIWYG stuff is too much for you just keep it in source code mode and use it as an editor.</p>
| <p>Dreamweaver's a tad bloated for something which you really can just do in Notepad (++ or otherwise). No WYSIWYG will give you code to the same quality as hand-crafted code. Especially since it's vanilla HTML, just use an everyday programmer's text editor. Having intellisense isn't that important: I mean, there's onl... | 19,962 |
<p>I have the following VB.net interface that I need to port to C#. C# does not allow enumerations in interfaces. How can I port this without changing code that uses this interface?</p>
<pre><code>Public Interface MyInterface
Enum MyEnum
Yes = 0
No = 1
Maybe = 2
End Enum
ReadOnl... | <p>In short, you can't change that interface without breaking code, because C# can't nest types in interfaces. When you implement the VB.NET versions's interface, you are specifying that Number will return a type of MyInterface.MyEnum:</p>
<pre><code>class TestClass3 : TestInterfaces.MyInterface
{
TestInterfaces... | <pre><code>public enum MyEnum
{
Yes = 0,
No = 1,
Maybe = 2
}
public interface IMyInterface
{
MyEnum Number { get; }
}
</code></pre>
| 21,521 |
<p>Having a fully internationalised application is a necessity if you want to sell worldwide.
In Java we're using resource bundles and that solves things for static text codeside.</p>
<p>But what do you do about text that is stored in the database? Starting with static definitions, to user modifiable objects, ending w... | <p>Don't store system generated text in the database. Instead, store a code (like a message number) and then internationalize it at the GUI level. Make sure that the only text that comes directly out of the database is text that the user put in themselves. Make sure your database is set to accept unicode text.</p>
| <p>Static data is the easiest I would create a Translation Table so imagine a UserStatus table that has a StatusId, TranslationToken, then the TranslationTable has a Token, language, and text. </p>
<p>Or simillary you could just return the token for the application to process using your resource files.</p>
<p>As for ... | 40,514 |
<p>My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time? </p>
| <p>The following C++ function can do that:</p>
<pre class="lang-cpp prettyprint-override"><code>HRESULT GetElevationType( __out TOKEN_ELEVATION_TYPE * ptet );
/*
Parameters:
ptet
[out] Pointer to a variable that receives the elevation type of the current process.
The possible values are:
TokenElevation... | <p>Here is a VB6 implementation of a check if a (current) process is elevated</p>
<pre><code>Option Explicit
'--- for OpenProcessToken
Private Const TOKEN_QUERY As Long = &H8
Private Const TokenElevation As Long = 20
Private Declare Function GetCurrentProcess Lib "kernel32" () As... | 12,149 |
<p>Does javascript use immutable or mutable strings? Do I need a "string builder"?</p>
| <p>They are immutable. You cannot change a character within a string with something like <code>var myString = "abbdef"; myString[2] = 'c'</code>. The string manipulation methods such as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim" rel="noreferrer"><cod... | <p>JavaScript strings are indeed immutable.</p>
| 7,416 |
<p>I'm a recent semi-convert to Eclipse after 20 years of using vi and gvim. One of the things I miss about gvim is that I could cut a bunch of different snippets of code into named buffers, and paste them at will when doing something like repeating a common idiom. For instance I'd have it so <code>"ap</code> would p... | <p>You might want to store those two snippets into a <a href="http://waynebeaton.wordpress.com/2006/02/27/code-template-expansion-in-eclipse/" rel="noreferrer">code template</a>, as explained in <a href="http://web.archive.org/web/20140208040332/http://www.java-tips.org/other-api-tips/eclipse/how-to-add-your-own-code-t... | <p>I have used snippets in some IDEs, like Dreamweaver and Homesite, an old Coldfusion IDE. I also use a lot of snippets in MySQL Workbench - where i type a lot of SQL, very handy there. </p>
<p>I am now using <strong>Eclipse Java EE IDE for Web Developers Version Indigo Release</strong> and found the snippets panel... | 29,440 |
<p>Ok, so i have been trying to put everyone one of my classes in some root folder, either:</p>
<p>UI<br>
BusinessLogic<br>
DataAccess<br>
BusinessObjects<br>
Interfaces </p>
<p>i have a few more where i can't seem to bucket very well so i am looking for suggestions</p>
<ol>
<li><p>A Cache class that maintains a pr... | <p>I try to align my assembly names with their namespaces, and use the .NET Framework itself as a guideline. I firmly believe that working with a namespace structure that drives a folder structure makes for a much more maintainable codebase.</p>
<p>For example, I have a caching provider that is part of the global dev... | <p>I usually like to stick to the 1 class, 1 file rule, but when it comes to EventArgs, I actually like to declare them in the same file that I define the delegate or event. Unless, the args are used by more than one class hierarchy, which doesn't tend to happen to me often.</p>
<p>As for the cache, I would put in th... | 40,284 |
<p>Here is the sequence of my Gcode, printed in mid-air:</p>
<pre><code>Print (E20)
Retract (E-20)
Dwell (G4 10,000)
Move away (E0)
Print (E20)
</code></pre>
<p>See the path on the printscreen below:
<a href="https://i.stack.imgur.com/rbYqY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rbYqY.png"... | <p>Since you retracted the filament (very far), but stay at elevated temperature for almost 2 minutes, this must be left-over residue inside the nozzle/throat that is stuck to the wall that becomes liquid and oozes out of the nozzle because gravity pulls it downwards.</p>
<p><a href="https://3dprinting.stackexchange.c... | <p>Since you retracted the filament (very far), but stay at elevated temperature for almost 2 minutes, this must be left-over residue inside the nozzle/throat that is stuck to the wall that becomes liquid and oozes out of the nozzle because gravity pulls it downwards.</p>
<p><a href="https://3dprinting.stackexchange.c... | 1,106 |
<p>A few years ago, it was proven that <a href="http://www.cse.iitk.ac.in/~manindra/algebra/primality_v6.pdf" rel="noreferrer">PRIMES is in P</a>. Are there any algorithms implementing <a href="http://en.wikipedia.org/wiki/AKS_primality_test" rel="noreferrer">their primality test</a> in Python? I wanted to run some ben... | <p>Quick answer: no, the AKS test is not the fastest way to test primality. There are much <em>much</em> faster primality tests that either assume the (generalized) Riemann hypothesis and/or are randomized. (E.g. <a href="http://en.wikipedia.org/wiki/Miller-Rabin_primality_test" rel="noreferrer">Miller-Rabin</a> is fas... | <p>Yes, go look at <a href="http://rosettacode.org/wiki/AKS_test_for_primes#Python" rel="nofollow">AKS test for primes</a> page on rosettacode.org</p>
<pre><code>def expand_x_1(p):
ex = [1]
for i in range(p):
ex.append(ex[-1] * -(p-i) / (i+1))
return ex[::-1]
def aks_test(p):
if p < 2: retu... | 45,260 |
<p>I have a string which is like this:</p>
<p>this is [bracket test] "and quotes test "</p>
<p>I'm trying to write something in Python to split it up by space while ignoring spaces within square braces and quotes. The result I'm looking for is:</p>
<p>['this','is','bracket test','and quotes test '] </p>
| <p>Here's a simplistic solution that works with your test input:</p>
<pre><code>import re
re.findall('\[[^\]]*\]|\"[^\"]*\"|\S+',s)
</code></pre>
<p>This will return any code that matches either </p>
<ul>
<li>a open bracket followed by zero or more non-close-bracket characters followed by a close bracket, </li>
<li>... | <p>Works for quotes only. </p>
<pre><code>rrr = []
qqq = s.split('\"')
[ rrr.extend( qqq[x].split(), [ qqq[x] ] )[ x%2]) for x in range( len( qqq ) )]
print rrr
</code></pre>
| 29,028 |
<p>Is there a way to use these operators to input and output binary data? The reason I want to do this is that it makes the code readable.
Ex: infile >> filedecrypter >> metadataparser >> audiodecoder >> effects >> soundplayer;</p>
| <p>Indeed that can be done, if the library or your code provides the overloads for <code>operator<<</code> and <code>operator>></code> for it to work. Simple example on how one could do it:</p>
<pre><code>class transformer {
public:
virtual std::iostream& transform(std::iostream&) = 0;
};
... | <p>Sure it can be done. Just define your own operator>> and operator<< so they do "the right thing"...</p>
<p>I would make it so I would have methods in the class, like toStream(ostream& os) and fromStream(istream& ), then define </p>
<pre><code>istream& operator>> (istream& is, T& t)
... | 40,338 |
<p>How would one create a REST web service to write a row into a databse table. Use the follwoing scenario:</p>
<blockquote>
<p>The table is called <strong>Customer</strong> - the
data to be inserted into the row would
be the name, addresss, telephone
number, email.</p>
</blockquote>
<p>I think its impossible... | <p>First of all, I'm not either java nor c# expert and I don't exactly know what means do these languages have to support REST design, but in general:</p>
<ol>
<li><p><a href="http://www.example.com/customers" rel="nofollow noreferrer">http://www.example.com/customers</a> - customers is a collection of resources and y... | <p><em><a href="http://oreilly.com/catalog/9780596529260/#top" rel="nofollow noreferrer">RESTful Web Services</A></em>, published by O'Reilly and Associates, seems to fit the bill you're looking for.</p>
<p>As far as doing it in Java, Sun <a href="http://java.sun.com/developer/technicalArticles/WebServices/restful/" r... | 46,370 |
<p>We recently had a code review . One of my classes was used so that I could return/pass more than one type of data from/to methods . The only methods that the class had were getters/setters . One of the team's members ( whose opinion I respect ) said that having a class like that is bad practice ( and not very OOP ) ... | <p>There's an argument that classes should either be "data structures" (i.e., focus on storing data with no functionality) or "functionality oriented" (i.e., focus on performing certain actions while storing minimal state). If you follow that argument (which makes sense but isn't always easy to do) then there is nothin... | <p>I think he might be confusing "not very OOP" for bad practice. I think he expected you to provide several methods that would each return 1 value that was needed (as you will have to use them in your new class anyway that isn't too bad).</p>
<p>Note that in this case you probably shouldn't use getters/setters, just ... | 40,312 |
<p>I've built one, but I'm convinced it's wrong.</p>
<p>I had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records).</p>
<p>Is there a better way?</p>
<p>I code in PHP with MySQL</p>
| <p><a href="http://www.databaseanswers.org/data_models/hotels/hotel_reservations_popkin.htm" rel="nofollow noreferrer">Here you go</a></p>
<p>I found it at this page:
<a href="http://www.webmastersbydesign.com/2008/08/04/library-of-over-500-free-database-models/" rel="nofollow noreferrer">A list of free database model... | <p>What's wrong with that? logging each date that the customer is staying allows for what I'd imagine are fairly standard reports such as being able to display the number of booked rooms on any given day.</p>
| 9,297 |
<p>I have a mx:Canvas element that contains several mx:Panel elements. I want to be able to draw a line connecting two such mx:Panel's in such a way that the line continues to connect the two mx:Panels when one or both get dragged around. It seems like something that should be trivial to do, but I haven't been able to ... | <blockquote>
<p><em>"I've tried overriding the
updateDisplayList() method of the
mx:Canvas component but that seems to
only update the drawing after the
dragging. I would like for the line to
follow the mx:Panel as it is being
dragged."</em></p>
</blockquote>
<p>You can listen to <a href="http://livedocs... | <p>You'd want to override the UIComponent method updateDisplayList() on the Canvas and do your drawing in there. </p>
<p>This is assuming you are familiar with line drawing in AS3 in general.</p>
| 43,424 |
<p>How to implement Repository pattern withe LinqToEntities
how to implement the interface </p>
| <p>At first one might think that reads and writes of the native machine size are atomic but there are a number of issues to deal with including cache coherency between processors/cores. Use atomic operations like Interlocked* on Windows and the equivalent on Linux. C++0x will have an "atomic" template to wrap these i... | <p>The only portable way is to use the sig_atomic_t type defined in signal.h header for your compiler. In most C and C++ implementations, that is an int. Then declare your variable as "volatile sig_atomic_t."</p>
| 7,780 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents">Where do I find the current C or C++ standard documents?</a> </p>
</blockquote>
<p>I want to use STL with the current program I'm working on and the ... | <p>Information on where to get the current standard document:</p>
<p><a href="https://stackoverflow.com/questions/81656/where-do-i-find-the-current-x-standard#83763">Where do I find the current C or C++ standard documents?</a></p>
<p>Other responses in that question have information on downloads of various drafts of ... | <p>i googled "C++ ansi standard" and clicked the first result</p>
<blockquote>
<p>What's available for free on the
Internet?</p>
<p>The C++ standard went through two
Committee Drafts (CDs) which were made
available for public inspection and
comment. Changes made to the second CD
after the public comme... | 25,091 |
<p>Google chrome doesn't behave the same as other browsers when encountering this nugget:</p>
<pre><code><?php
while (true) {
echo "<script type='text/javascript'>\n";
echo "alert('hello');\n";
echo "</script>";
flush();
sleep(5);
}
?>
</code></pre>
<p>It seems that it's waiting... | <p>Some browsers require a certain number of bytes to be downloaded before rendering available data. I remember the last time I tried to do what you're doing I ended up having to dump something like 300 spaces to be sure the browser would bother with it.</p>
| <p><strong>Did you talk with Chrome developers? Did you open a bug about that?</strong> IMHO the best solution is make Chrome behave like other browsers do, rather than having a workaround for it. </p>
<p>Okay, actually you probably will need a short-term workaround. But imagine a world in which each browser behaves d... | 29,398 |
<p>For a situation like capturing text incrementally, for example if you were receiving all of the output.write calls when a page was rendering, and those were being appended into a textwriter over a stringbuilder.</p>
<p>Is there a more efficient way to do this? Something that exists in dotnet already preferably? Esp... | <p>I think StringBuilder is the most efficient way to append text in .net. To be more efficient you can specify the initial size of the StringBuilder when you create it.</p>
| <p>That's as good as it gets. You can use a StringWriter but it's still writing into a StringBuilder</p>
| 10,663 |
<p>If I'm deep in a nest of loops I'm wondering which of these is more efficient:</p>
<pre><code>if (!isset($array[$key])) $array[$key] = $val;
</code></pre>
<p>or</p>
<pre><code>$array[$key] = $val;
</code></pre>
<p>The second form is much more desirable as far as readable code goes. In reality the names are longe... | <p>For an array you actually want: <code>array_key_exists($key, $array)</code> instead of <code>isset($array[$key])</code>.</p>
| <p>The extra function call to isset() is almost guaranteed to have more overhead than any assignment. I would be extremely surprised if the second form is not faster.</p>
| 20,367 |
<p>Does someone have experience with storing key-value pairs in a database?</p>
<p>I've been using this type of table:</p>
<pre><code>CREATE TABLE key_value_pairs (
itemid varchar(32) NOT NULL,
itemkey varchar(32) NOT NULL,
itemvalue varchar(32) NOT NULL,
CONSTRAINT ct_primary... | <p>Before you continue on your approach, I would humbly suggest you step back and consider if you really want to store this data in a "Key-Value Pair"table. I don't know your application but my experience has shown that every time I have done what you are doing, later on I wish I had created a color table, a fabric ta... | <p>Times have changed. Now you have other database types you can use beside relational databases. NOSQL choices now include, Column Stores, Document Stores, Graph, and Multi-model (See: <a href="http://en.wikipedia.org/wiki/NoSQL" rel="nofollow">http://en.wikipedia.org/wiki/NoSQL</a>).</p>
<p>For Key-Value databases, ... | 15,357 |
<p>I was reading about <a href="http://en.wikipedia.org/wiki/App_Engine" rel="noreferrer">App Engine</a> on wikipedia and came across some GQL restrictions:</p>
<ul>
<li><p>JOIN is not supported</p></li>
<li><p>can SELECT from at most one table at a time</p></li>
<li><p>can put at most 1 column in the WHERE clause</p>... | <p>The datastore that GQL talks to is:</p>
<ul>
<li>not a relational database like MySQL or PostgreSQL</li>
<li>is a Column-oriented DBMS called BigTable</li>
</ul>
<p>One reason to have a database like this is to have a very high performance database that you can scale across hundreds of servers.</p>
<p>GQL is not ... | <p>I believe the answer is in fact to do with the underlying technology of the datastore rather than any kind of restriction on what is available. Google aren't using a relational database under the hood, but instead <a href="http://en.wikipedia.org/wiki/BigTable" rel="nofollow noreferrer">BigTable</a>, they have just ... | 36,849 |
<p>I want our team to develop against local instances of an Oracle database. With MS SQL, I can use SQL Express Edition. What are my options?</p>
| <p>Oracle has an express edition as well. I believe it is more limited though (IIRC, you can only have one database on an instance)</p>
<p><a href="http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html" rel="noreferrer">Oracle XE</a></p>
| <p>I don't recommend Oracle XE. My co-workers and I have been doing a project in Oracle and got severely tripped up after trying to use XE for our local development instances. The database worked fine until we started running local stress tests, at which point it started dropping connections.</p>
<p>I don't know whe... | 4,558 |
<p>I'm trying to decide what to put in a dialog box that tells the user their login doesn't work, there is probably a duplicate. The system uses email addresses as user names, then requires a password.</p>
<p>Right now, I'm using "Email Login" but that just sounds stupid.</p>
<p>For instance:</p>
<p>1) Application ... | <p>Tell them explicitly that their email address is already in use.</p>
<p>Call it an email address, thats what the user thinks of it as. The fact that you are using it as an id or a database primary key or a hash key is irrelevant to them.</p>
| <p>There is a distinction between the process of authenticating ie logging-on/login and the options a user can use ie. username, userid or email address. </p>
<p>As more websites are having allowing users to login with email address it doesn't pay to be ambiguous, do your users a favour and label the field 'Email Add... | 30,477 |
<p>I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration in the Emacs GUI. However, the default text coloration when Emacs is run in the terminal is different and garish.</p>
<p>How do I make the colors in the terminal match the colors in the GUI?</p>
| <p>You don't have to be stuck to your terminal's default 16 (or fewer) colours. Modern terminals will support 256 colours (which will get you pretty close to your GUI look).</p>
<p>Unfortunately, getting your terminal to support 256 colours is the tricky part, and varies from term to term. <a href="http://www.xvx.ca/~... | <p>I don't think that is possible in such a general way. With the terminal you are usually bound to some pre-defined colors (with things like gnome-terminal you can adjust these colors -- but you are still stuck to a predefined, limited number of colors).</p>
| 8,941 |
<p>I need a conditional compilation switch that knows if I am compiling for the mono or MS .NET runtime. How can I do this? </p>
| <p>The Mono compiler defines <code>__MonoCS__</code></p>
<p><strong>BUT, BUT, BUT</strong>, the whole point of Mono is that you can take an assembly that you built with VS and run it on Mono, or vice versa.</p>
<p>It seems to me that if you need to have Mono vs MS.NET differences, then you need to be making those dec... | <p>It is clear that there are times when code on one platform will differ to code on another and you may wish to do this at run-time or maybe compile time. Some times it can't be done at run-time. </p>
<p>For example: </p>
<p>Mono is used as the basis of Xamarin's Ios, Android, and Mac tool kits. While these have a l... | 42,637 |
<p>In answer to <a href="https://stackoverflow.com/questions/102833/how-do-i-use-aspnet-with-visual-studio-2008">this question</a> Joel Coehoorn said </p>
<blockquote>
<p>Finally, only after the site's gone through a suitable QA process, the production server is updated from source control, not from within visual st... | <p>VSS has a pretty comprehensive set of command line arguments. The best way I know is to write a batch file to:</p>
<p>1 - Get Latest to the local system (presumably a clean build machine)</p>
<p>2 - Push the newly-updated local files to your FTP site.</p>
| <p>We use Nant for our project. Nant is a dot net port of ant for java. It has tasks to checkout from VSS, compile and deploy. </p>
<ul>
<li><a href="http://nant.sf.net" rel="nofollow noreferrer">Nant</a></li>
<li><a href="http://nantcontrib.sourceforge.net/release/latest/help/tasks/vsscheckout.html" rel="nofollow nor... | 13,447 |
<p>Once a programmer decides to implement <code>IXmlSerializable</code>, what are the rules and best practices for implementing it? I've heard that <code>GetSchema()</code> should return <code>null</code> and <code>ReadXml</code> should move to the next element before returning. Is this true? And what about <code>Write... | <p>Yes, GetSchema() <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.getschema.aspx" rel="noreferrer">should return null</a>.</p>
<blockquote>
<p>IXmlSerializable.GetSchema Method This
method is reserved and should not be
used. When implementing the
IXmlSerializable in... | <p>If you already have an XmlDocument representation of your class or prefer the XmlDocument way of working with XML structures, a quick and dirty way of implementing IXmlSerializable is to just pass this xmldoc to the various functions. </p>
<p>WARNING: XmlDocument (and/or XDocument) is an order of magnitude slower t... | 35,332 |
<p>What are the things that Medium Trust stops you from doing? For example, I've already learned that Medium Trust stops you from using System.IO.Path.GetTempPath(). What other things like that?</p>
| <p>Here's how to learn about and resolve trust issues.</p>
<p>1) Search your Windows\Microsoft.NET\Framework[YOUR VERSION]\CONFIG folders for the files:</p>
<ul>
<li>web.config (this is the root config file)</li>
<li>web_mediumtrust.config </li>
<li>web_hightrust.config </li>
</ul>
<p>2) Change the web.config to s... | <p>Make sure any third party libraries/frameworks (Castle comes to mind) are build (or can be built) in medium trust.</p>
| 34,716 |
<p>We are implementing an IP based geolocation service, and we need to find some IP's from various markets (LA, NY etc) to fully test the service.</p>
<p>Does anybody know of a directory where we could find what IP ranges are used where?</p>
<p>EDIT: We have already implemented the system, it uses a 3rd party DB and ... | <p>Not sure if cost is a factor but there are a few open source databases knocking about. <a href="http://www.maxmind.com/app/geoip_country" rel="nofollow noreferrer">This one</a> claims 99.3% accuracy on its free version with 99.8% for its paid version. They've also got a <a href="http://www.maxmind.com/app/geolitecit... | <p>You could try using an automation tool, such as AutoIT, to fire off a series of IP addresses at a whois database service such as <a href="http://ws.arin.net/whois" rel="nofollow noreferrer">arin</a> or RIPE, and harvest the addressed responses, probably just varying the first two parts of the IP.</p>
| 25,171 |
<p>I'd like to "reserve" a portion of the screen so that maximized windows don't cover that area (think taskbar(Win) or dock(mac).</p>
<p>I've seen other programs that have done this, but really have not liked them and since I'm in the business, thought I might have a hand at it... at least for my personal use.</p>
<... | <p>Check out <a href="http://www.codeproject.com/KB/shell/csdoesshell3.aspx" rel="nofollow noreferrer">this</a></p>
| <p>see MSDN C sample (SHAPP) which does exactly that (codeproject sample is just a poor copy..)</p>
| 39,130 |
<p>I'm looking for a way to match only fully composed characters in a Unicode string.</p>
<p>Is <code>[:print:]</code> dependent upon locale in any regular expression implementation that incorporates this character class? For example, will it match Japanese character 'あ', since it is not a control character, or is <co... | <pre><code>echo あ| perl -nle 'BEGIN{binmode STDIN,":utf8"} print"[$_]"; print /[[:print:]]/ ? "YES" : "NO"'
</code></pre>
<p>This mostly works, though it generates a warning about a wide character. But it gives you the idea: you must be sure you're dealing with a real unicode string (check utf8::is_utf8). Or just ch... | <p>You could always use the character class <code>[^[:cntrl:]]</code> to match non-control characters.</p>
| 24,911 |
<p>This is a subjective question.</p>
<p>I worked in Visual Basic 6.0 before coming into the .NET space. </p>
<p>One thing I see that there are a lot of things, for which there is a need to deal with the Win32 API. As a Visual Basic 6.0 developer, there were a lot of limitations. .NET fixes some of the old problems h... | <p>It can't go away any time soon, but in Windows, at least, new projects are going less and less with C/C++. You can even see examples of Microsoft starting to eat their own dog food.</p>
<p>A great example of this is the C# compiler. Currently, it is written in C/C++. The C# team is currently working on re-writing... | <p>C# has lots of good features. However, the biggest difference I know of between C# and C/C++ is that somebody decided the preprocessor was no longer needed.</p>
<p>For simple uses of the preprocessor, no doubt they were right.</p>
<p>However, many highly skilled/experienced programmers make use of code generation ... | 45,011 |
<p>According to <a href="http://www.builderau.com.au/program/perl/soa/Obtain-user-group-and-process-information-in-Perl/0,339028313,339222142,00.htm" rel="nofollow noreferrer">this site</a> I can simply write </p>
<pre><code>$user = getlogin();
</code></pre>
<p>but the group handling functions seem not to be able to ... | <p>No need to parse system files, on an UNIX-like operating system I would use the builtin interfaces to the getpwuid and getgrgid system calls: </p>
<pre><code>use strict;
use warnings;
# use $< for the real uid and $> for the effective uid
my ($user, $passwd, $uid, $gid ) = getpwuid $< ;
my $group = getgrg... | <p>You should be using the <a href="http://perldoc.perl.org/POSIX.html" rel="nofollow noreferrer">POSIX module</a>. More specifically, the <code>getpw*</code>, <code>getgr*</code> and <code>getu*</code> functions contained there.</p>
| 43,804 |
<p>I have an app that has impersonation used throughout. But when a user is logged in as an admin, a few operation require them to write to the server itself. Now if these users do not have rights on the actual server (some don't) it will not let them write. </p>
<p>What I want to do is turn off impersonation for ju... | <p>Make sure the Application Pool do have the proper rights that you need.</p>
<p>Then, when you want to revert to the application pool identity... run the following:</p>
<pre><code>private WindowsImpersonationContext context = null;
public void RevertToAppPool()
{
try
{
if (!WindowsIdentity.GetCurren... | <p>You could turn off authentication for the page and then manually impersonate the authenticated user during the remainder of your code.</p>
<p><a href="http://support.microsoft.com/kb/306158" rel="nofollow noreferrer">http://support.microsoft.com/kb/306158</a></p>
<p>This has a reference to that last part, but basi... | 15,204 |
<p>I am writing a C program in Linux. Commands like execv() require a path in the form of a C string. Is there a command that will return the current path in the form of a C-style string?</p>
| <p><a href="http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html" rel="nofollow noreferrer">getcwd()</a>:</p>
<blockquote>
<h3><em>SYNOPSIS</em></h3>
<pre><code>#include <unistd.h>
char *getcwd(char *buf, size_t size);
</code></pre>
<h3><em>DESCRIPTION</em></h3>
<p>The <em>getcwd()</... | <p>You need to grab the environment variable PWD (present working directory).</p>
<p>I'm not sure what the library it is in, but it is a standard Linux header.</p>
<p>I was thinking of <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getenv.html" rel="nofollow noreferrer">getenv()</a> which would help i... | 6,925 |
<p>I wonder if the UNIX domain socket connections with postgresql are faster then tcp connections from localhost in high concurrency rate and if it does, by how much?</p>
| <p>UNIX domain sockets should offer better performance than TCP sockets over loopback interface (less copying of data, fewer context switches), but I don't know whether the performance increase can be demonstrated with PostgreSQL.</p>
<p>I found a small comparison on the FreeBSD mailinglist: <a href="http://lists.free... | <p>TCP sockets on localhost are usually implemented using UNIX domain sockets, so the answer on most systems is neglijable to none. However, this is not standard in any way -- it is just how usually it is done, therefore you should not depend on this.</p>
| 32,125 |
<p>What I'm trying to do with MRS is to teach myself some basic AI; what I want to do is to make a rocket entity, with things such as vectored exhaust, and staging. Anyone have an idea on how to make an entity that can fly? Or do I just need to constantly apply a force upwards?</p>
| <p>Hey TraumaPony, your question looked lonely :)</p>
<p>I took a look at an MSDN article about MRS 2.0 <a href="http://msdn.microsoft.com/en-us/magazine/cc546547.aspx" rel="nofollow noreferrer">here</a> I believe you'll actually need to create a Rocket entity of some kind and then a Thruster entity that it can use. I... | <p>I'm just starting with MRS myself - but I think you are on the right track, you need to create a rocket engine entity that you can apply a thrust force to. See <a href="http://msdn.microsoft.com/en-us/library/bb483078.aspx" rel="nofollow noreferrer">Simulation Tutorial 2 - Compose Entities with Simulation Services<... | 13,227 |
<p>I'm getting crazy with this IE 7...</p>
<p>==> hhttp://neu.emergent-innovation.com/</p>
<p>Why does following function not work in IE 7, but perfectly with Firefox? Is there a bug in the animate-function?</p>
<pre><code>function accordion_starting_page(){
// hide all elements except the first one
$('#FCE-... | <p>I came across a similar problem with the animate function and was surprised when it was showing the error coming from the core jQuery library. However jQuery is fine, its IE you need to cater for. </p>
<p>When animating any attribute of an element in IE, you need to make sure that in your CSS there is a starting p... | <p>I'm not sure what the problem is exactly... perhaps you can't animate to "<code>display: none</code>" ? Try this:</p>
<pre><code>toHide.animate({ height : 0 }, 1000, function() { $(this).hide(); });
</code></pre>
<p>...thought, it looks like there might be some other issues with the container not having <code>over... | 43,287 |
<p>I've got a Java client that needs to access a remote database. It is the goal to hide database credentials from the user and not hardcode any credentials within the code. Therefore, the database access will probably have to be on the server side.</p>
<p>I'm restricted to use Ibatis as a data abstraction framework. ... | <p>Build a Service Layer and expose it over RMI - possibly as EJB3 stateless session beans as you have JBoss, possibly as pure RMI. I wouldn't bother with web services unless you have a specific need. RMI will take case of serialisation for you.</p>
<p>Your service layer needs to expose a method to authenticate users ... | <p>So you want users to be able to access the database without knowing the credentials? Your only option is server-side database access. Unfortunately there is no way of hiding the username and password in Java -- if you put it into a properties file and encrypt it, a determined attacker could still attach a debugger a... | 21,948 |
<p>I want to change the registry values on the pocketPC. I ran the following code:</p>
<pre><code>if(enabled)
{
dwData = 120;
}
if(RegSetValueEx(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\Power\\Timeouts\\BattSuspendTimeout"), 0, REG_DWORD, (LPBYTE)&dwData, sizeof(DWORD)))
{
return FALSE;
... | <p>There are a two problems with what you are doing:</p>
<p>1: RegSetValueEx does not take a path, only a valuename. So you need to open the key path first.</p>
<p>e.g.</p>
<pre><code>HKEY key;
if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Power\\Timeouts", 0, 0, &key)... | <p>Assuming that your looking with RegEdit, did you refresh (F5) the registry view?</p>
| 30,684 |
<p>We have a typical business application with an Outlook-looking Winforms client talking to asmx webservices. We’d like to make a portion of the features available over our intranet, but the new users we need to reach - all of them - are in developing countries with dial up-type bandwidth and a lot of latency. And t... | <p>A couple of things that I could think of</p>
<p><strong>Round trips</strong></p>
<p>Like in your saying, the less the better, in order to best fit the browser client, it is best to design the interface by the use cases from the browser application, return ready-to-use data for the interface without other overhead.... | <p>It's going to be all about reducing round trips, as CodeMelt said. Here's a few more ways:</p>
<p>Be sure that your first page load has as much information on it as it can. Too often when first building an app, the page will immediately request some more state from the server with an Ajax call. It may be that yo... | 31,969 |
<p>I know that in JavaScript, creating a for loop like this: <code>for(int i = 0; i < arr.length; i++)</code> is costly as it computes the array length each time.
Is this behavior costly in c# for lists and arrays as well. Or at compile-time is it optimized? Also what about other languages such as Java, how is this... | <p>It is <em>not</em> costly in C#. For one thing, there is no “calculation“: querying the length is basically an elementary operation thanks to inlining. And secondly, because (<a href="http://blogs.msdn.com/ericgu/archive/2004/04/18/115566.aspx" rel="noreferrer">according to its developers</a>), the compiler recogniz... | <p>If it's anything like Java, it should be an O(1) operation.</p>
<p>I found the following link helpful: <a href="http://www.devguru.com/Technologies/Ecmascript/Quickref/array.html" rel="nofollow noreferrer">http://www.devguru.com/Technologies/Ecmascript/Quickref/array.html</a></p>
| 32,915 |
<p>Is there a way to figure out versions of modules that were loaded into the process' address space when the process crashed from a crash dump that was generated by the process calling the MiniDumpWriteDump function? In other words, is any version information stored inside a dmp file?</p>
<p>Thanks.</p>
| <p>load your minidump into WinDbg, then there's a Modules item off the Debug menu that shows checksum and timestamp information. That may be enough info for your purposes.</p>
<p>You can get the version from all loaded modules by typing "LM v" in the command window, in WinDBG. The list is long and you get lots, includ... | <p>Load your dump file to WinDbg and type this command:</p>
<pre><code>lm v <name_of_module> // shows information about specified module
</code></pre>
<p><code>lm v</code> will show you information about all modules.</p>
| 22,038 |
<p>It seems that anyone can snoop on incoming/outgoing .NET web service SOAP messages just by dropping in a simple SoapExtension into the bin folder and then plumbing it in using:</p>
<pre><code><soapExtensionTypes>
<add type="MyLoggingSoapExtension, SoapLoggingTools" priority="0" group="High" />
<soa... | <p>I am not sure what you mean by extensions and bin folders (I would guess you are using .NET), so I can't answer about them being loaded etc.</p>
<p>However, note that SOAP is designed to allow intermediaries to read the headers and even to modify them. (Do a search for "SOAP Active Intermediaries"). <strong>Judging... | <p>Totally agree with @Hurst - if you want to prevent others reading your messages you need to use message-level encryption. Otherwise even simple NetMon can crack over the wire traffic. </p>
<p>Of course if someone has access to the machine (given the access to /bin etc.), even cryptography may not be enough to pre... | 14,482 |
<p>Site 1 has dll's for x amount of object and data calls. Can Site 2 (a separate .net web app) call the objects/dll's of Site 1 ?</p>
| <p>This may be more semantics:</p>
<p>You can't call an object of another process. You can however potentially instantiate a class within a dll as long as there is a reference to that dll in the calling web application. </p>
<p>If you GAC the dll, the classes (not objects) will be accessible to the entire machine.<... | <p>I never used .NET Remoting but isn't that the kind of problem it could solve?</p>
| 11,899 |
<p>I have a form view, in the edit template I have two drop downs.
Drop down 1 is explicitly set with a list of allowed values. It is also set to autopostback.
Drop down 2 is databound to an objectdatasource, this objectdatasource uses the first dropdown as one of it's parameters. (The idea is that drop down 1 limits ... | <p>I had a similar problem with bound dropdownlists in a FormView. I worked around it by setting the selected value manually in the formview's "OnDataBound". </p>
<p>(don't know where you get ConnectToProject_ID from)</p>
<pre><code>FormView fv = (FormView)sender;
DropDownList ddl = (DropDownList)fv.FindControl("Pr... | <p>Sounds like the controls aren't being databound properly after the postback.</p>
<p>Are you databinding the first dropdown in the page or in the codebehind?
If codebehind, are you doing it in on_init or on_load every time?</p>
<p>There might be an issue of the SelectedValue of the second drop down being set to a n... | 4,254 |
<pre><code> <DataTemplate x:Key="Genre_DataTemplate">
<RadioButton GroupName="One" Content="{Binding...
</DataTemplate>
</code></pre>
<p>Above code is the ItemTemplate of my ItemsControl, I want all the Radiobuttons instantiated should behave as if it is in a group, I know the reason because th... | <p>The problem is that the RadioButton.GroupName behavior depends on the logical tree to find a common ancestor and effectively scope it's use to that part of the tree, but silverlight's ItemsControl doesn't maintain the logical tree. This means, in your example, the RadioButton's Parent property is always null</p>
... | <p>I think the problem is somewhere else in the control tree. Can you post more details?</p>
<p>Here is a sample xaml code that works as expected:</p>
<pre><code><Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<... | 20,526 |
<p>I have a document library with about 50 available content types. This document library is divided into several folders. When a user cliks the "New" button in a folder, all available content types are offered. I need to limit the content types according to the folder. For example, in the folder "Legal" a want to hav... | <p>Have you looked at <a href="http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5%2D28d9%2D464f%2Db1c9%2D91e07c8f7e47&ID=56" rel="nofollow noreferrer">this</a> article by Ton Stegeman?</p>
| <p>I think Magnus' answer will be exactly what you need but why are you storing to many content types and document types in one library? Wouldn't it make more sense to have more than one document library? this would make it much more easily managed.</p>
| 13,584 |
<p>Perhaps this is a naive question. In my understanding, ASP.NET MVC cannot work with ViewState and Postback which is fundamentals of ASP.NET forms. Is that correct?</p>
<p>If that's it, then all ASP.NET Web Controls depending on ViewState & Postback cannot be used in ASP.NET MVC, right?</p>
| <p>ASP.NET's server-side controls work with WebForms, not MVC. MVC doesn't use controls in the traditional ASP.NET sense (at least yet).</p>
<p>The MVC model is quite different from the WebForms model; not better or worse, but very different. Using MVC puts the developer much closer to the generated HTML, lends itself... | <p>This might surprise you, but I accidentally dropped a Button on a MVC page, and implemented the Click event, and it actually worked!</p>
<p>I was surprised, maybe it works for just this simple case (it was the only element on the page at that time), and the fact that the response ended with a redirect, but in some ... | 47,794 |
<p>What's the easiest method people have found to monitor memcached on Windows? One method I've tried, which works decently:</p>
<p>telnet into the memcached port (11211) and enter the "stats" command. You'll get back a listing like this:</p>
<pre><code>stats
STAT pid 2816
STAT uptime 791
STAT time 1225918895
STAT ve... | <p>The PHP Memcached module also includes <a href="http://svn.php.net/viewvc/pecl/apc/trunk/apc.php?view=markup" rel="nofollow noreferrer">a script</a> that will display the stats in summary, and also graph form, as well as being able to view individual cached items. If you are already using PHP & memcache on windo... | <p>I've worked with memcached on windows and found this to be one of the main drawbacks. It's surprising better tools have not appeared but I guess it's a case of not asking for whom the bell tolls...</p>
| 33,430 |
<p>I am trying to see if Reg-Free COM is something we can use in our web application to ease deployment of legacy COM components. However, before I get onto looking into things like using it for Interop situations, I can't get a simple test to work. Here's what I have done :-</p>
<p>1) Create a new VB ActiveX DLL proj... | <p>If you reference a .dll in your application, click on the referenced dll under references in your project, look at the properties and set Isolated to TRUE.</p>
<p>This will include the .dll in your project and your application will use the copy of the .dll included in your project.</p>
<p>To see a working Example ... | <p>Thanks for the response.</p>
<p>The manifest I added is auto-generated from the .NET console application. A manifest isn't being generated for the COM DLL itself. I'll check out the walkthrough and see if that provides any answers.</p>
| 41,057 |
<p>Recently I tried understanding the use of <strong>java.math.MathContext</strong> but failed to understand properly. Is it used for rounding in <code>java.math.BigDecimal</code>. If yes why does not it round the decimal digits but even mantissa part.</p>
<p>From API docs, I came to know that it follows the standard ... | <p>@jatan</p>
<blockquote>
<p>Thanks for you answer. It makes sense. Can you please explain me MathContext in the context of BigDecimal#round method.</p>
</blockquote>
<p>There's nothing special about <code>BigDecimal.round()</code> <em>vs.</em> any other <code>BigDecimal</code> method. In all cases, the <code>Mat... | <p>If I'm understanding you correctly, it sounds like you're expecting the MathContext to control how many digits should be kept after the decimal point. That's not what it's for. It specifies how many digits to keep, <em>total</em>. So if you specify that you want 3 significant digits, that's all you're going to ge... | 2,908 |
<p>With SQLAlchemy, is there a way to know beforehand whether a relation would be lazy-loaded?<br>
For example, given a lazy parent->children relation and an instance X of "parent", I'd like to know if "X.children" is already loaded, without triggering the query.</p>
| <p>You can get a list of all unloaded properties (both relations and columns) from <code>sqlalchemy.orm.attributes.instance_state(obj).unloaded</code>.</p>
<p>See: <a href="https://stackoverflow.com/questions/5795492/completing-object-with-its-relations-and-avoiding-unnecessary-queries-in-sqlalch">Completing object wi... | <p>Slightly neater than Haes answer (though it effectively does the same thing) is to use hasattr(), as in:</p>
<pre><code>>>> hasattr(X, 'children')
False
</code></pre>
| 32,311 |
<p>I have a file temp.txt, that I want to sort with the <code>sort</code> command in bash.</p>
<p>I want the sorted results to replace the original file.</p>
<p>This doesn't work for example (I get an empty file):</p>
<pre><code>sortx temp.txt > temp.txt
</code></pre>
<p>Can this be done in one line without reso... | <pre><code>sort temp.txt -o temp.txt
</code></pre>
| <p>If you insist on using the <code>sort</code> program, you have to use a intermediate file -- I don't think <code>sort</code> has an option for sorting in memory. Any other trick with stdin/stdout will fail unless you can guarantee that the buffer size for sort's stdin is big enough to fit the entire file.</p>
<p>Ed... | 17,635 |
<p>I am just getting started with IoC containers so apologies if this is a stupid question.</p>
<p>I have code like the following in an app</p>
<pre><code>internal static class StaticDataHandlerFactory
{
public static IStaticDataHandler CreateHandler(StaticDataUpdate staticDataUpdate)
{
... | <p>Actually, although it is possible to replace some of the code with an inversion of control system, it's not obvious to me it's a good idea. Dependency injection tends to be best for configuration of systems, not dynamic creation of objects. To put it a different way, the container itself is a huge global variable ... | <p>I have yet to read any words here that make much sense.</p>
<p>IoC is more for config?</p>
<p>Dynamic object creation is better what? Generics? This is all off topic.</p>
<p>1) IoC is nothing but a nice time saver compared to implementing the 'composition over specialization/inheritance' gospel. </p>
<p>So rule ... | 35,761 |
<p>The problem/comic in question: <a href="http://xkcd.com/287/" rel="nofollow noreferrer">http://xkcd.com/287/</a></p>
<p><img src="https://imgs.xkcd.com/comics/np_complete.png" alt="General solutions get you a 50% tip"></p>
<p>I'm not sure this is the best way to do it, but here's what I've come up with so far. I'm... | <p>The point about an NP-complete problem is not that it's tricky on a small data set, but that the amount of work to solve it grows at a rate greater than polynomial, i.e. there is no O(n^x) algorithm. </p>
<p>If the time complexity is O(n!), as in (I believe) the two problems mentioned above, that is in NP. </p>
| <p>Actually, I've refactored my algorithm some more. There were several correct combinations I was missing, and it was due to the fact that I was returning as soon as the cost went over 15.05 -- I wasn't bothering to check other (cheaper) items that I could add. Here's my new algorithm:</p>
<pre><code><cffunction n... | 17,137 |
<p>In ruby I am parsing a date in the following format: 24092008.
I want to convert each section (year, month, date) into a number.</p>
<p>I have split them up using a regex which produces three Strings which I am passing into the Integer constructor.</p>
<pre><code> date =~ /^([\d]{2})([\d]{2})([\d]{4})/
year = I... | <p>I'm not familiar with regexes, so forgive me if this answer's off-base. I've been assuming that $3, $2, and $1 are strings. Here's what I did in IRB to replicate the problem:</p>
<pre><code>irb(main):003:0> Integer("04")
=> 4
irb(main):004:0> Integer("09")
ArgumentError: invalid value for Integer: "09"
... | <p>Instead of checking any integer with leading 0 directly. Eg:</p>
<p><code>Integer("08016") #=> ArgumentError: invalid value for Integer(): "08016"</code></p>
<p>Create a method to check and rescue for leading 0:</p>
<pre><code>def is_numeric(data)
_is_numeric = true if Integer(data) rescue f... | 17,658 |
<p>I'm looking at this control, and it seems to be lacking the standard .net "datasource" and "datamember" properties for databinding. Is this control not bindable? I can write some custom function that populates the treeview from a given data source, I suppose, and embed data objects as necessary, but is that the 'b... | <p>You are correct in that there is no data binding. The reason being is that TreeViews are hierarchical data structures. That is, not a straight list. As a result the databind option is invalid to say a List structure.</p>
<p>Sadly it's creating your own populate methods or buying 3rd party controls (which in the ... | <p>If it's only a couple levels, I like to populate a dataset with a couple tables and set up a DataRelation on the columns. Then you use some nested loops and create your tree nodes.</p>
| 48,740 |
<p>Do you have any tips for effective profiling using Netbeans?</p>
<p>The profiler is quite nice and powerful. I've used it to find problems in some of my Eclipse RCP client applications. However, I get the feeling that I could get some more value out of it.</p>
<p>Normally I set it to profile either all my classe... | <p>The JavaOne lab exercises are available online for free, you should be able to get some good tips there.</p>
<p><a href="http://developers.sun.com/learning/javaoneonline/j1labs2008.jsp?track=1&yr=2008" rel="nofollow noreferrer">http://developers.sun.com/learning/javaoneonline/j1labs2008.jsp?track=1&yr=2008<... | <p>Specifically this link is interesting from the Java One Lab</p>
<p><a href="http://developers.sun.com/learning/javaoneonline/j1lab.jsp?lab=LAB-8430&yr=2008&track=1" rel="nofollow noreferrer">http://developers.sun.com/learning/javaoneonline/j1lab.jsp?lab=LAB-8430&yr=2008&track=1</a></p>
| 14,636 |
<p>Greetings!</p>
<p>I'm still learning about the GridView control and I have one bound to an ObjectDataSource. My Web form looks like this:</p>
<pre><code><asp:GridView ID="ourGrid" runat="server" DataSourceID="ourDataSource" onrowdatabound="ourGrid_RowDataBound"
HeaderStyle-CssClass="header_style"... | <p><strong>TFOOT Customisation:</strong></p>
<p>The footer will always default to creating the same number of cells as the rest of the gridview. You can override this in code by adding:</p>
<pre><code>protected void OurGrid_RowCreated(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType... | <p>Footer content will need to be generated on databind. Set a handler for RowDataBound. The logic should look something like this:</p>
<pre><code>if (e.Row.Type == DataControlRowType.Footer)
{
// Do Work
}
</code></pre>
<p>To specify different style for the header something like this will do:</p>
<pre><code><C... | 40,686 |
<p>I'm having issues getting PETG to print nicely. I have encountered pretty much every issue because when I fix one thing another issue pops up. I see people saying that you should "just copy your PLA settings", but that <em>definitely</em> did not work for me, with issues from bed adhesion, stringing, globb... | <p>Five top layers should normally be more than enough to create a seamless top layer.</p>
<p>Indeed, PETG prints a little differently than PLA. It requires a higher hot end temperature, less part cooling (to improve sticking to previous layers), a higher build plate temperature and usually care in choosing the right ... | <p>I have been having the same issue with PETG when printing but I have found that if I slow the printer down to 50% speed that left me with a perfect top layer. I have a 20% infill with 4 top layers and at 50% speed I am printing at roughly 32mm/m. I am sure that will help give you better top layers.</p>
| 1,120 |
<p>Given:</p>
<pre><code>e = 'a' + 'b' + 'c' + 'd'
</code></pre>
<p>How do I write the above in two lines?</p>
<pre><code>e = 'a' + 'b' +
'c' + 'd'
</code></pre>
| <p>What is the line? You can just have arguments on the next line without any problems:</p>
<pre><code>a = dostuff(blahblah1, blahblah2, blahblah3, blahblah4, blahblah5,
blahblah6, blahblah7)
</code></pre>
<p>Otherwise you can do something like this:</p>
<pre><code>if (a == True and
b == False):
</cod... | <p>Taken from The Hitchhiker's Guide to Python (<a href="https://docs.python-guide.org/writing/style/#line-continuations" rel="nofollow noreferrer">Line Continuation</a>):</p>
<blockquote>
<p>When a logical line of code is longer than the accepted limit, you need to split it over multiple physical lines. The Python int... | 7,660 |
<p>I just came across an interesting situation in JavaScript. I have a class with a method that defines several objects using object-literal notation. Inside those objects, the <code>this</code> pointer is being used. From the behavior of the program, I have deduced that the <code>this</code> pointer is referring to... | <p>Cannibalized from another post of mine, here's more than you ever wanted to know about <em>this</em>.</p>
<p>Before I start, here's the most important thing to keep in mind about Javascript, and to repeat to yourself when it doesn't make sense. Javascript does not have classes (ES6 <code>class</code> is <a href="h... | <p>All the answers here are very helpful but I still had a hard time to figure out what <code>this</code> point to in my case, which involved object destructuring. So I would like to add one more answer using a simplified version of my code,</p>
<pre><code>let testThis = {
x: 12,
y: 20,
add({ a, b, c }) {
let... | 16,213 |
<p>I am trying to get the signature on the method below to work. As this is an Anonymous Type I have some trouble, any help would be great.</p>
<p>When I looked at sortedGameList.ToList() in a QuickWatch window I get the signature </p>
<pre><code>System.Collections.Generic.List<<>f__AnonymousType0<System.... | <p><strike> select new { Date = s.Key, Games = s.ToList() }; </strike></p>
<p>Edit: thats wrong! I think this will do.</p>
<pre><code>public List<IGrouping<DateTime, Game>> getGamesList(int leagueID)
{
var sortedGameList =
from g in Games
group g by g.Date;
return sortedGameLis... | <p>The simple answer is: don't use an anonymous type.</p>
<p>The closest you're going get with that anonymous type is IEnumerable<object>. The problem is, anybody who uses your stuff is not going to know what to do with that object whose type was "unpredictable".</p>
<p>Instead, make a class like:</p>
<pre><code>... | 29,455 |
<h2><strong>Background</strong></h2>
<p>A project installs some files that contain all the elements to define a UserControl - some user source, a CodeCompileUnit for designer code, and a resx file. At runtime, these files are compiled into an assembly and the classes are consumed by our main application (the assembly ... | <p>Create a separate satellite assembly for each culture. This has two benefits:</p>
<ul>
<li>You can build all of the assemblies in one go, and have a definitive file for each version number and filename combination, rather than it <em>also</em> depending on the culture.</li>
<li>You can have multiple assemblies in t... | <p>If you're not planning on adding additional languages after deployment (at least not without a software update), then I'd favor compiling all the additional RESX files into a satellite assembly that you include. That way, they're not user editable once they're deployed.</p>
| 25,126 |
<p>In my code, I am creating a collection of objects which will be accessed by various threads in a fashion that is only safe if the objects are immutable. When an attempt is made to insert a new object into my collection, I want to test to see if it is immutable (if not, I'll throw an exception).</p>
<p>One thing I c... | <p>There is no reliable way to detect if a class is immutable. This is because there are so many ways a property of a class might be altered and you can't detect all of them via reflection.</p>
<p>The only way to get close to this is:</p>
<ul>
<li>Only allow final properties of types that are immutable (primitive typ... | <p>Something which works for a high percentage of builtin classes is test for instanceof Comparable. For the classes which are not immutable like Date, they are often treated as immutable in most cases.</p>
| 24,897 |
<p>I've started to work a bit with master pages for an ASP.net mvc site and I've come across a question. When I link in a stylesheet on the master page it seems to update the path to the sheet correctly. That is in the code I have</p>
<pre><code><link href="../../Content/Site.css" rel="stylesheet" type="text/css"... | <pre><code><script src="<%= ResolveClientUrl("~/Content/menu.js") %>" type="text/javascript"></script>
</code></pre>
| <p>Use this instead:</p>
<pre><code><link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
</code></pre>
| 9,011 |
<p>You are applying for a role "Java Developer" and you are called for an interview.
What are the general knowledge you should/must learn before you sit in front of the panel?</p>
| <p>I would read the <a href="https://rads.stackoverflow.com/amzn/click/com/0072253606" rel="nofollow noreferrer" rel="nofollow noreferrer">Sun Certified Java Programmer</a> study guide. Many employers don't expect you to have the actual certification, but they do expect you to know the material (whether they explicitl... | <p>A few good tips here. At least you tell someone where to start.</p>
| 45,302 |
<p>I just watched the last <a href="http://channel9.msdn.com/posts/VisualStudio/Using-the-Parallel-Extensions-to-the-NET-Framework/" rel="nofollow noreferrer">Channel 9 vid</a> on the upcoming parallel extensions to .NET.
How would you use this in a web app? I'm specifically thinking of using the parallel Linq extensio... | <p>I think this paragraph extracted from <a href="http://msdn.microsoft.com/en-us/magazine/cc163329.aspx" rel="noreferrer">this article</a> explains the usage of PLINQ-to-SQL:</p>
<blockquote>
<p>LINQ-to-SQL and LINQ-to-Entities
queries will still be executed by the
respective databases and query
providers, so... | <p>Parallel LINQ is primarily intended to work against in-memory collections, I believe. How were you anticipating using it against your database?</p>
<p>Given that webapps are naturally pretty parallel (in terms of separate requests executing on separate threads etc) I suspect that PLINQ won't really apply to it much... | 37,049 |
<p>How have you used the Exception.Data property in C# projects that you've worked on? </p>
<p>I'd like answers that suggest a pattern, rather than those that are very specific to your app.</p>
| <p>The exception logger I use has been tweaked to write out all the items in the Data collection. Then for every exception we encounter that we cannot diagnose from the exception stack, we add in all the data in that function's scope, send out a new build, and wait for it to reoccur. </p>
<p>I guess we're optimists ... | <p>I just tried to use it and found out that it is not very useful for my purpose - so I am not using it.</p>
<p>The most important part of the stack trace is to be able to tell what happened. The method name and line number are great, but you often need to see value of relevant variables in the context of the exceptio... | 17,476 |
<p>Which parsers are available for parsing C# code?</p>
<p>I'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code.</p>
| <p>Works on source code:</p>
<ul>
<li><a href="http://www.codeplex.com/csparser" rel="noreferrer">CSParser</a>:
From C# 1.0 to 2.0, open-source</li>
<li><a href="http://www.csharpparser.com/csparser.php" rel="noreferrer">Metaspec C# Parser</a>:
From C# 1.0 to 3.0, commercial product (about 5000$)</li>
<li><a href="htt... | <p><a href="http://plas.fit.qut.edu.au/gppg/" rel="nofollow noreferrer">GPPG</a> might be of use, if you are willing to write your own parser (which is fun). </p>
| 10,706 |
<p>I am attempting to allow my web designers to use the metadata we have about database fields in the asp.net pages they are creating. The most obvious one is as follows:</p>
<pre><code><asp:TextBox runat="server" id="txTextBox" MaxLength="<Value From Metadata here>" ... />
</code></pre>
<p>All the requir... | <p>You can use a data binding expression:</p>
<pre><code><asp:TextBox MaxLength="<%# Constant.Value %>" />
</code></pre>
<p><em>but</em>, that requires it to be in a databound control. If it's not in a repeater or somesuch, you'll need to call Container.DataBind() at some point in the page lifecycle.</p>
... | <p>I think you should be able to do it with something like this</p>
<pre><code><asp:TextBox runat="server" id="txTextBox" MaxLength="<%=Constants.SomeValue%>" />
</code></pre>
<p>But my only concern is that this doesn't really make much sense. If the constant is stored in a .cs file in order to make a ch... | 30,725 |
<p>I have a report with a lot of formulas that translate the word "TRUE" into an "X" and "FALSE" into a blank space.</p>
<p>I use these to put an "X" in a checkbox.</p>
<p>Sometimes there is text after my checkbox. To avoid slight shifts to the left and right, I print the "X" and the " " in a fixed width font. It i... | <p>No, this is not possible. The context of a formula is the property for which the formula is set only. You cannot access properties of the whole object e.g. a field. Perhaps you could think about using two images suppressed by a formula depending on the value of your field. Then you would get rid of the font problem.... | <p>From what I remember, you can set the Font using formula field where you can write</p>
<p>if Uppercase({table.somefield}) = "TRUE" then "Courier New"</p>
| 39,634 |
<p>If I'm using Visual Studio 2008 targeted to ASP.NET 2.0, then which version of the Ajax Control Toolkit should I be using?</p>
| <p>You need the Toolkit version <a href="http://www.codeplex.com/AjaxControlToolkit/Release/ProjectReleases.aspx?ReleaseId=11121" rel="nofollow noreferrer">1.0.20229.20821</a>, <em>AjaxControlToolkit.zip</em> the dll's are targeted to .NET 2.0 and you need also the <a href="http://www.microsoft.com/downloads/details.a... | <p>You need the Toolkit version <a href="http://www.codeplex.com/AjaxControlToolkit/Release/ProjectReleases.aspx?ReleaseId=11121" rel="nofollow noreferrer">1.0.20229.20821</a>, <em>AjaxControlToolkit.zip</em> the dll's are targeted to .NET 2.0 and you need also the <a href="http://www.microsoft.com/downloads/details.a... | 27,220 |
<p>I'm developing a simple console application in Visual Studio 2008 and want to run it in the output window inside Visual Studio 2008, instead of having a separate command prompt window come up. Is there a way to do this?</p>
| <p>If you run the console app in the post build step it's output will go to the output window. The inability to do this easily has been on of my biggest peeves with VS (any version)</p>
| <p>It is a fairly old question, but as there is no answer marked as solution yet, try the answer given over here: <a href="https://stackoverflow.com/questions/2542599/having-the-output-of-a-console-app-in-visual-studio-instead-of-the-console">Having the output of a console application in Visual Studio instead of the co... | 23,624 |
<p>Every time I try melting a scrap piece of plastic it ends up turning brown, smelling, and smoking before even melting down completely. My entire home ends up filled with cancerous fumes and there's no way I'm baking any food in my oven ever again. I've tried different types of Nylon, ASA, and PLA and all of them tur... | <p>Plastic in general and 3d printer plastic specifically doesn't really melt so much as get softer in a range of temperatures (in a state refered to as "plastic" rather than liquid). Below that range, it is a solid. Above that range, it decomposes and ultimately burns.</p>
<p>If you want to make a solid bl... | <p>Your kitchen oven is for food. I'd strongly recommend using a different heating device for this. Your oven probably has oils in it that are contaminating the plastic, and the plastic will make your later cooked-food contaminated. I suggest cleaning your oven before cooking food, too.</p>
<p>Personally I've had go... | 2,082 |
<p>If I have a <code>DropDownList</code> control that makes up part of a CompositeControl how can I expose the <code>SelectedIndexChanged</code> event to the consuming aspx page?</p>
<p>Thanks</p>
| <p>There is a much simpler way that is a direct pass through.</p>
<p>Try this:</p>
<pre><code> public event EventHandler SelectedIndexChanged
{
add { this.TargetControl.SelectedIndexChanged += value; }
remove { this.TargetControl.SelectedIndexChanged -= value; }
}
</code></pre>
<p>[Edit] U... | <p>Here's what you do. First declare an event like this:</p>
<pre><code>public event EventHandler SelectedIndexChanged;
</code></pre>
<p>Then, internally, hook up to the DropDownList's SelectedIndexChangedEvent. In your event handler do something like this:</p>
<pre><code> protected void DropDownList1_Selecte... | 49,601 |
<p>I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc".</p>
<p>How can I make this work? I'm not averse to canning t... | <p>If you are using Java 6 you can just use the <a href="http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#open(java.io.File)" rel="nofollow noreferrer">open method of java.awt.Desktop</a> to launch the file using the default application for the current platform.</p>
| <p>Not sure if this will help you much... I use java 1.5+'s <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html" rel="nofollow noreferrer">ProcessBuilder</a> to launch external shell scripts in a java program. Basically I do the following: ( although this may not apply because you don't wan... | 7,849 |
<p>I recently upgraded to a E3D full hotend and I started to have problems with slowly printed parts. After I print first object and start next one, then the first layer has serious issue.</p>
<p><a href="https://i.stack.imgur.com/wSSm4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wSSm4.jpg" alt=... | <p>I use cosmetic vaseline - <a href="https://en.wikipedia.org/wiki/Petroleum_jelly" rel="noreferrer">petroleum jelly</a>. Usually it is white to transparent and odorless. It's cheap and available in all drugstores and cosmetics stores.</p>
<p>As suggested by Tom van der Zanden I'm adding additional info about interac... | <p>I have been using <em>sewing machine oil</em> for my 3D printed extruder gear for a couple of years, without any noticeable wear so far.</p>
<p>In general, I believe any kind of low viscosity oil would do, but then again, it also depends on the environment in which you plan to use the model. If you plan on using it... | 299 |
<p>I know I can do most of this by hacking Trac and using Git hooks, but I was wondering if someone has / knows of something ready.</p>
<p>Commenting on (and closing) tickets from commit messages would be nice, specially if the diff appears inline with the comment/closing remark.</p>
<p>sha1 hashes should be auto-lin... | <p><a href="http://www.redmine.org/" rel="noreferrer">Redmine</a> can do some of what you're asking for. Integration works in one direction, you must <a href="http://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages" rel="noreferrer">reference issues in commit messages</a>, an... | <p>Check out this link <a href="http://jazz.net/library/article/194" rel="nofollow noreferrer">here</a>.
It provides a tutorial on how Git can be used to integrate with Rational Team Concert. It will give some basic information which can be used to integrate Git with a wide range of other products.</p>
| 6,173 |
<p>I have two tables I would like to complare. One of the columns is type CLOB. I would like to do something like this:</p>
<pre><code>select key, clob_value source_table
minus
select key, clob_value target_table
</code></pre>
<p>Unfortunately, Oracle can't perform minus operations on clobs. How can I do this?</p>... | <p>The format is this: </p>
<pre><code>dbms_lob.compare(
lob_1 IN BLOB,
lob_2 IN BLOB,
amount IN INTEGER := 18446744073709551615,
offset_1 IN INTEGER := 1,
offset_2 IN INTEGER := 1)
RETURN INTEGER;
</code></pre>
<hr>
<p>If dbms_lob.compare(lob1, lob2) = 0, they are identical.</p>
<p>Here's an ... | <p>Can you access the data via a built in package? If so then perhaps you could write a function that returned a string representation of the data (eg some sort of hash on the data), then you could do</p>
<pre><code>select key, to_hash_str_val(glob_value) from source_table
minus
select key, to_hash_str_val(glob_value)... | 11,121 |
<p>I have noticed that our VMWare VMs often have the incorrect time on them. No matter how many times I reset the time they keep on desyncing.</p>
<p>Has anyone else noticed this? What do other people do to keep their VM time in sync?</p>
<p><strong>Edit:</strong> These are CLI linux VMs btw..</p>
| <p>If your host time is correct, you can set the following .vmx configuration file option to enable periodic synchronization:</p>
<pre><code>tools.syncTime = true
</code></pre>
<p>By default, this synchronizes the time every minute. To change the periodic rate, set the following option to the desired synch time in se... | <p>I added the following job to crontab. It is hacky but i think should work. </p>
<p>*/5 * * * * service ntpd stop && ntpdate pool.ntp.org && service ntpd start</p>
<p>It stops ntpd service updates from service and starts ntpd again</p>
| 34,939 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.