instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have some c(++) code that uses sprintf to convert a uint_64 to a string. This needs to be portable to both linux and Solaris.</p>
<p>On linux we use %ju, but there does not appear to be any equivalent on Solaris. The closest I can find is %lu, but this produces incorrect output. Some sample code:</p>
<pre><co... | <p>If you have have inttypes.h available you can use the macros it provides:</p>
<pre><code>printf( "%" PRIu64 "\n", val);
</code></pre>
<p>Not pretty (I seem to be saying that a lot recently), but it works.</p>
| <p>You can use <code>%llu</code> for long long. However, this is not very portable either, because <code>long long</code> isn't guaranteed to be 64 bits. :-)</p>
| 19,966 |
<p>I've got a CSV file containing latitude and longitude values, such as:</p>
<blockquote>
<p>"25°36'55.57""E","45°39'12.52""N"</p>
</blockquote>
<p>Anyone have a quick and simple piece of C# code to convert this to double values?</p>
<p>Thanks</p>
| <p>If you mean C# code to do this:</p>
<p>result = 25 + (36 / 60) + (55.57 / 3600)</p>
<p>First you'll need to parse the expression with Regex or some other mechanism and split it into the individual parts. Then:</p>
<pre><code>String hour = "25";
String minute = "36";
String second = "55.57";
Double result = (hour)... | <p>What are you wanting to represent it as? Arc seconds?
Then 60 min in every degree, 60 seconds in every minute.
You would then have to keep E and N by yourself. </p>
<p>This is not how it's done generally though.</p>
<p>The easiest representation I've seen to work with is a point plotted on the globe on a grid sy... | 12,860 |
<p>Is there any open source OCR library written in .NET, or written in any language but can be used in an ASP.NET application?
Or is there any open source OCR API available in the market for image to tabular formats ?</p>
| <p>Use <a href="http://www.pixel-technology.com/freeware/tessnet/" rel="noreferrer">Tessnet</a>. </p>
<p>Tessnet is C++/CLI .NET Wrapper for tessdll (and <a href="http://code.google.com/p/tesseract-ocr/" rel="noreferrer">tesseract</a>) for .NET 2.0.</p>
| <p>Tesseract OCR was developed by HP and open sourced, I believe. I'm not sure how good the quality is.</p>
| 23,931 |
<p>How fast is <a href="http://php.net/manual/en/function.php-uname.php" rel="nofollow noreferrer">php_uname()</a> say doing <code>php_uname('s n')</code> or <code>php_uname('a')</code>. The reason I ask is because I'd like to use it to determine which server I'm on and therefore the configuration (paths, etc).</p>
<p... | <p>I just did this:</p>
<pre><code><?php
$tstart = microtime(true);
php_uname('a');
print 'it took '. sprintf("%f",microtime(true) - $tstart) ." seconds\n";
?>
</code></pre>
<p>And it produced this:</p>
<pre><code>it took 0.000016 seconds
</code></pre>
<p>That is on a Core2Duo 2.4GHz Debian box.</p>
... | <pre><code>$_SERVER['HTTP_HOST']
</code></pre>
| 26,737 |
<p>I am a c++ developer trying to create a web application using a language or framework that meets the following criteria:</p>
<ol>
<li>Very fast development time</li>
<li>Text searching and other text manipulation</li>
<li>Easy to configure and maintain the application</li>
<li>Tagging system support</li>
<li>Free (... | <p>I'll go ahead and put the word in for <a href="http://www.djangoproject.com/" rel="nofollow noreferrer">django</a>.</p>
<p>Which is sometimes called python's answer to rails.<br>
I've recently had the chance to do some ruby programming and if your coming in new to either language I think ruby or python are pretty e... | <p>It depends on the type of audience and the type of data you are dealing with. For in-house business application, you might want to pick something like ASP.NET for component support. For simpler stuff, you can go for php or rails. </p>
| 35,893 |
<p>I'm <a href="http://channel9.msdn.com/shows/Going+Deep/Inside-C-40-dynamic-type-optional-parameters-more-COM-friendly/" rel="noreferrer">listening to a talk</a> about <strong>C#4</strong>'s <code>dynamic</code> keyword and I'm wondering... Will this feature be orthogonal to other .NET features, for example will it s... | <p>From the <a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&DownloadId=3550" rel="noreferrer">"New Features in C# 4" word doc</a>:</p>
<blockquote>
<p>Dynamic lookup will not be able to
find extension methods. Whether
extension methods apply or not depends
... | <p>You can create an extension method for <em>object</em> and assign it to a <em>dynamic</em>:</p>
<pre><code>public static void MyExt(this object o) {
dynamic d = o;
d.myProp = "foo";
}
</code></pre>
<p>and call it like this:</p>
<pre><code>ClassWithMyProp x;
x.MyExt();
</code></pre>
| 32,340 |
<p>In slicer G-code is it possible to set the probe Z offset for the first layer only?</p>
<p>For my stock E3 plate I find -4.125 mm best however for glass I need to go to -4.175 mm for the first layer to get better adhesion. So it's a manual process every time. Any way to tell the slicer do the first layer at -4.175 m... | <p>I don't understand the reasoning behind a first layer having a different offset from the following layers, but, You can manually add a re-definition of the current height after the first layer, suppose your first layer is 0.2 mm, you just need to tell the printer to move to a slightly higher next layer to redefine t... | <p>Trying to change the Z level (NOT the offset) during a print isn't a good idea UNLESS you know that all future moves will be "relative".</p>
<p>The <code>M206</code> (if you use Marlin) is the right way to set it! Depending on the slicer, just create TWO "different" printer definitions and add t... | 1,910 |
<p>First of all: I am not an experienced ClearCase user, but I have lots of experience with other VCS and *nix command-line tools. WIth ClearCase, I use command-line tool ("cleartool") working in a Unix shell.</p>
<p>Problem: I have a small set of sources stored in the ClearCase. Once in a while a fresh .tgz with the ... | <p>I just want to be sure:</p>
<p>You do know about <strong><a href="https://stackoverflow.com/questions/138321/how-can-i-use-clearcase-to-add-to-source-control-recursively#144310">clearfsimport</a></strong>, right ?</p>
<p>Because after reading (may be too quickly) your question, that command may be what you are aft... | <p>If you use ClearCase UCM, so there is another approach to handle with 3rd party repository - use components (read-write or, usually, read-only).</p>
<p>BR,
Tamir Gefen
CM and ALM Consultant
My blog: <a href="http://almmmm.wordpress.com" rel="nofollow noreferrer">http://almmmm.wordpress.com</a></p>
| 20,787 |
<p>The usual method of URL-encoding a unicode character is to split it into 2 %HH codes. (<strong>\u4161</strong> => <strong>%41%61</strong>)</p>
<p>But, how is unicode distinguished when decoding? How do you know that <strong>%41%61</strong> is <strong>\u4161</strong> vs. <strong>\x41\x61</strong> ("Aa")?</p>
<p>Are... | <p>According to <a href="http://en.wikipedia.org/wiki/Percent-encoding" rel="nofollow noreferrer">Wikipedia</a>:</p>
<blockquote>
<h1>Current standard</h1>
<p>The generic URI syntax mandates that new URI schemes
that provide for the representation of
character data in a URI must, in
effect, represent characters from th... | <p>What I've always done is first UTF-8 encode a Unicode string to make it a series of 8-bit characters before escaping any of <em>those</em> with %HH.</p>
<p>P.S. - I can only hope the non-standard implementations (%uxxxx) are few and far between.</p>
| 18,856 |
<p>Is there a JSP script I can run to point to a JPEG file on the local filesystem to be printed to the Windows default printer? Thanks.</p>
<p>Edit:
I have the file on my server already.
How would I load the file into a browser to run window.print()?
Thanks</p>
| <p>You will need a java applet if you don't want a server round trip. The applet is required so that you can:</p>
<ol>
<li>Access the local file system.</li>
<li>Access the printer natively.</li>
</ol>
<p>The user will need to grant the applet privileges.</p>
<p>Be aware that printing from java is notoriously hard.<... | <p>You would have to get them to upload the image to your server, then put the jpeg on a page with JavaScript to call window.print(). It's a security violation for webpages to just start reading the local filesystem.</p>
| 25,281 |
<p>I have a controller method that returns a list for a drop down that gets rendered in a partial, but depending on where the partial is being used, the RJS template needs to be different. Can I pass a parameter to the controller that will determine which RJS gets used?</p>
<p>Here is the controller method, it is very... | <p>What about placing the conditional logic in <strong>one</strong> rjs template?</p>
<pre><code># services.rjs
if @type == "your conditions"
# your rjs updates
else
# your other rjs updates
end
</code></pre>
<p>This gives you a cleaner controller and saves you the headache of maintaining multiple rjs templates.... | <p>To keep things clean, I'd have two controller methods that render the two different RJSs. I'd then set @type and @services in a common protected method that the two controller methods call.</p>
<p>In my mind you are asking for something different in each case so call a different controller method. Passing in a flag... | 23,396 |
<p>I want to cache custom data in an ASP.NET application. I am putting lots of data into it, such as List<objects>, and other objects.</p>
<p>Is there a best practice for this? Since if I use a static data, if the <code>w3p.exe</code> dies or gets recycled, the cache will need to be filled again.</p>
<p>The datab... | <p>You are looking for either out of process caching or a distributed caching system of some sort, based upon your requirements. I recommend distributed caching, because it is very scalable and is dedicated to caching. Someone else had recommended Velocity, which we have been evaluating and thoroughly enjoying. We h... | <p>There are lots of articles about the Cache object in ASP.NET and how to make it use SqlDependencies and other types of cache expirations. No need to write your own. And using the Cache is recommended over session or any of the other collections people used to cram lots of data into.</p>
| 42,266 |
<p>I want to get into multi core programming (not language specific) and wondered what hardware could be recommended for exploring this field.
My aim is to upgrade my existing desktop.</p>
| <p>If at all possible, I would suggest getting a dual-socket machine, preferably with quad-core chips. You can certainly get a single-socket machine, but dual-socket would let you start seeing some of the effects of NUMA memory that are going to be exacerbated as the core counts get higher and higher.</p>
<p>Why do y... | <p>I agree with the others where I would upgrade to a quad-core processor. I am also a BIG FAN of ASUS Motherboards (the P5Q Pro is excellent for Core2Quad and Core2Duo processors)! </p>
<p>The draw for multi-core programming is that you have more resources to get things done faster. If you are serious about multi-... | 47,025 |
<p>How do large web sites which cannot be completely stateless achieve extreme scalability at the web tier?</p>
<p>There are sites like eBay and Amazon, which cannot be completely stateless, as they have a shopping cart or something like that. It isn't feasible to encode every item in the shopping cart into the URL, n... | <p>You would probably have to be on the engineering team at one of these places to know for sure but there are people who have made educated guesses from talks and other information that has come out of both places:</p>
<p><a href="http://highscalability.com/ebay-architecture" rel="nofollow noreferrer">Ebay Architectu... | <p>You would probably have to be on the engineering team at one of these places to know for sure but there are people who have made educated guesses from talks and other information that has come out of both places:</p>
<p><a href="http://highscalability.com/ebay-architecture" rel="nofollow noreferrer">Ebay Architectu... | 26,466 |
<p>I've been developing GPL'd software for years, but now I need a more restrictive license.</p>
<p>This is for a commercial application, and I want to share my source code with the whole world, regardless of whether they've purchased the application from me or not. I also want to allow people to produce derivative wo... | <p>that's not <a href="http://www.opensource.org/" rel="noreferrer">OS</a>, it sounds like shared source. Specifically, it's a lot like Ms-RSL.</p>
<p>From <a href="http://en.wikipedia.org/wiki/Shared_Source" rel="noreferrer">WikiPedia</a>:</p>
<blockquote>
<p>Microsoft Reference Source License (Ms-RSL)</p>
<p>This is... | <p>IANAL, but I would suggest writing your own license for this type of thing. I have never encountered a license specific to compilation such as you mention. Take a look at a few licenses as a starting point that you can use as a template. If you're really serious about having something that would stand up in court... | 21,690 |
<p>Present:</p>
<p>The product development is done in Visual Studio at the moment using .Net technologies, so it's important to stay in the same set of tools. Roles apart from developers are using spreadsheets, docs and diagramming tools, photoshop to do their work.</p>
<p>Future:</p>
<p>We want to build a workflow ... | <p>Sounds exactly like <a href="http://msdn.microsoft.com/en-us/vsts2008/default.aspx" rel="nofollow noreferrer">Microsoft Visual Studio Team System</a>.</p>
| <p>Sounds exactly like <a href="http://msdn.microsoft.com/en-us/vsts2008/default.aspx" rel="nofollow noreferrer">Microsoft Visual Studio Team System</a>.</p>
| 15,696 |
<p>When I use quick documentaion lookup (Ctrl+Q) on j2ee classes or annotations in IDEA I only get an empty javadoc. It only contains the basics like class name.</p>
<p>How do I add the javadoc to the libs IDEA provides itself?</p>
| <p>You can attach javadoc to any library you have configure in your module or project. Just access the project structure windows <code>(File -> Project Structure)</code>, then select "modules" and select the module that has the dependency you want to configure.</p>
<p>Then select the "Dependencies" tab, select the ... | <p>right click on the maven pom.xml -> "Maven" ->Download documentation,wait for a sec,you'll make it!</p>
| 11,672 |
<p>Has anyone here ever used C++'s "placement new"? If so, what for? It looks to me like it would only be useful on memory-mapped hardware.</p>
| <h2>Placement new allows you to construct an object in memory that's already allocated.</h2>
<p>You may want to do this for optimization when you need to construct multiple instances of an object, and it is faster not to re-allocate memory each time you need a new instance. Instead, it might be more efficient to perfo... | <blockquote>
<p>Has anyone here ever used C++'s "placement new"? If so, what for? It looks to me like it would only be useful on memory-mapped hardware.</p>
</blockquote>
<p>It's really useful when needing to copy out (pass as outputs):</p>
<ol>
<li><strong>non-copyable</strong> objects (ex: where <code>opera... | 27,459 |
<p>i'm trying to change the number of rows in a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel.aspx" rel="nofollow noreferrer">TableLayoutPanel</a> programatically (sometimes it needs to be four, sometimes five, and rarely six).</p>
<p>Unfortunatly changing the number of rows do... | <p>This issue was reported to Microsoft in 2005, and they acknowledge it's a bug<strike>, but they were "<em>still evaluating our options here</em>"</strike> Microsoft has decided not to fix it ("Closed").</p>
<p><strong><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=122017" r... | <p>Have you tried creating a new <code>RowStyle</code> and then adding it using the <code>tableLayoutPanel1.RowStyles.Add</code> method?</p>
| 29,698 |
<p>Say for example you just queried a database and you recieved this 2D array.</p>
<pre><code>$results = array(
array('id' => 1, 'name' => 'red' , 'spin' => 1),
array('id' => 2, 'name' => 'green', 'spin' => -1),
array('id' => 3, 'name' => 'blue' , 'spin' => .5)
);
</code></pre>... | <p>As of June 20th in PHP-5.5 there is a new function <a href="http://us2.php.net/array_column" rel="noreferrer">array_column</a></p>
<p>For example:</p>
<pre><code>$records = array(
array(
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe'
),
array(
'id' =... | <p>I think this will do what you want</p>
<p><a href="http://us2.php.net/manual/en/function.array-uintersect-uassoc.php" rel="nofollow noreferrer">array_uintersect_uassoc</a></p>
<p>You would have to do something like this</p>
<pre><code>$results = array(
array('id' => 1, 'name' => 'red' , 'spin' => 1... | 19,740 |
<p>What are your disaster recovery plans for Windows Sharepoint Services 3.0 ?</p>
<p>Currently we are backuping all databases (1 content, admin, search and config) using sql backup tools, and backuping the front end server via dataprotector.</p>
<p>To test our backups, we use another server farm, restore the content... | <p>You can't really backup / restore both config database and search database:</p>
<ul>
<li>restoring config database only work if your new farm have exactly the same server names</li>
<li>when you restore the search database, the fulltext index is not synchronize. however, this is not a problem as you can just reinde... | <p>Reliability is in the eye of the beholder. In this case, if your tests of the restore process is successful, then yes, it is reliable.</p>
| 22,097 |
<p>I want to create a base object that has only methods. The object would be <code>QUEUABLE_OBJECT_TYPE</code> and it will have an <code>ENQUEUE</code> method(s). The Payload of these messages (properties) would be added by subtyping this object.</p>
<p>I get an error that makes it sound like you cannot:</p>
<blockqu... | <p>Everything I've read suggests it is not possible to create a type without any attributes. Nor is it possible to hide a dummy attribute in a subtype. You may simply have to have an attribute in the master type, and utilise it - e.g. by making it identify the version of the type.</p>
| <p>Oracle does provide some generic types, <a href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/adobjadv.htm#sthref948" rel="nofollow noreferrer">see documentation for details </a> </p>
| 31,347 |
<p>I have a div with <code>overflow:hidden</code>, inside which I show a phone number as the user types it. The text inside the div is aligned to right and incoming characters are added to right as the text grows to left.</p>
<p>But once the text is big enough not to fit in the div, last characters of the number is au... | <p>Have you tried using the following:</p>
<pre><code>direction: rtl;
</code></pre>
<p>For more information see<br>
<a href="http://www.w3schools.com/cssref/pr_text_direction.asp" rel="noreferrer">http://www.w3schools.com/cssref/pr_text_direction.asp</a></p>
| <p>Modified HTML markup and added some javascript to WebWanderer's jsFiddle solution.</p>
<p><a href="https://jsfiddle.net/urulai/bfzqgreo/3/" rel="nofollow noreferrer">https://jsfiddle.net/urulai/bfzqgreo/3/</a></p>
<p>HTML:</p>
<pre><code><div id="outer-div">
<p>ipsum dolor amet bacon venison porc... | 26,824 |
<blockquote>
<p>[11/18/08 10:13:08:772 GMT+05:30] 690f5641 ThreadMonitor W WSVR0606W: Thread "Servlet.Engine.Transports : 2162" (690f5641) was previously reported to be hung but has completed. It was active for approximately 1,032,152 milliseconds. There are 21 threads in total in the server that still may be hung.... | <p>Delegates are very, very fast. Not quite as fast as direct method calls, but not far off. The chances of them becoming a bottleneck are miniscule.</p>
<p>(Likewise exceptions, when used properly, <a href="https://stackoverflow.com/questions/161942/how-slow-are-net-exceptions">rarely actually cause a performance iss... | <p>Just a small addition to Jon's post: when used in the normal C# way (i.e. via lambdas / anonymous methods / event handlers / etc), then they are definitely very quick - but note that another important use of delegates can be to execute dynamic code (either methods built at runtime, or existing methods via reflection... | 39,175 |
<p>I've got a table structure I'm not really certain of how to create the best way.</p>
<p>Basically I have two tables, tblSystemItems and tblClientItems. I have a third table that has a column that references an 'Item'. The problem is, this column needs to reference either a system item or a client item - it does not... | <p>sorry for the late answer, I've been struck with a serious case of weekenditis.</p>
<p>As for utilizing a third table to include PKs from both client and system tables - I don't like that as that just overly complicates synchronization and still requires my app to know of the third table.</p>
<p>Another issue that... | <p>You probably need a table say tblItems that simply store all the primary keys of the two tables. Inserting items would require two steps to ensure that when an item is entered into the tblSystemItems table that the PK is entered into the tblItems table.</p>
<p>The third table then has a FK to tblItems. In a way tbl... | 33,737 |
<p>I am starting to develop an Eclipse plugin (technically, an OSGi plugin) and one of the first problems I've run into is that I can't seem to control the commons-logging output as I normally would.</p>
<p>I've included the commons-logging package in the plugin dependencies, and indeed, when I log something (at INFO ... | <p>3 days later...</p>
<p>I found the problem! There were two things I needed to do, first off, there was a problem with one MANIFEST.MF file:</p>
<p>I had the following in the MANIFEST.MF for one bundle:</p>
<pre><code>Bundle-ClassPath: lib/jena.jar,
.,
org.apache.log4j-1.2.12.jar,
lib/google-collect-snapshot.ja... | <p>This is not an actual answer to your question, but you might find some clues in this <a href="http://ekkescorner.wordpress.com/blog-series/osgi-apps/" rel="nofollow noreferrer">set of articles by ekke</a>.</p>
<p>I suppose you read already "<a href="http://www.eclipsezone.com/eclipse/forums/t99588.html" rel="nofoll... | 27,650 |
<p>I want to send some strings in a list in a POST call. eg:</p>
<pre><code> www.example.com/?post_data = A list of strings
</code></pre>
<p>The python code receives the data as a single string (Instead of a list of strings). How do I post it as a list of strings?</p>
| <p>There's no such thing as a "list of strings" in a URL (or in practically anything in HTTP - if you specify multiple values for the same header, they come out as a single delimited value in most web app frameworks IME). It's just a single string. I suggest you delimit the strings in some way (e.g. comma-separated) an... | <p>A data structure like <a href="http://code.djangoproject.com/browser/django/trunk/django/utils/datastructures.py" rel="nofollow noreferrer"><code>django.utils.datastructures.MultiValueDict</code></a> is a clean way to represent such data. AFAIK it preserves order.</p>
<pre><code>>>> d = MultiValueDict({'na... | 45,459 |
<p>Are there any favorite online references or good introductory and intermediate/advanced books on this topic that you could recommend to me?
I'm a java developer, so I'm looking for something which would be familiar as possible as to me.</p>
| <p><strong>Essential ActionScript 3.0</strong>, by Colin Moock</p>
<p><strong>Programming Flex 3: The Comprehensive Guide to Creating Rich Internet Applications with Adobe Flex</strong>, by Chafic Kazoun, Joey Lott</p>
<p>Also check the books section on Flex.org</p>
<p>There are some good video tutorials on lynda.co... | <p>The <a href="http://westes.github.io/flex/manual/" rel="nofollow noreferrer">"official" flex manual</a> is online.</p>
| 13,580 |
<p>In order to create an arbitrary precision floating point / drop in replacement for Double, I'm trying to wrap <a href="http://www.mpfr.org/" rel="nofollow noreferrer">MPFR</a> using the FFI but despite all my efforts the simplest bit of code doesn't work. It compiles, it runs, but it crashes mockingly after pretendi... | <p>I see the problem too, on a</p>
<pre><code>$ uname -a
Linux burnup 2.6.26-gentoo-r1 #1 SMP PREEMPT Tue Sep 9 00:05:54 EDT 2008 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux
$ gcc --version
gcc (GCC) 4.2.4 (Gentoo 4.2.4 p1.0)
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.... | <p>Aleš Bizjak, maintainer of <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmpfr" rel="nofollow noreferrer">HMPFR</a> posted to haskell-cafe and showed how to keep GHC from controlling allocation of the limbs (and hence leaving them alone, instead of GCing them and clobbering them):</p>
<pre><co... | 20,835 |
<p>Currently I am developing a site with about seven partial classes, a few icons, three pages and an App_Themes folder. I was interested to know, is there an industry standard directory structure for anything larger than a small project?</p>
<p>For example, I want to keep the classes in separate folders, the images i... | <p>I like to be inspired by Microsoft standards, since we are using a Microsoft technology. Plus <strong>a somewhat good standard is better than no standard</strong>, especially if you work in a larger team.</p>
<p>App_Code is standard of course, because it has a function in ASP.NET, not just a best practice.</p>
<p>... | <p>Many ASP.Net Web Forms projects will also have a Controls folder for the ASCX controls.</p>
<p>For css styling, we generally use a styles folder, images for image content (sorta an obvious one), js.</p>
<p>You might have a schemas folder, App_Code for ASHX handlers and other types of application code, and a Master... | 15,996 |
<p>I have a <code>GridView</code> control in an Asp.net application, that has a <code><asp:buttonField></code> of <code>type="image"</code> and <code>CommandName="Delete"</code>.</p>
<p>Is there any way to execute a piece of javascript before reaching the <code>OnRowDelete</code> event?</p>
<p>I want just a sim... | <p>I would use a TemplateField instead, and populate the ItemTemplate with a regular asp:Button or asp:ImageButton, depending one what is needed. You can then execute the same logic that the RowCommand event was going to do when it intercepted the Delete command.</p>
<p>On either of those buttons I would then use the ... | <p>better for you the add reference System.Windows.Forms if you use buttonfield... It is always available in all .net framework and supports asp.net..</p>
<p>this is your choice if the buttonfield is your best choice..
sample:</p>
<pre><code>using System.Windows.Forms;
protected void BorrowItem_RowCommand(object se... | 26,914 |
<p>I'm trying to create a named_scope that uses a join, but although the generated SQL looks right, the result are garbage. For example:</p>
<pre><code>class Clip < ActiveRecord::Base
named_scope :visible, {
:joins => "INNER JOIN series ON series.id = clips.owner_id INNER JOIN shows on shows.id = ser... | <p>The problem is that "SELECT *" - the query picks up all the columns from clips, series, and shows, in that order. Each table has an id column, and result in conflicts between the named columns in the results. The last id column pulled back (from shows) overrides the one you want. You should be using a :select option... | <p>This is a bug:</p>
<p><a href="http://rails.lighthouseapp.com/projects/8994/tickets/1077-chaining-scopes-with-duplicate-joins-causes-alias-problem" rel="noreferrer">http://rails.lighthouseapp.com/projects/8994/tickets/1077-chaining-scopes-with-duplicate-
joins-causes-alias-problem</a></p>
| 20,073 |
<p>I have a repeater control where in the footer I have a DropDownList. In my code-behind I have:</p>
<pre><code>protected void ddMyRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item
|| e.Item.ItemType == ListItemType.AlternatingItem)
{
... | <p>If you just want to fire the OnSelectedIndexChanged, this is how it should look: </p>
<p><strong>Page.aspx - Source</strong> </p>
<pre><code><FooterTemplate>
<asp:DropDownList ID="ddlOptions"
runat="server"
AutoPostBack="true"
onselectedindexchanged="ddlOptio... | <p>Is the AutoPostBack property set to True on the DropDownLists on the ASPX side? I know sometimes this property doesn't get set initially and it will prevent the SelectedIndexChanged event from firing.</p>
| 21,183 |
<p>What is the cast expression equivalent of VB.NET's CType in Visual Basic 6?</p>
| <p>There are a number of them depending on the type you are casting to</p>
<pre><code>cint() Cast to integer
cstr() cast to string
clng() cast to long
cdbl() cast to double
cdate() cast to date
</code></pre>
<p>It also has implicit casting so you can do this myString=myInt</p>
| <p>Ctype() I believe. The C* (CDate(), CStr(), etc) are holdovers for the most part. </p>
| 39,487 |
<p>Has anyone encountered this oddity?</p>
<p>I'm checking for the existence of a number of directories in one of my unit tests. <code>is_dir</code> is reporting true (1) in spite of the folder not existing at the time it is called. The code looks like this (with a few extraneous intermediate vars to ease debugging):<... | <p>I don't think this would cause your problem, but $path does have the trailing slash, correct?</p>
| <pre><code>$path = trim($base . '/' . $uf);
</code></pre>
<p>That could be causing it. I'm assuming $base is some sort of root folder you are searching, so if $uf is something like '', '.', or '../' that could return true. We would have to see what values you are using in your foreach to know anything further.</p>
<p... | 7,597 |
<p>The size and range of the integer value types in C++ are platform specific. Values found on most 32-bit systems can be found at <a href="http://www.cplusplus.com/doc/tutorial/variables.html" rel="noreferrer">Variables. Data Types. - C++ Documentation</a>. How do you determine what the actual size and range are for... | <h2>C Style</h2>
<p>limits.h contains the min and max values for ints as well as other data types which should be exactly what you need:</p>
<pre><code>#include <limits.h> // C header
#include <climits> // C++ header
// Constant containing the minimum value of a signed integer (–2,147,483,648)
INT_MIN;
... | <pre><code>sizeof(int)
</code></pre>
| 46,633 |
<p>We are introducing static analysis tools into the build system for our Java product. We are using Maven2 so <a href="http://checkstyle.sourceforge.net/" rel="noreferrer">Checkstyle</a> and <a href="http://pmd.sourceforge.net/" rel="noreferrer">PMD</a> integration come for free. However it looks like there is a large... | <p>You should definitely use <a href="http://findbugs.sourceforge.net/" rel="noreferrer">FindBugs</a>. In my experience, the false-positive rate is very low, and even the least-critical warnings it reports are worth addressing to some extent.</p>
<p>As for Checkstyle vs. PMD, I would not use Checkstyle since it is pre... | <p>PMD is the finest tool when compare with checkstyles. Checkstyles may not have the capability to analyse the code while PMD offering many features to do so! Offcourse PMD has not released rules for javadoc, comments, indentations and etc. And by the way i am planning to implement these rules.......thanx</p>
| 22,316 |
<p>When I've registered an object <strong>foo</strong> to receive KVO notifications from another object <strong>bar</strong> (using addObserver:...), if I then deallocate <strong>foo</strong> do I need to send a <code>removeObserver:forKeyPath:</code> message to <strong>bar</strong> in -dealloc?</p>
| <p>You need to use <code>-removeObserver:forKeyPath:</code> to remove the observer before <code>-[NSObject dealloc]</code> runs, so yes, doing it in the <code>-dealloc</code> method of your class would work.</p>
<p>Better than that though would be to have a deterministic point where whatever owns the object that's doi... | <p>Definitely agree with Chris on the "Stick to memory (and other scarce resource) management in -dealloc and -finalize..." comment. A lot of times I'll see people try to invalidate NSTimer objects in their dealloc functions. The problem is, NSTimer retains it's targets. So, if the target of that NSTimer is self, de... | 3,483 |
<p>I am trying to setup Weblogic Server 10.3 (and Portal etc.) to use <a href="http://maven.apache.org/" rel="noreferrer">maven</a> as a build tool. I am trying to find a decent tutorial or documentation how to do this. There are some tutorials for older versions like 9.0, but there is little info for version 10.</p>
... | <p>I am using maven to build an EAR which I deploy an WebLogic Server 10.3. The tricky parts were:</p>
<ul>
<li>Finding all dependencies of the weblogic-maven-plugin</li>
<li>Putting all dependencies in the maven repo (I really recommend <a href="http://nexus.sonatype.org/" rel="noreferrer">Sonatype Nexus</a>)</li>
<l... | <p>Oracle also provide a Maven plugin: <a href="http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm" rel="nofollow">http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm</a></p>
| 36,547 |
<p>I have a web page which contains a select box. When I open a jQuery Dialog it is displayed partly behind the select box.</p>
<p>How should I approach this problem? Should I hide the select box or does jQuery offer some kind of 'shim' solution. (I have Googled but didn't find anything)</p>
<p>Here is some code:</p... | <p>Use the <a href="http://php.net/php_sapi_name" rel="noreferrer"><code>php_sapi_name()</code></a> function.</p>
<pre class="lang-php prettyprint-override"><code>if (php_sapi_name() == "cli") {
// In cli-mode
} else {
// Not in cli-mode
}
</code></pre>
<p>Here are some relevant notes from the docs:</p>
<blo... | <p>I think</p>
<pre><code>$_SERVER['REMOTE_ADDR']
</code></pre>
<p>will not be populated from the CLI.</p>
<p>Also, all the HTTP_* keys in the $_SERVER superglobal won't be populated from the CLI, or do it the right way hop just mentioned :-)</p>
| 20,952 |
<p>I am currently working on software that must emit SNMP traps for SNMP versions 1 & 2 and possibly v3 in the future. I have downloaded several and found them to be either too complex or too simplistic. All I want is to view traps and analyze the data structures within them, and the ability to import my custom MIB... | <p><a href="http://www.net-snmp.org" rel="noreferrer">netsnmp</a> - should do everything you're after, with a variety of language bindings to suit every taste.</p>
| <p>The only monitoring tools I've used that utilize SNMP monitoring are Nagios, Zenoss, OpenNMS, and the proprietary product from my company - but they're for full network monitoring.</p>
<p>How many devices are you looking to monitor? If it's only a couple, @Andrew's suggestion of netsnmp may be sufficient.</p>
| 25,004 |
<p>What Fortran compilers are there in this day and age, and which would you recommend? Please list the version of Fortran it supports, the platform it works on (e.g. *nix / Windows), and whether it cost money.</p>
<p>(Standard OS one per answer etc.)</p>
| <p>GFortran - part of GCC is free and works wherever GCC does.</p>
| <p>I just installed the latest release of Red Hat; it provides a broken gfortran, and broken gnu OpenMP. As with most compilers, it is quite important to install updates: gcc.gnu.org/wiki/GFortran
I would be using SuSE for its better support of current gnu compilers, if I didn't have so much difficulty with video drive... | 13,370 |
<p>Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via <code><script src="..."></code>, not pasted into the HTML itself.</p>
<p>Where’s the best place to put this in the HTML?</p>
<pre><code><html>
<head>
... | <p>The Yahoo! Exceptional Performance team recommend <a href="http://developer.yahoo.com/performance/rules.html#js_bottom" rel="noreferrer">placing scripts at the bottom of your page</a> because of the way browsers download components.</p>
<p>Of course Levi's comment "just before you need it and no sooner" is really t... | <p>Like others have said, it should most likely go in an external file. I prefer to include such files at the end of the <head />. This method is more human friendly than machine friendly, but that way I always know where the JS is. It is just not as readable to include script files anywhere else (imho).</p>
<p>... | 23,897 |
<p>I've been searching (with little success) for a free/opensource session clustering and replication solution for asp.net. I've run across the usual suspects (indexus sharedcache, memcached), however, each has some limitations.</p>
<ul>
<li><strong>Indexus</strong> - Very immature, stubbed session interface implemen... | <p>As far as Velocity is concerned I have heard some great things about that project lately. It's still in the developing stages and probably not primetime ready yet. But I think the project has a solid footing and will become a strong mature product from Microsoft and not fall off into the ether like you predict.</p>... | <p>Although Velocity has made progress from CTP1 to CTP2, it still leaves much to be desired. It will be some time before they provide all the important features in a distributed cache and even longer before it is tested in the market. I wish them good luck.</p>
<p>In the meantime, NCache already provides all CTP2 &am... | 3,345 |
<p>I need to select a bunch of data into a temp table to then do some secondary calculations; To help make it work more efficiently, I would like to have an IDENTITY column on that table. I know I could declare the table first with an identity, then insert the rest of the data into it, but is there a way to do it in 1... | <p>Oh ye of little faith:</p>
<pre><code>SELECT *, IDENTITY( int ) AS idcol
INTO #newtable
FROM oldtable
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/aa933208(SQL.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa933208(SQL.80).aspx</a></p>
| <p>IIRC, the INSERT INTO command uses the schema of the source table to create the temp table. That's part of the reason you can't just try to create a table with an additional column. Identity columns are internally tied to a SQL Server construct called a generator.</p>
| 15,030 |
<p>In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary to create <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.aspx" rel="noreferrer">DataContext</a> <a href="http://dotnetslackers.com/articles/csharp/InsideTheLINQToSQLDataContextClass.aspx" rel="noreferrer">cl... | <p>I disagree with John's answer. The DataContext (or Linq to Entities ObjectContext) is more of a "unit of work" than a connection. It manages change tracking, etc. See this blog post for a description:</p>
<p><a href="http://blogs.msdn.com/dinesh.kulkarni/archive/2008/04/27/lifetime-of-a-linq-to-sql-datacontext.aspx... | <p>In my experience with LINQ to SQL and LINQ to Entities a DataContext is synonymous to a connection to the database. So if you were to use multiple data stores you would need to use multiple DataContexts. My gut reaction is you wouldn't notice to much of a slow down with a DataContext that encompasses a large number ... | 2,417 |
<p>which are the best tutorials, books, software and practices to start and manage a new .net based Development Project in an Agile way with no experience with it. which methodology is easier to adopt XP|Scrum? </p>
| <p>I first learned about XP in 2004, and it completely changed my programming world-view. XP is very approachable, it encourages you to "use what works", and you can start small and work your way into it.</p>
<p>I don't know too much about SCRUM. But I can say I hate the use of the word "sprint" as it has bad connotat... | <p>A nice book about SCRUM: Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle.
<a href="https://rads.stackoverflow.com/amzn/click/com/0130676349" rel="nofollow noreferrer" rel="nofollow noreferrer">http://www.amazon.com/Agile-Software-Development-Scrum/dp/0130676349</a></p>
<p>As for software:</p... | 28,305 |
<p>I am having some trouble grasping some concepts behind the MVC framework. I am doing a very simple application which categorizes products.</p>
<p>The Creation screen will simply use a dropdown list showing the list of categories, the name of the product and submit.</p>
<p>On a normal .Net app, I would databind a s... | <p>I'm not sure if I totally grasp, but if your page is displaying a single product and the only user input is just to select a category from a drop down list, I can sorta help (but I'm a noob too!).</p>
<p>Referencing this page:</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2008/05/27/asp-net-mvc-preview-3-... | <p>Your models retrieve data, your presenter organizes data for the view, and the view controls binding your model to UI elements. For example, here's a model for a LogEvent:</p>
<pre><code>public class LogEvent{
public string Title {get;set;}
public string Date {get;set;}
public string Message {get;set;}
//... | 35,571 |
<p>I am working on a basic Struts based application that is experience major spikes in memory. We have a monitoring tool that will notice one request per user adding 3MB to the JVM heap memory. Are there any tips to encourage earlier garbage collection, free up memory or improve performance? </p>
<p>The applicati... | <p>Given the information you provide, I'd estimate that you're typically loading 1 to 2 megabytes of data for a result: 750 rows * 20 fields * 100 bytes per field = 1.4 Mb. Now consider all of the temporary objects needed between the database and the final markup. 3 Mb isn't surprising. </p>
<p>I'd only be concerned i... | <p>I believe the problem is the arraylist in the ActionForm that needs to allocate a huge chunk of memory space. I would write the query results directly to the response: read the row from the resultset, write to response, read next row, write etc. Maybe it's not MVC but it would be better for your heap :-)</p>
<p>Act... | 44,499 |
<p>The code below works. But if I comment out the line <code>Dim objRequest As MSXML2.XMLHTTP</code> and uncomment the line <code>Dim objRequest As Object</code> it fails with the error message :</p>
<blockquote>
<p>The parameter is incorrect</p>
</blockquote>
<p>Why, and what (if anything) can I do about it?</p>
... | <p>For some reason, this works:</p>
<pre><code>Dim strPostData As String
Dim objRequest As Object
strPostData = "api_id=" & strApiId & "&user=" & strUserName & "&password=" & strPassword
Set objRequest = New MSXML2.XMLHTTP
With objRequest
.Open "POST", "https://api.clickatell.com/http/a... | <p>I realise this is nearly identical to the code from Tomalek above (all credit due to you!), but this question helped me towards a full solution to a problem I had (Excel submitting to PHP server, then dealing with response)...so in case this is of any help to anyone else:</p>
<pre><code>Sub Button1_Click2()
Dim ob... | 39,786 |
<p>Suppose I have a dataset with those two immortal tables: Employee & Order <br/>
<strong>Emp</strong> -> ID, Name <br/>
<strong>Ord</strong> -> Something, Anotherthing, EmpID <br/>
And relation <strong>Rel</strong>: Ord (EmpID) -> Emp (ID) <br/></p>
<p>It works great in standard master/detail scenario <br/>
(sho... | <p>If you want to synchronize the contents of multiple controls, you will need to have them share the same binding source through the <strong>DataContext</strong> set on a common parent control. Here is an example:</p>
<pre><code><StackPanel>
<StackPanel.Resources>
<ObjectDataProvider x:Key=... | <p>Assuming that you are using a strongly-typed DataSet, in order to bind the TextBox to the 'EmpRow.Name' property, you will probably have to expose it as a property on the 'OrdDataTable' class.<br/></p>
<p>Since Visual Studio generates the typed DataSet code with partial classes, you could add the property to the 'O... | 24,826 |
<p>Thanks for going to answer my question. I have the folowing pages.</p>
<ul>
<li>login.aspx</li>
<li>default.aspx</li>
<li>xxx.aspx</li>
</ul>
<p>After logging into application default.aspx will be displayed. Now if the user is trying to open <a href="http://server/" rel="nofollow noreferrer">http://server/</a><str... | <p>Are you using Forms Authentication or doing this directly in the application? If you do something like this in your web.config it will handle all the redirecting for you.</p>
<pre><code><authentication mode="Forms">
<forms name="FwLoginCookie" loginUrl="Login.aspx"
protection="All"
... | <pre><code>Response.Redirect(Request.UrlReferrer.ToString());
</code></pre>
| 32,427 |
<p>I'm using ActiveState Perl on Windows Server 2003. </p>
<p>I want to create a directory on a Windows NTFS partition and then grant a Windows NT security group read access to the folder. Is this possible in Perl? Would I have to use Windows NT commands or is there a Perl module to do it?</p>
<p>A small example woul... | <p>The standard way is to use the <a href="http://search.cpan.org/perldoc?Win32::FileSecurity" rel="noreferrer">Win32::FileSecurity</a> module:</p>
<pre><code>use Win32::FileSecurity qw(Set MakeMask);
my $dir = 'c:/newdir';
mkdir $dir or die $!;
Set($dir, { 'Power Users'
=> MakeMask( qw( READ GENERIC_... | <p><a href="http://www.roth.net/perl/perms/" rel="noreferrer">Here</a>'s a generic permissions package for ActivePerl.</p>
<pre><code>use Win32::Perms;
# Create a new Security Descriptor and auto import permissions
# from the directory
$Dir = new Win32::Perms( 'c:/temp' ) || die;
# One of three ways to remove an ACE... | 38,849 |
<p>I believe I'm getting bitten by some combination of nested scoping rules and list comprehensions. <a href="http://www.python.org/~jeremy/weblog/040204.html" rel="noreferrer">Jeremy Hylton's blog post</a> is suggestive about the causes, but I don't really understand CPython's implementation well-enough to figure out... | <p>The problem is that with <code>return self.display</code> you return a <em>reference</em> to this list (not a copy). So what you end up with is a list where each element is a reference to self.display. To illustrate, look at the following:</p>
<pre><code>>>> a = [1,2]
>>> b = [a,a]
>>> b
... | <p>Mind if i refactor this a bit?</p>
<pre><code>def digit(n):
for i in itertools.count():
yield (i%n+1, not i%n)
</code></pre>
<p>But actually you don't need that one, if you implement the whole thing as a simple iterator:</p>
<pre><code>def counter(digits, base):
counter = [0] * digits
def ite... | 27,899 |
<p>Does the using catch the exception or throw it? i.e. </p>
<pre><code>using (StreamReader rdr = File.OpenText("file.txt"))
{
//do stuff
}
</code></pre>
<p>If the streamreader throws an exception is it caught by using or thrown so the calling function can handle it?</p>
| <p>using statements do not eat exceptions.</p>
<p>All "Using" does is scope your object to the using block, and automatically calls Dispose() on the object when it leaves the block.</p>
<p>There is a gotcha though, if a thread is forcefully aborted by an outside source, it is possible that Dispose will never be calle... | <p>"using" does not catch exceptions, it just disposes of resources in the event of unhandled exceptions.</p>
<p>Perhaps the question is, would it dispose of resources allocated in the parentheses if an error also occured in the declaration? It's hard to imagine both happening, though.</p>
| 18,030 |
<p>In VB6, ActiveX DLL is listed as a project template but in VS 2005+ there is no such thing. Where is my good old ActiveX DLL template? Many thanks in advance.</p>
| <p>A couple of concepts; .NET Assemblies are the functional equivalent to ActiveX DLLs in the .NET langauges. .NET Classes and method can be decorated with attribute that have various meaning in different context. A .NET Assembly can be turned into a ActiveX/COM DLL (or OCX) by using various attributes to assign the co... | <p>It's not quite clear from you question, but if you want to be able to consume in VB6 (or some other com environment) something created in VS2005, you want to look at the <a href="http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx" rel="nofollow noreferrer">Interop Forms Toolkit</a>. This greatly simplifies intero... | 39,623 |
<p>i need to be able to produce a "pretty" printout of an individual list item's values, with the goals being:</p>
<ul>
<li>get rid of all navigation</li>
<li>organize data as it would appear on a typical paper form (a customer requirement)</li>
</ul>
<p>i'm avoiding using InfoPath at this time due to other issues (w... | <p>Creating a custom list form is probably what you want. Without the master page attached to it or anything. </p>
<p>You can find a walkthrough here that will get you started:</p>
<p><a href="http://office.microsoft.com/en-us/sharepointdesigner/HA101191111033.aspx" rel="nofollow noreferrer">http://office.microsoft.c... | <p>Alternatively, you could export to a spreadsheet & print from there.</p>
| 21,101 |
<p>I am trying to implement the python logging handler <code>TimedRotatingFileHandler</code>.</p>
<p>When it rolls over to midnight it appends the current day in the form <code>YYYY-MM-DD</code>.</p>
<pre><code>LOGGING_MSG_FORMAT = '%(name)-14s > [%(levelname)s] [%(asctime)s] : %(message)s'
LOGGING_DATE_FORMAT = '%... | <p>"How can i change how it alters the filename?"</p>
<p>Since it isn't documented, I elected to read the source. This is what I concluded from reading the source of <code>logging/handlers.py</code></p>
<pre><code>handler = logging.handlers.TimedRotatingFileHandler("C:\\isis_ops\\logs\\Rotate_Test",'midnight',1)
han... | <p>Thanks.</p>
<p>I looked at the source.</p>
<p>There isn't really a way to change its form. Since manipulating suffix, only appends to the end of the file name. Ether way, there is no way real way to manipulate the full file name, what i was hoping for was where you can declare a file mask, and when it does the "Ro... | 43,932 |
<p>I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this:</p>
<pre><code>file = File.open("path-to-file.tar.gz")
contents = ""
file.each {|line|
contents << line
}
</code></pre>
<p>I thought that would be enough to conv... | <p>First, you should open the file as a binary file. Then you can read the entire file in, in one command.</p>
<pre><code>file = File.open("path-to-file.tar.gz", "rb")
contents = file.read
</code></pre>
<p>That will get you the entire file in a string.</p>
<p>After that, you probably want to <code>file.close</code>.... | <p>If you can encode the tar file by Base64 (and storing it in a plain text file) you can use </p>
<pre><code>File.open("my_tar.txt").each {|line| puts line}
</code></pre>
<p><strong>or</strong> </p>
<pre><code>File.new("name_file.txt", "r").each {|line| puts line}
</code></pre>
<p>to print each (text) line in the ... | 15,903 |
<p>I'm having a weird issue with a particular UITableView in my iPhone devel experience here. If you look at the following screenshot:</p>
<p><a href="http://dl-client.getdropbox.com/u/57676/brokencell.png" rel="nofollow noreferrer">alt text http://dl-client.getdropbox.com/u/57676/brokencell.png</a></p>
<p>you'll not... | <p>I've had a similar problem. For me, the single line was caused by a superfluous view that was created but never sized or placed correctly and so was 1 pixel high, floating over everything else. You can also cause this by confusing a UINavigationController about its set of subviews (by adding views directly to its la... | <p>Are you doing anything special in your -tableView:heightForRowAtIndexPath: method?</p>
<p>It looks to me like the height of the row is being set incorrectly, so the contents of the cell are expanding outside of its bounds.</p>
| 41,618 |
<p>I need the perfect algorithm or C# function to calculate the difference (distance) between 2 decimal numbers.</p>
<p>For example the difference between:<br />
<strong>100</strong> and <strong>25</strong> is <strong>75</strong><br />
<strong>100</strong> and <strong>-25</strong> is <strong>125</strong><br />
<strong... | <p>You can do it like this</p>
<pre><code>public decimal FindDifference(decimal nr1, decimal nr2)
{
return Math.Abs(nr1 - nr2);
}
</code></pre>
| <p>this works for me :),
returns the difference between two values.
I have tested it and it has worked for me in all cases, also with decimals!!!</p>
<pre><code>public static double Diference (double a,double b) {
return ((System.Math.Max(a,b)-System.Math.Min(a,b)));
}
</code></pre>
| 44,156 |
<p>Most of us have already used the casual patterns such as <a href="https://stackoverflow.com/questions/26685/what-is-mvc-and-what-are-the-advantages-of-it">MVC</a>, <a href="https://stackoverflow.com/questions/91932?sort=votes#sort-top">strategy</a>, etc.</p>
<p>But there must be some unusual solutions to unusual pr... | <p>Crash Only Software:
<a href="http://www.usenix.org/events/hotos03/tech/full_papers/candea/candea_html/" rel="noreferrer">http://www.usenix.org/events/hotos03/tech/full_papers/candea/candea_html/</a>
Abstract</p>
<p>Crash-only programs crash safely and recover quickly. There is only one way to stop such software ... | <p>The most interesting design pattern you will ever meet is one that you have created yourself, for obvious reasons.</p>
<p>That's not to say that it will be the best design pattern, just the most interesting.</p>
| 13,070 |
<p>I am having an issue when using <code>LoadControl( type, Params )</code>. Let me explain...</p>
<p>I have a super simple user control (ascx)</p>
<pre><code><%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewState="false" %>
<asp:Label runa... | <p>I have tried the following code as well - which yields the same result (i.e. both lblTitle and lblDescription are null)</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (_ErrorMessage != null)
{
lblTitle.Text = _ErrorMessage.Message;
lblDescription.Text = _ErrorMessag... | <p>Per the asp.net page lifecycle your controls are not fully added in pre-render, why don't you just load the values in page_load?</p>
| 29,807 |
<p>We have a deployment system at my office where we can automatically deploy a given build of our code to a specified dev environment (dev01, dev02, etc.). </p>
<p>These dev environments are generalized virtual machines, so our system has to configure them automatically. We have a new system requirement with our next... | <p>Another option would be to investigate using a Powershell script There are a lot powershell community snap ins to support VMs and active directory.</p>
<p><a href="http://www.computerperformance.co.uk/powershell/powershell_active_directory.htm#ADUC_(Active_Directory_Users_and_Computers)_" rel="nofollow noreferrer">... | <p>If you can run scripts, it might be as simple as runing the CACLS command on the VM. Perhaps just have your deployment script read in a config and run the appropriate CACLs commands.</p>
| 6,824 |
<p>I have a "Login" button that I want to be disabled until 3 text boxes on the same WPF form are populated with text (user, password, server). </p>
<p>I have a backing object with a boolean property called IsLoginEnabled which returns True if and only if all 3 controls have data. However, when should I be checking ... | <p>I'd get the "backing object" to raise the <code>IsLoginEnabled</code> changed event when any of the 3 fields are updated. You can then bind the button to the IsLoginEnabled property and not have to keep checking it.</p>
<p>The pseudocode would look something like this:</p>
<pre><code>Public Event IsLoginEnabledCha... | <p>Yes, I would say the easiest option would be to check it on the LostFocus or TextChanged event of each of those controls. However, if you want to do a little heavier lifting, you could implement the boolean as a dependency property that you could have bound to the button's Enable.
<a href="http://msdn.microsoft.com... | 28,974 |
<p>I need to draw some simple network topology charts, suggestions of some good tools appreciated. </p>
<p>Edit: love freeware :-)</p>
| <p>Try <a href="http://live.gnome.org/Dia" rel="nofollow noreferrer">Dia</a> - it's open source and cross platform.</p>
| <p>NetworkNotepad is a useful, if quirky, programme.</p>
| 9,704 |
<p>How can I <strong>protect a ClickOnce deployed application with a password</strong>? Do I have to change the IIS settings of the web or is there a way to do it programmatically? I'm using Visual Studio 2005 (.NET 2.0).</p>
<p>If I have to use web credentials, are auto-updates of the application still possible?</p>
... | <p>I found a possible solution by myself in this MSDN article: <a href="http://msdn.microsoft.com/en-us/library/76e4d2xw.aspx" rel="noreferrer">ClickOnce Deployment and Security</a>.</p>
<h2>ASP.NET Form-Based Authentication</h2>
<p>If you want to control which deployments each user can access, you should <strong>not... | <p>A ClickOnce installer is just a couple installer files sitting out on your web server, right? So then, you can just implement some sort of directory security on those files. You can do this on a couple different levels I believe; for example IIS permissions or (if your users are on your domain) NTFS permissions.</... | 23,744 |
<pre><code>ArrayList <String> list = new ArrayList();
list.add("behold");
list.add("bend");
list.add("bet");
list.add("bear");
list.add("beat");
list.add("become");
list.add("begin");
</code></pre>
<p>There is a way to search for the regexp bea.* and get the indexes like in ArrayList.indexOf ?</p>
<p>EDIT: re... | <p>Herms got the basics right. If you want the Strings and not the indexes then you can improve by using the Java 5 foreach loop:</p>
<pre><code>import java.util.regex.Pattern;
import java.util.ListIterator;
import java.util.ArrayList;
/**
* Finds the index of all entries in the list that matches the regex
* @param... | <p>This will a thread revival, but might be useful to somebody. You might not need indexes, probably next step will do something on the items which matched the regex and therefore you asked for indexes. But you can use Java8 streams and lambda expression:</p>
<pre><code> import java.util.regex.Pattern;
import java.... | 39,479 |
<p>I have a legacy application that I am making updates on. A couple of the tables in the database hold monthly information. The tables basically have one row per year and 12 fields for each month. I was wondering whether or not this was the best way to store monthly data. Is it better to have a record for each mon... | <p>I think it depends what you want to do with the data.</p>
<p>If you always want to pull back the data for a whole year then a field per month makes sense.</p>
<p>If you want to join onto the monthly data (e.g. SELECT total_sales * monthly.tax) then one-row-per-month is the way to go.</p>
| <p>Better (more normalized) would be to have two tables, one for the yearly data, with one row per year, and one for the monthly data with one row per month, and a column for the year... </p>
| 43,497 |
<p>When using a UITableViewController, the initWithStyle: method automatically creates the underlying UITableView with - according to the documentation - "the correct dimensions".</p>
<p>My problem is that these "correct dimensions" seem 320x460 (the iPhone's screen size), but I'm pushing this TableView/Controller pai... | <p>Why not just use a regular UIViewController and create the table manually? </p>
| <p>Set the frame in <code>UINavigationController</code>.</p>
| 27,514 |
<p>No, this is not a question about generics.</p>
<p>I have a Factory pattern with several classes with internal constructors (I don't want them being instantiated if not through the factory).</p>
<p>My problem is that <code>CreateInstance</code> fails with a "No parameterless constructor defined for this object" err... | <p>To get around this, couldnt you just alter your usage as such:</p>
<pre><code>public class GenericFactory<T> where T : MyAbstractType
{
public static T GetInstance()
{
return Activator.CreateInstance(typeof(T), true);
}
}
</code></pre>
<p>Your factory method will still be generic, but the... | <p>besides Activator.CreateInstance(typeof(T), true) to work, T should have default constructor</p>
| 8,166 |
<p>On their website they say the following</p>
<pre><code>0.25 mm nozzle: 150 to 60 micron
0.40 mm nozzle: 200 to 20 micron
0.60 mm nozzle: 400 to 20 micron
0.80 mm nozzle: 600 to 20 micron
</code></pre>
<p>That confuses me. Why can I go down to 20 micron with the 0.40, 0.60 and 0.80 nozzle but only down to 60 micron... | <p>You need a certain minimum flow rate to achieve consistent extrusion. Flow rate is the product of print speed, extrusion width (proportional to nozzle size) and print speed. If you use a very small nozzle and very low layer height, you'd need a very high printing speed to achieve a reasonable flow rate. Therefore, i... | <p>In addition of Tom van der Zanden's answer, when the filament moves too slowly through the heated part of the printhead it is very likeley to clog.</p>
<p>I have had this multiple times on my UM1+, most of the time resulting from a heated printhead with no extrusion (before or after prints). So you need to be sure ... | 388 |
<p>Environment: HP laptop with Windows XP SP2</p>
<p>I had created some encrypted files using GnuPG (gpg) for Windows. Yesterday, my hard disk failed so I had reimage the hard disk. I have now reinstalled gpg and regenerated my keys using the same passphrase as earlier. But, I am now unable to decrypt the files. I... | <p>when reimporting your keys from the old keyring, you need to specify the command:</p>
<pre><code>gpg --allow-secret-key-import --import <keyring>
</code></pre>
<p>otherwise it will only import the public keys, not the private keys.</p>
| <p>The resolution to this problem for me, was to notify the sender that he did use the Public key that I sent them but rather someone elses. You should see the key that they used. Tell them to use the correct one.</p>
| 11,676 |
<p>Can anyone explain what this mod_rewrite rule is doing?</p>
<p>I'm trying to comment the file, but the code seems to state the opposite of what I think it's doing</p>
<pre><code># Enable rewriting of URLs
RewriteEngine on
# Allow specified file types to be accessed
# Thing to test = URL
# Condition = not startin... | <pre><code>^ = begin of line
( = begin group
.* = any character, any number of times
) = end group
</code></pre>
<p>The $1 in the second part is replaced by the group in the first part.</p>
<p>Is this a Symfony rule? The idea is to pass the whole query string to the index.php (the front controller) as a parameter, so... | <p>If the URL does not start with index.php or images or css or js or robots.txt, the string "/index.php/" is prefixed.</p>
<p>As index.php is probably an executable php app, the index.php then can read the rest of the URL from its cgi environment. (it is stored in ${PATH_INFO})</p>
| 21,631 |
<p>I have a chart in a Worksheet in Excel and I have a macro set up so that when I change the value in a certain cell the range of data in the chart is set to <code>A2</code> down as far as the row number corresponding in this certain cell.</p>
<p>What I can't seem to be able to do is to modify the axis as the specifi... | <p>You should be able to set the XValues property in the same way you did in Lance's answer for your <a href="https://stackoverflow.com/questions/198045/excel-charts-setting-series-end-dynamically">other question</a>. </p>
<pre><code>Charts("chartname").SeriesCollection(1).XValues = "=MYXAXIS"
</code></pre>
<p>or wha... | <p>Does the "certain cell" contain the last row number of the data? (it isn't quite clear)</p>
<p>Suppose cell F1 contains the last row in the data. You can construct an address and range like this:</p>
<pre><code>Dim rXVals As Range
Dim sAddress AS String
sAddress = "Sheet1!$C$2:$C$" & Worksheets("Sheet1").Rang... | 25,690 |
<p>--Edit with more bgnd information--</p>
<p>A (black box) COM object returns me a string.
A 2nd COM object expects this same string as byte[] as input and returns a byte[] with the processed data.
This will be fed to a browser as downloadable, non-human-readable file that will be loaded in a client side stand-alone ... | <p>BinaryFormatter is almost certainly not what you want to use.</p>
<p>If you just need to convert a string to bytes, use <a href="http://msdn.microsoft.com/en-us/library/system.text.encoding.getbytes.aspx" rel="nofollow noreferrer">Encoding.GetBytes</a> for a suitable encoding, of course. UTF-8 is usually correct, b... | <p>Is the crap in the beginning two bytes long? </p>
<p>This could be the byte order mark of a Unicode encoded string.</p>
<blockquote>
<p><a href="http://en.wikipedia.org/wiki/Byte-order_mark" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Byte-order_mark</a></p>
</blockquote>
| 44,663 |
<p>I need to all of timestamps in a column the same amount.
I want to write an sql statement like:</p>
<p>update sometable set timecol = timecol + <4 months>;</p>
| <p>If you open a connection in Visual Studio, you can run sprocs and queries in debug mode. i.e. you can go step by step over a query with intellisense and see the values in the variables.</p>
| <p>I guess if this way is doable. You can set up a test environment and run the transaction. Once transaction is submitted, compare the database in test environment with the prodution database. </p>
<p>You can use some tool to do this comparation. Like OpenDBDiff or you can look for other tool by googling.</p>
| 49,049 |
<p>I have a query that I would like to filter in different ways at different times. The way I have done this right now by placing parameters in the criteria field of the relevant query fields, however there are many cases in which I do not want to filter on a given field but only on the other fields. Is there any way... | <p>If you construct your query like so:</p>
<pre><code>PARAMETERS ParamA Text ( 255 );
SELECT t.id, t.topic_id
FROM SomeTable t
WHERE t.id Like IIf(IsNull([ParamA]),"*",[ParamA])
</code></pre>
<p>All records will be selected if the parameter is not filled in.</p>
| <p>I don't think you can. How are you running the query? </p>
<p>I'd say if you need a query that has that many open variables, put it in a vba module or class, and call it, letting it build the string every time.</p>
| 12,222 |
<p>Is there an api to bring the vista side bar to the front (Win+Space) programatically and to do the reverse (send it to the back ground).</p>
| <p>Probably using SetWindowPos you can change it to be placed the top / bottom of the z-order or even as the top-most window. You would need to find the handle to the sidebar using FindWindow or an application like WinSpy.</p>
<p>But after that something like.</p>
<p>Sets the window on top, but not top most.</p>
<pr... | <p>You probably shouldn't do it at all, since such action may annoy the user when executed at the wrong time (95% of cases*), just like stealing focus with a "Yes/No" prompt.</p>
<p>Unless your product's task is to toggle the sidebar of course. ;)</p>
<p>There's no official API for that anyway.</p>
<p>*Purely hypoth... | 9,722 |
<p>Is there a function in glut which moves the mouse to a specific position?
There is a similar function in SDL (SDL_WarpMouse) but I want to stick to glut.</p>
| <p>I've just found it, you just have to ask the right question and google helps :D</p>
<p>Its <code>glutWarpPointer(middleX, middleY)</code>;</p>
| <p>Unless you also hide the pointer this will be very ugly. I used this once for a class project and it did the trick but it looked horrible. but then again I was using it to emulate purely relative mouse movements (basically so it couldn't leave the window). But other than that, yeah, it does the job.</p>
| 34,222 |
<p>I am looking for a simple templating solution for ruby, i.e. something that will let me write php-like or jsp-like templates (html with embedded code tags), but in ruby.
jsp is no good for me, because most hosting services (I'm on dreamhost) don't support it on their default package, and it's a little cumbersome to ... | <p>You can find pretty neat tutorial about how to set up all the server stuff for serving html with eruby over <a href="http://wiki.railsplayground.com/railsplayground/show/How+To+Use+RHTML+without+rails" rel="nofollow noreferrer">here</a>.</p>
| <p>To add something to the first answer, if you have performance issues with ERB, then you can try <a href="http://www.kuwata-lab.com/erubis/" rel="nofollow noreferrer">Erubis</a>. It is a very fast and compatible version of ERB.</p>
| 49,009 |
<p>I have a legacy WinForms Mdi App in VB.Net 2.0 which I am adding functionality to. One of the additions is a warning which needs to be raised when the current time nears a specified value (a deadline). My intention is to check the time once an hour until there is less than an hour until the deadline, then display wa... | <p>I would just use the Forms timer. I think I read that it's not as accurate, but it sounds like you don't need it to be.</p>
| <p>Ok, first things first...</p>
<p>If you want to show the user a form and do something in the background I would use the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a> class, it worked for me before.
Also, you need invoke m... | 23,313 |
<p>It seems like the only way to do this is to pass the -i parameter in when you initially run less. Does anyone know of some secret hack to make something like this work</p>
<pre><code>/something to search for/i
</code></pre>
| <p>You can also type command <code>-I</code> while less is running. It toggles case sensitivity for searches.</p>
| <p>When using -i flag, be sure to enter the search string completely in lower case, because if any letter is upper case, then its an exact match.</p>
<p>See also: the -I (capital i) flag of less(1) to change this behavior.</p>
| 3,751 |
<p>How can I convert a relative path to an absolute path in C on Unix?
Is there a convenient system function for this?</p>
<p>On Windows there is a <code>GetFullPathName</code> function that does the job, but I didn't find something similar on Unix...</p>
| <p>Use <a href="http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html" rel="noreferrer">realpath()</a>.</p>
<blockquote>
<p>The <code>realpath()</code> function shall derive,
from the pathname pointed to by
<code>file_name</code>, an absolute pathname that
names the same file, whose resolution
... | <p>Also try "getcwd"</p>
<pre><code>#include <unistd.h>
char cwd[100000];
getcwd(cwd, sizeof(cwd));
std::cout << "Absolute path: "<< cwd << "/" << __FILE__ << std::endl;
</code></pre>
<p>Result:</p>
<pre><code>Absolute path: /media/setivolkylany/WorkDisk/Programming/Sources/Micha... | 28,347 |
<p>We're implementing a hosted Windows SharePoint Services 3.0 system and I need to limit the number of users that a customer can give access to a site collection.
A customer should be able to manage his entire site collection. He should just not be able to delete the site collection itself or add more than a given num... | <p>There is not standard way of limiting the number of users that can be added to a site. Not without serious hacking or removing functionality from users.</p>
<p>One cannot eliminate the problem, only manage it:</p>
<ul>
<li>Use the <em>peoplepicker-onlysearchwithinsitecollection</em> property with Stsadm.exe to res... | <p>I do not know of anything out-of-the-box. You can achieve the same programatically by writing a custom wsp. The only issue I find in this approach is that the Site Collection Admin can retract or delete the solution even if you have your feature hidden.</p>
<p>BTW, our client wanted to restrict concurrent users and... | 34,235 |
<p>I am using the System.Web.Routing assembly in a WebForms application. When running the application deployed on win2008/IIS7 I got the following message.</p>
<blockquote>
<p>Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also m... | <p>I'm having the same issue and I think I know what the problem is.</p>
<p>I'm trying to implement a FileNotFound page under the routing system (something I've yet to figure out is how to both give a FileNotFound page AND give a 404 response in the header)</p>
<p>What I've found, is that for some reason, the pages r... | <p>I think that what you are describing is similar to a <a href="https://stackoverflow.com/questions/1724393/why-wont-iis-6-redirect-my-request-when-it-works-with-vs2008-development-server/1751353#1751353">question</a> that I had.</p>
<p>It may be that your IIS7 is running in a differnt mode nad is more like II6 than ... | 19,486 |
<p>I would like to automatically convert between tabs and spaces for indentation when I commit/update code to/from our repository. I have found the AnyEdit plugin for eclipse, which can convert directories of files. Not bad for a start, but does anybody have more expierience on how to handle this? Or maybe know of an A... | <p>Why not just use the code formatter and/or cleanup function? It has settings that take care of that stuff for you. You can even have it run automatically on save.</p>
<p><strong>Edit:</strong> As Peter Perháč points out in the comments, this only answers half the question. I don't have any practical experience, but... | <p>I use Kedit for just this thing. It also natively converts text files from Macintosh, UNIX and MS-Dos. Since it's an older editor, I use one of it's scripts to handle unicode files.
You might also want to look at some of the other smart editors.</p>
| 12,568 |
<p>This is a really basic question but...</p>
<p>I have some code like this</p>
<pre><code>var arr = Array('blah.jpg','ha.jpg');
for (var i=0; i<array.length; i++)
{
$('div#blah' + i).click(function() {
$('img').attr('src', arr[i]); });
}
</code></pre>
<p>This should bind the div with <code>id="bla... | <p>Declare a new variable inside a function that creates a new click handler that gets the current value of i as a parameter:</p>
<pre><code>function makeClickHandler(arr, local_i) {
return function() {
$('img').attr('src', arr[local_i]);
};
}
var arr = Array('blah.jpg','ha.jpg');
for (var i=0; i<a... | <p>Have 1 more variable inside the loop and increment it after using it in the closure.</p>
<pre>
<code>
var j = 0;
for (var i=0; i<array.length; i++)
{
$('div#blah' + j).click(function() {
$('img').attr('src', arr[i]); });
j++;
}
</code>
</pre>
| 39,627 |
<p>Cron installation is vixie-cron</p>
<p><code>/etc/cron.daily/rmspam.cron</code></p>
<pre><code>#!/bin/bash
/usr/bin/rm /home/user/Maildir/.SPAM/cur/*;
</code></pre>
<p>I Have this simple bash script that I want to add to a cron job (also includes spam learning commands before) but this part always fails with "Fil... | <p>If there are no files in the directory, then the wildcard will not be expanded and will be passed to the command directly. There is no file called "*", and then the command fails with "File or directory not found." Try this instead:</p>
<pre><code>if [ -f /home/user/Maildir/.SPAM/cur/* ]; then
rm /home/user/M... | <p>Are you specifying the full path to the script in the cronjob?</p>
<pre><code>00 3 * * * /home/me/myscript.sh
</code></pre>
<p>rather than</p>
<pre><code>00 3 * * * myscript.sh
</code></pre>
<hr>
<p>On another note, it's <strong>/bin/rm</strong> on all of the linux boxes I have access to. Have you double-check... | 19,038 |
<p>I have a Tevo Flash. Normally, I don't care about perpendicularity with respect to the table. But now I have a 5" disc on a ball bearing, held by a 3D printed tube with a flat bottom. If the tube's axis is not 100 % perpendicular to the bottom, the disc, when spun, wobbles at the edge: ~1/8".</p>
<p><a hre... | <p>In answer to <em>(doesn't have to the issue of the OP, but as a reaction for other readers)</em>:</p>
<blockquote>
<p>Note: this has nothing to do with bed leveling. The bed is level, the printer has a BLTouch.</p>
</blockquote>
<p><a href="/a/16605">Having a BLTouch doesn't imply the bed is level!</a> The bed is le... | <p>If you've measured the frame and it's not square, that's almost surely your problem and you need to fix it. But having a BLtouch does not mean your bed is level. The effect you're seeing is exactly what you get from using a BLtouch and mesh leveling to compensate for a non-level bed, and it's a very bad thing and wh... | 1,965 |
<p>What exactly do I need to get started with Entity Framework in VS.net 2008?</p>
<p>I am downloading SP1 for vs.net 2008 as I type this, anything else I am missing?</p>
<p>From what I understand I will have to create some XML and then use a .exe tool to spit out the code?</p>
| <p>This question has been asked before <a href="https://stackoverflow.com/questions/182497/what-is-the-best-starting-point-on-the-entity-framework-from-ms#182539">here</a>...</p>
<p>However, I'll reiterate my answer to that question:
There is a list of some tutorials available in <a href="https://stackoverflow.com/que... | <p>VS2008 SP1 comes with Entity Framework and a designer for EF project items (ADO.NET Entity Data Model), but you can use the command line tools as well if you need fine grained control.</p>
<p>So once you install the SP, you're good to go.</p>
| 23,254 |
<p>I have a distributed Java application running on 5 application servers. The servers all use the same Oracle 9i database running on a 6th machine.</p>
<p>The application need to prefetch a batch of 100 IDs from a sequence. It's relatively easy to do in a single-threaded, non-distributed environment, you can just iss... | <p>Why not just have the sequence as increment by 100 all the time? each "nextval" gives you 100 sequence numbers to work with</p>
<pre><code>SQL> create sequence so_test start with 100 increment by 100 nocache;
Sequence created.
SQL> select so_test.nextval - 99 as first_seq, so_test.currval as last_seq from d... | <p>Matthew has the correct approach here. In my opinion, it is very unusual for an application to reset a sequence's current value after every use. Much more conventional to set the increment size to whatever you need upfront.</p>
<p>Also, this way is much more performant. Selecting nextval from a sequence is a hig... | 6,541 |
<p>I need to get the fully expanded hostname of the host that my Ruby script is running on. In Perl I've used Sys::Hostname::Long with good results. Google seems to suggest I should use Socket.hostname in ruby, but that's returning just the nodename, not the full hostname.</p>
| <p>This seems to work:</p>
<pre><code>hostname = Socket.gethostbyname(Socket.gethostname).first
</code></pre>
| <p>Could be a tad simpler => hostname = Socket.gethostname </p>
| 18,263 |
<p>Do you guys have any resources on creating a Sharepoint webpart that uses the AjaxToolkit controls? I need to create a webpart that uses the Accordion control and I can't find any complete tutorial or walkthrough. I prefer a tutorial/article that doesn't use SmartPart.</p>
<p>TIA!</p>
| <p>Check out: <a href="http://www.codeplex.com/sharepointajax" rel="nofollow noreferrer">http://www.codeplex.com/sharepointajax</a></p>
| <p><a href="http://www.telerik.com" rel="nofollow noreferrer">Telerik's</a> Rad Controls for ASP.Net Ajax can be deployed in the Sharepoint environment and have a menu control with the Accordion behavior out of the box. It may save you some time.</p>
| 14,825 |
<p>We have a windows application that runs on a server and accesses 4 other servers (all of them are members in the domain) to get the messages in each of their private queues. We've just installed a new server, and for some reason when the application tries to access that computer, it gets a "Remote computer is not av... | <p>Have you fired up a packet capture tool such as <a href="http://blogs.technet.com/netmon/" rel="nofollow noreferrer">Microsoft Network Monitor</a> or <a href="http://www.wireshark.org/" rel="nofollow noreferrer">Wireshark</a> and looked at the traffic going to and from the system that gets the error? That's often th... | <p>Could it be a firewall issue?</p>
<p><a href="http://support.microsoft.com/kb/183293" rel="nofollow noreferrer">http://support.microsoft.com/kb/183293</a></p>
| 19,489 |
<p>I just finished a small project where changes were required to a pre-compiled, but no longer supported, ASP.NET web site. The code was ugly, but it was ugly before it was even compiled, and I'm quite impressed that everything still seems to work fine.</p>
<p>It took some editing, e.g. to remove control declaration... | <blockquote>
<blockquote>
<p>Will:
Due to all the compiler sugar that exists in the .NET platform</p>
</blockquote>
</blockquote>
<p>Fortunately this particular application was incredibly simple, but I don't expect to decompile into the original code, just into code works like the original, or maybe even p... | <p>If it was written in .NET 1.1 or .NET 2.0 you'll have a lot more success than anything compiled with the VS 2008 compilers, mainly because of the syntactic suger that the new language revisions brought in (Lambda, anonymous classes, etc).</p>
<p>As long as the code <em>wasn't</em> obfuscated then you should be able... | 11,153 |
<p>I'm trying to set the initial display order of the column headers in a silverlight datagrid by changing the column header DisplayIndex values. If I try to set the column order at page load time, I get an out of range exception. If I set the column order (same routine) at a later time like, in a button click handler,... | <p>I'm guessing that you've got a problem modifying the DisplayIndex of the columns in the DataGrid from the Page Loaded event as they haven't yet been created at this point. You don't say but I assume you're getting the DataGrid to AutoGenerate your columns as otherwise you could just set the DisplayIndex in your XAML... | <p>actually you need to subscribe to grid.Loaded event and reorder colums there:</p>
<pre><code>public UserManagementControl()
{
InitializeComponent();
dataGridUsers.Loaded += new RoutedEventHandler(dataGridUsers_Loaded);
}
void dataGridUsers_Loaded(object sender, RoutedEventArgs e)
{
... | 41,602 |
<p>I have an Ender 3 Pro with the BTT SKR E3 V2.0 mini with Marlin firmware 2.0.8.2.x.
I am trying to print PETG, which requires decently high temperatures.</p>
<p>I initially replaced the stock board after a thermal runaway event that seemed to have damaged it. After installing the new board and getting all the settin... | <p>I'm fairly certain I have solved this issue, and it ended up having nothing to do with the printer and everything to do with what it was plugged into!</p>
<p>I had it on a smart outlet with some automations set up to kill the power if there was ever a fire. Unfortunately, the outlet I was using was only rated for 8A... | <blockquote>
<p>Recv: T:224.24 /<strong>260.00</strong> B:88.95 /<strong>90.00</strong> @:127 B@:127</p>
</blockquote>
<h1>You are trying to achieve too much!</h1>
<p>The maximum rated temperature for an Ender3 is 260 °C, yes, but to achieve this you need to insulate the heater block with a silicon sock from losing he... | 2,155 |
<p>I'm using the following html to load dojo from Google's hosting.</p>
<pre><code><script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("dojo", "1.1.1");</script>
<script type="text/javascript">
dojo.require("dojox.gfx");
...
</code></pre>
<p>Thi... | <p>Differently from when you reference the .js files directly from the <script> tag (note that google js api also supports this, see <a href="http://code.google.com/apis/ajaxlibs/documentation/#dojo" rel="nofollow noreferrer">here</a>), google.load is not synchronous. This means that when your code reach google.l... | <p>I believe that google becomes the namespace for your imported libraries. Try: <code>google.dojo.require</code>.</p>
<p>Oh! And as pointed out below, don't forget to use google.setOnLoadCallback instead of calling your function directly.</p>
| 11,547 |
<p>I am reading a binary log file produced by a piece of equipment. </p>
<p>I have the data in a byte[]. </p>
<p>If I need to read two bytes to create a short I can do something like this:</p>
<pre><code>short value = (short)(byte[1] << 8);
value += byte[2];
</code></pre>
<p>Now I know the value is the corr... | <p><code>0xffff</code> (all bits equal to 1) is -1 for signed shorts, yes. Read up on <a href="http://en.wikipedia.org/wiki/Two's_complement" rel="nofollow noreferrer">Two's complement</a> to learn more about the details. You can switch to a larger datatype, or (as suggested by Grzenio) just use an unsigned type.</... | <p>The value of FFFF for a "short" is -1 but the value of FFFF for an "unsigned short" is 65536. </p>
<p>In this case you should make sure you are using an unsigned short if you are sure that all of your values will be positive.</p>
| 33,795 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.