instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am using the .NET 3.5 SP1 framework and I've implemented URL routing in my application. I was getting javascript errors: </p> <p><code> Error: ASP.NET Ajax client-side framework failed to load.<br> Resource interpreted as script but transferred with MIME type text/html.<br> ReferenceError: Can't find variable: S...
<p>You don't need to reference ASP.NET MVC. You can use the <a href="http://msdn.microsoft.com/en-us/library/system.web.routing.stoproutinghandler.aspx" rel="noreferrer">StopRoutingHandler</a> which implements IRouteHandler like so:</p> <pre><code>routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandl...
<p>MapRoute and IgnoreRoute are extension methods in System.Web.Mvc --- do you have that assembly referenced properly?</p>
34,446
<p>I am new to 3D printing and have an Ender 5 Pro.</p> <p>I have manually leveled the bed by setting the nozzle gap to 0.1 mm (via feeler gauges) and then printing a calibration print and manually adjusting the bed height as it prints. I can get perfect calibration prints using both a glass bed and a PEI bed, printing...
<p>Well I got a perfect print as follows:</p> <ol> <li>Loaded the .stl file.</li> <li>Set Cura to use the 'Good' profile downloaded from CHEPCLUB (recommended by a friend).</li> <li>Used <strike>Pritt-stick</strike> Scotch (glue stick) on the bed.</li> </ol> <p>I was quite loath to use glue stick, as I thought heated b...
<p>For a good adhesion the print bed should be free of any oil or fat. Wipe the print bed with pure alcohol just befor the start of printing.</p>
2,040
<p>What is the best way people have found to do String to Lower case / Upper case in C++?</p> <p>The issue is complicated by the fact that C++ isn't an English only programming language. Is there a good multilingual method?</p>
<pre><code>#include &lt;algorithm&gt; std::string data = "Abc"; std::transform(data.begin(), data.end(), data.begin(), ::toupper); </code></pre> <p><a href="http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/" rel="noreferrer">http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlo...
<p>What Steve says is right, but I guess that if your code had to support several languages, you could have a factory method that encapsulates a set of methods that do the relevant toUpper or toLower based on that language.</p>
3,259
<p>How to implement a web page that scales when the browser window is resized?</p> <p>I can lay out the elements of the page using either a table or CSS float sections, but i want the display to rescale when the browser window is resized</p> <p>i have a working solution using AJAX PRO and DIVs with overflow:auto and ...
<p>instead of using in css say "width: 200px", use stuff like "width: 50%"</p> <p>This makes it use 50% of whatever it's in, so in the case of:</p> <pre><code>&lt;body&gt; &lt;div style="width:50%"&gt; &lt;!--some stuff--&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>The div will now always take up half the wi...
<p>&lt; body onresize="resizeWindow()" onload="resizeWindow()" > PAGE &lt; /body > </p> <p></p> <pre><code> /**** Page Rescaling Function ****/ function resizeWindow() { var windowHeight = getWindowHeight(); var windowWidth = getWindowWidth(); document.getElementById("content")...
11,596
<p>In ASP.NET, when storing a value in the application cache with absolute expiry is there a method to retrieve the date/time when the item will expire? The application cache item will be refreshed if expired based on user requests.</p>
<p>There is a method signature on the HttContext.Cache object which allows you to specify a method to be called in the event that a Cached item is removed when you set a new Cache item. </p> <p>Define yourself a method that'll allow you to process that information, whether you want it to re-submit the item to the App...
<p>use the CacheItemRemovedCallback; your object may get kicked from the cache earlier than you expect anyway</p>
12,600
<p>I am getting </p> <pre><code>Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in *filename* on line 81 </code></pre> <p>While running a query to build a chart. The query gets data from the mysql db and uses it to build the chart.</p> <p>Usually, I get this error and go to the...
<p>Do this:</p> <pre><code>$rosh=mysql_query("select distinct term from search_terms") or die("Error with query: " . mysql_error()); </code></pre> <p>and this: </p> <pre><code>$bash=mysql_query($bashq) or die("Error with query: " . mysql_error(); </code></pre> <p>That will tell you when it fails. You are correc...
<p>Because your querying within a loop, one of the terms isn't processed (probably because search_terms is missing rows for that specific turn. Which is odd, since you're querying the same table.</p> <p>However, since it's a Warning, and not a fatal Error, it will still continue.</p> <p>Either way, it's seems like wr...
36,741
<p>I wanted to "emulate" a popular flash game, Chrontron, in C++ and needed some help getting started. (NOTE: Not for release, just practicing for myself)</p> <pre> Basics: Player has a time machine. On each iteration of using the time machine, a parallel state is created, co-existing with a previous state. One of the...
<p>What you should do is first to read and understand the "fixed time-step" game loop (Here's a good explanation: <a href="http://www.gaffer.org/game-physics/fix-your-timestep" rel="nofollow noreferrer">http://www.gaffer.org/game-physics/fix-your-timestep</a>).</p> <p>Then what you do is to keep a list of list of pair...
<p>After briefly glossing over the description, I think you have the right idea, I would have a state object that holds the state data, and place this into a linked list...I don't think you need parallel threads...</p> <p>as far as the graphics API, I have only used opengl, and can say that it is pretty powerful and h...
9,880
<p>I need to be able to allow query strings that contain characters like '&lt;' and '>'. However, putting something like id=mi&lt;ke into the the URL will output an error page saying:</p> <p><em>A potentially dangerous Request.QueryString value was detected from the client (id="mi&lt;ke").</em></p> <p>If I first url ...
<p>I ran into a problem similar to this. I chose to base64 encode the query string to work around it. using </p> <pre><code>System.Text.ASCIIEncoding.ASCII.GetBytes </code></pre> <p>to get the string as bytes and then </p> <pre><code>System.Convert.ToBase64String </code></pre> <p>to turn it into a "safe" string.</p...
<p>Instead of URL encode, you could encrypt your id value to get around the issue. You will probably then need to URL encode the encrypted string.</p>
44,027
<p>Is it possible to call a COM API from Java (specifically the HP/Mercury Quality Center OTA API)? If so, what's the best way?</p> <p>Is something like JACOB appropriate?</p> <p>Code fragments would be helpful for the basics :-)</p>
<p>jacob : yes, <a href="http://sourceforge.net/projects/jacob-project/" rel="noreferrer">http://sourceforge.net/projects/jacob-project/</a> is an active project that will suite your purpose pretty well.</p> <p>you can see multiple examples : <a href="http://jacob-project.wiki.sourceforge.net/Event+Callbacks" rel="nor...
<p>j-Interop is a Java-COM bridge: <a href="http://www.j-interop.org/" rel="nofollow noreferrer">j-Interop</a>. It's written in pure Java and licensed under the LGPL v3. It uses the DCOM wire protocol to call COM objects as opposed to the JNI approach used by JACOB.</p>
16,693
<p>I want a user-privileged (not root) process to launch new processes as user <code>nobody</code>. I've tried a straight call to <code>setuid</code> that fails with -1 <code>EPERM</code> on <code>Ubuntu 8.04</code>:</p> <pre><code>#include &lt;sys/types.h&gt; #include &lt;unistd.h&gt; int main() { setuid(655...
<p>You <em>will</em> require assistance and a lot of trust from your system administrator. Ordinary users are not able to run the executable of their choice on behalf on other users, period.</p> <p>She may add your application to <code>/etc/sudoers</code> with proper settings and you'll be able to run it as with <cod...
<p><a href="http://www.keltia.net/programs/calife/" rel="nofollow noreferrer"><code>calife</code></a> is an alternative to <code>sudo</code>.</p> <blockquote> <p>Calife is small program that enable a UNIX system administrator to become root (or another user) on his/her machines without giving the root password but h...
9,240
<p>I need to test whether various types of database objects exist in a given database, and I don't know how to formulate these tests in Firebird SQL. Each test has the form "Does object of type <em>X</em> with name <em>Y</em> exist?". For example, I need to test whether a table with a given name exists. The object typ...
<p>I think a lot of what you are asking can be found at <a href="http://dn.codegear.com/article/25259" rel="noreferrer">this forum post</a>. If you want to dive a little deeper, <a href="http://www.felix-colibri.com/papers/db/interbase/using_interbase_system_tables/using_interbase_system_tables.html" rel="noreferrer">...
<p>Every year, Martijn Tonies made a session in Firebird Conference</p> <p>so find in timetable in 2005 <a href="http://www.ibphoenix.com/main.nfs?a=ibphoenix&amp;page=fb_conf_timetable_2005" rel="nofollow noreferrer">http://www.ibphoenix.com/main.nfs?a=ibphoenix&amp;page=fb_conf_timetable_2005</a></p> <p>in 2006 ...
15,469
<p>How do I get the key of the current element in a <code>foreach</code> loop in C#?</p> <p>For example:</p> <h2>PHP</h2> <pre><code>foreach ($array as $key =&gt; $value) { echo("$value is assigned to key: $key"); } </code></pre> <h3>What I'm trying to do in C#:</h3> <pre><code>int[] values = { 5, 14, 29, 49, ...
<p><a href="https://stackoverflow.com/questions/60032/getting-the-array-key-in-a-foreach-loop#60035">Grauenwolf's way</a> is the most straightforward and performant way of doing this with an array:</p> <blockquote> <p>Either use a for loop or create a temp variable that you increment on each pass.</p> </blockquote> ...
<p><code>myKey = Array.IndexOf(values, val);</code></p>
8,481
<p>Even though I am an experienced programmer and engineer, I find that I always run into tedious problems when dealing with networks. Rarely do installations of routers etc work out of the box, and you find yourself trying to learn all kinds of acronyms like WPA, UPnP, etc, and have a hard time trying to map these wit...
<p>No commonality.</p> <p>Every vendor has differing ideas on what the interface should be like, and quite often different terminology.</p> <p>Not to mention the fact that most of the equipment is made in the far east and the translations, either documentation or in the software interfaces is usually very poor.</p>
<p>As covered in the latest blog (33) all software from hardware companies is bad. I'm not convinced that this is just because HW engineers aren't trained to write good software as Joel says, after all most SW engineers aren't trained to write good software either!<br> I think it's more market,money and time - you don'...
47,700
<p>How do I create a Web Application Project in VS 2008? How is it different from a "WebSite" project?</p>
<p>File--New--Project</p> <p>instead of File--New--Web Site</p> <p>It acts as a different container all together and the compile model is different.</p> <p>ScottGu provided some details when they were first launched: <a href="http://weblogs.asp.net/scottgu/archive/2006/05/08/445742.aspx" rel="nofollow noreferrer">ht...
<p>The main difference is that Web application uses .csproj file which holds the information about all the files in the project. What difference does it make? Using web site model you can add new files <strong>without</strong> visual studio, since adding new files doesn't require csproj file modifications, but using We...
42,998
<p>I am looking for a way to get the essence or the most important aspect of a webpage? If I provide a URL, is there any external service which can accomplish this? I am not looking for snap.com like service as it provides a snapshot.</p> <p>I might be willing to even implement such a system on my own. For beginning I...
<p>You can try <a href="http://developer.yahoo.com/search/content/V2/termExtraction.html" rel="nofollow noreferrer">Yahoo's Term extraction service</a></p> <p><strong>Update 02-May-2012</strong></p> <p>Yahoo has release a new <a href="http://developer.yahoo.com/contentanalysis/" rel="nofollow noreferrer">Content Anal...
<p>By snippet, do you mean like a quote that sums up the entire page you want to link to? </p> <p>So if snap.com isn't a fancy, what about the entire page? For verbosity's sake? You could try out <a href="http://www.backupurl.com/" rel="nofollow noreferrer">BackupURL</a> if you want like a cache of the entire page of ...
43,037
<p>App needs to run on the .Net Compact Framework v.3.5. Video can be any format, but I do need to be able to know when it's finished playing, so I can start another one.</p> <p>I'm hoping for a method that doesn't involve unmanaged code, if possible.</p>
<p>You need to embed it using ActiveX Hosting. There is an <a href="http://msdn.microsoft.com/en-us/library/aa446515.aspx" rel="nofollow noreferrer">MSDN tutorial</a> on it (note there is a <a href="http://blog.opennetcf.com/ctacke/2008/08/14/BugInMSDNActiveXHostingCode.aspx" rel="nofollow noreferrer">bug in the MS-pu...
<p>Silverlight is coming to windows mobile 6, its in super elite beta right now, maybe get in on that action.</p>
8,183
<p>Browse to a webpage with hyperlinks using IE (I am using IE7) Once on the page, enlarge the fonts using ctl + mouse wheel. Now when you try to hover over the hyperlinks, they are laterally displaced to the right. To click on the link, i have to move the mouse to the right till the cursor turns into a hand. Anyone...
<p>IE7 doesn't handle Zoom correctly, You can see this error on this page (I mean the page you're reading right now) if you zoom large enough, view the logout | about link at the top, hover over it, hover off to the right, back over.</p>
<p>All of the links on that page are displaced to the right on my copy of IE7 (7.0.6001.18000) even before I enlarge or shrink the fonts. Whereas other pages act normally. (My test page was <a href="http://www.frito-lay.com/fl/flstore/cgi-bin/good_questions.htm" rel="nofollow noreferrer">http://www.frito-lay.com/fl/f...
3,795
<p>When validating ping echo's, it seems that utilities / libraries often only check the checksum of the packet, and don't actually confirm that the payload sent out matches the payload that was returned. For instance, Wireshark's ICMP parser only checks for bad checksums, and that's all that Ruby's <a href="http://raa...
<p>I think you're missing the point of the checksum. The purpose of the checksum is to validate that the data is intact. The sender calculates the checksum from the data and transmits it with the data. The receiver re-calculates a checksum from the data and compares it to the one that was sent. If they don't match,...
<p>I think you're missing the point of the checksum. The purpose of the checksum is to validate that the data is intact. The sender calculates the checksum from the data and transmits it with the data. The receiver re-calculates a checksum from the data and compares it to the one that was sent. If they don't match,...
41,581
<p>I want to display data like the following:</p> <pre><code> Title Subject Summary Date </code></pre> <p>So my <code>HTML</code> looks like:</p> <pre><code>&lt;div class="title"&gt;&lt;/div&gt; &lt;div class="subject"&gt;&lt;/div&gt; &lt;div class="summary"&gt;&lt;/div&gt; &lt;div class="date"&gt;&lt;/div...
<p>It looks like you're wanting to display a table, right? So go ahead and use the &lt;table&gt; tag.</p>
<p>For the text to appear on a single line you would have to use display="inline"</p> <p>Moreover, you should really use lists to achieve this effect</p> <pre><code>&lt;ul class="headers"&gt; &lt;li&gt;Title&lt;/li&gt; &lt;li&gt;Subject&lt;/li&gt; &lt;li&gt;Summary&lt;/li&gt; &lt;li&gt;Date&lt;/li&gt; &lt;/ul...
13,808
<p>I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary).</p> <p>I'd like to start migrating this application to use a much more expressive, transparent, and non-invasive persistence strategy, and given my company's prev...
<p>The table cell needs the text-align: center.</p>
<p>The <code>text-align: center</code> should be sufficient, since you're centering the text inside a block element (h2) - adjusting the margins will change the position of the block, not the text.</p> <p>I wonder if it's just that IE is having a dummy-spit at that <code>font</code> declaration you've got there?</p>
9,414
<p>In .NET is it possible to convert a raw HTTP request to HTTPWebRequest object?</p> <p>I'm sure .NET internally doing it. Any idea which part of the .NET is actually handling this? Can I call it or is there any external library which allows raw HTTP connections?</p>
<p>I dont believe there is an exposed method to do this. You may have to find or write a parser to break the request up and then write your own class that extends HttpWebRequest.</p> <p>Here is what looks like a parser from CodeProject:</p> <p><a href="http://www.codeproject.com/KB/IP/CSHTTPServer.aspx" rel="noreferr...
<p>Google for Cassinni which was an HTTP server with source originally offered by Microsoft that could host ASP.NET calls. You do have to parse the request yourself and load it but Cassinni would be a good starting point. This URL might help:</p> <p><a href="http://blogs.msdn.com/dmitryr/archive/2005/09/27/474534.as...
41,162
<p>I've installed <a href="http://www.owfs.org/" rel="nofollow noreferrer"><code>owfs</code></a> and am trying to read the data off a <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4088" rel="nofollow noreferrer">iButton temperature logger</a>.</p> <p><code>owfs</code> lets me mount the iButton as a fuse files...
<p>I don't think there is a clever way. owpython doesn't support that telling from the API documentation. I guess <code>/proc</code> is your safest bet. Maybe have a look at the source of the owpython module and check if you can find out how it works.</p>
<p>I don't think there is a clever way. owpython doesn't support that telling from the API documentation. I guess <code>/proc</code> is your safest bet. Maybe have a look at the source of the owpython module and check if you can find out how it works.</p>
13,826
<p>Is there an easy way to tell if a ruby script is already running and then handle it appropriately? For example: I have a script called really_long_script.rb. I have it cronned to run every 5 minutes. When it runs, I want to see if the previous run is still running and then stop the execution of the second script...
<p>The ps is a really poor way of doing that and probably open to race conditions.</p> <p>The traditional Unix/Linux way would be to write the PID to a file (typically in /var/run) and check to see if that file exists on startup.</p> <p>e.g. the pidfile being located at /var/run/myscript.pid then you'd check to see i...
<p>In bash:</p> <pre><code>if ps aux | grep really_long_script.rb | grep -vq grep then echo Script already running else ruby really_long_script.rb fi </code></pre>
5,910
<p>I am using Windows 2003. I have mapped a web application into a virtual directory. This is built on framework 1.1 When i try to browse to the default page i get a error as </p> <p>Description: An error occurred during the processing of a configuration file required to service this request. Please review the specifi...
<p>LaTeX was originally designed as a reasonably flexible system on which a few standard classes were distributed — that were themselves rather <em>in</em>flexible.</p> <p>In the current state of affairs, if you want a custom layout, you need to write a few amount of supporting code yourself. How else would it happen?...
<p>Well I think <a href="http://ctan.org/" rel="nofollow noreferrer">CTAN</a> is the best resource for LaTeX and TeX-related stuff. Also lots of scientific organizations provide their own styles, it makes sense to try tracing who was the author/publisher of the paper you like and check their websites.</p>
22,531
<p>I'm a little bit stuck with a asp.net project that i'm doing! I have got a class that is called from the code behind and many of its function have no return type ie, being void. How does one do exception handling then??? Also, if the function within the class does have a return type of, for instance, a dataset how w...
<p>Only catch the exceptions where you intend to handle them properly. If you want to reflect the errors in the UI, catch them at the UI. If you want to handle them and try to deal with the issue in the business logic, then catch them and handle them at that point.</p> <p>By the way, your code is susceptable to <a hre...
<p>You don't return exceptions. You throw them. That's the point of exceptions - you don't want exception handling cluttering your method signatures!</p> <p>In your catch clauses, you don't actually do anything to handle the exceptions. Then you should not catch them at all, just let them bubble up to your code-behind...
38,198
<p>is there an easy way to transform HTML into markdown with JAVA?</p> <p>I am currently using the Java <strong><a href="http://code.google.com/p/markdownj/" rel="noreferrer">MarkdownJ</a></strong> library to transform markdown to html.</p> <pre><code>import com.petebevin.markdown.MarkdownProcessor; ... public static...
<p>There is a great library for JS called <a href="https://github.com/domchristie/turndown" rel="nofollow noreferrer">Turndown</a>, you can try it online <a href="https://mixmark-io.github.io/turndown/" rel="nofollow noreferrer">here</a>. It works for htmls that the accepted answer errors out.</p> <p>I needed it for Ja...
<p>There is a Haskell library called <a href="https://github.com/jgm/pandoc" rel="nofollow noreferrer">pandoc</a> that can convert between most markup formats.<br /> Although it is not a Java library, it can be <a href="https://stackoverflow.com/a/8496537/8583692">used through its CLI in Java</a>.</p> <p>You can get an...
8,420
<p>I have a great deal of data to keep synchronized over 4 or 5 sites around the world, around half a terabyte at each site. This changes (either adds or changes) by around 1.4 Gigabytes per day, and the data can change at any of the four sites.</p> <p>A large percentage (30%) of the data is duplicate packages (Perhap...
<p>Have you tried <a href="http://www.cis.upenn.edu/~bcpierce/unison/" rel="nofollow noreferrer">Unison</a>?</p> <p>I've had good results with it. It's basically a smarter rsync, which maybe is what you want. There is a listing comparing file syncing tools <a href="http://www.tomkelsey.pwp.blueyonder.co.uk/projects/sy...
<p>Sounds like a job for <a href="http://foldershare.com/" rel="nofollow noreferrer">Foldershare</a></p>
28,960
<p>We have a monolithic MFC GUI app that is nearing the end of it's life in C++. We are planning to build new functionality in C# and pass data between each app.</p> <p>Question is: What is the best approach for passing data between C++ and C#? </p> <p>Notes:<br/> Both ends will have a GUI front end and will probably...
<p>Personally I'd be thinking of using something like named pipes as they are easy to use from the C++ side and the System.IO.Pipes on the .NET side also.</p> <p>It would also be the path of probably least resistance if you're planning to replace the other non .NET bits of the app over time.</p>
<p>My picks would be either standard window messages (e.g. WM_FOO) or DCOM:</p> <ul> <li><p>Messages would work as long as the communication is very simple, and the overhead in setting it up is minimal. If you can boil the communication down to one or two integers per message, this would probably be a good place to st...
22,347
<p>At work today we were trying to come up with any reason you would use <a href="http://www.php.net/strspn" rel="noreferrer">strspn</a>.</p> <p>I searched google code to see if it's ever been implemented in a useful way and came up blank. I just can't imagine a situation in which I would really need to know the lengt...
<p>Although you link to the PHP manual, the <code>strspn()</code> function comes from C libraries, along with <code>strlen()</code>, <code>strcpy()</code>, <code>strcmp()</code>, etc.</p> <p><code>strspn()</code> is a convenient alternative to picking through a string character by character, testing if the characters ...
<p>It is useful specificaly for functions like atoi - where you have a string you want to convert to a number, and you don't want to deal with anything that isn't in the set "-.0123456789"</p> <p>But yes, it has limited use.</p> <p>-Adam</p>
48,638
<p>What does the SQL Action keyword do? Can I use this keyword in a trigger and determine if the trigger was called by an Insert, Delete or Update?</p>
<p>ACTION is reserved for use in ODBC function calls. <a href="http://msdn.microsoft.com/en-us/library/aa238507.aspx" rel="nofollow noreferrer">These words do not constrain the minimum SQL grammar; however, to ensure compatibility with drivers that support the core SQL grammar, applications should avoid using these key...
<p>No, you can't use it for that. But you can look at the <a href="http://msdn.microsoft.com/en-us/library/aa214435(SQL.80).aspx" rel="nofollow noreferrer">Inserted and Deleted</a> tables to see what happened.</p> <p>A vary basic example would go something like this:</p> <pre><code>If exists (select * from inserted) ...
38,313
<p>I am trying to find the crc that works with the following results. The byte string consists of 2 bytes (ie. 0xCE1E) and the crc is an single byte (ie. 0x03)</p> <pre> byte crc CE1E 03 CE20 45 CE22 6F 0000 C0 0001 D4 FFFF 95 </pre> <p>Can anyone help?</p>
<p>Assuming they are two byte (16 bit) values, I've tried a few on some online CRC generators without getting your results. So it looks like it's not a commonly used CRC algorithm.</p> <p>Do you have any clues about the likely algorithm? Or is this a homework assignment and you're supposed to reverse-engineer the CRC ...
<p><a href="http://www.geocities.com/SiliconValley/Pines/8659/crc.htm#r2" rel="nofollow noreferrer">http://www.geocities.com/SiliconValley/Pines/8659/crc.htm#r2</a></p> <p>It looks to my inexperienced eyes that you will have to implement a general crc algorithm and try it out with several polys (try the "popular" ones...
35,957
<p>If the hot-end is at ~0 on the Z axis and I go to level it, as it approaches X = 0 it begins scraping along the bed, then when moving back to probe the center of the bed (after homing X to 0) it will scrape the bed again.</p> <p>I want to add a glass plate but am worried this aggressive homing will smash the glass....
<p>I realised the simplest fix for this shortly after posting the question. In either your slicer or your printer controller (I use octoprint, so I added this there) add to the starting G-code something to lift the head so that it is above the point it is scraping across.</p> <p>For example, change your starting G-cod...
<p>Sounds like you need a different sensor? You have a lot of issues from the sounds of it. Also no code so cannot comment on your settings.</p> <p>If it always scrapes the bed (sorry but its really unclear what is going on) then lower your sensor a bit.. Best I can give you with the provided info.</p>
403
<p>I have a database which gets updated with 200-1000 new rows per day. Now, I'd like to have an SQL-statement which returns the data day-by-day, hour-by-hour so I can give a rough estimate for the current trend, i.e. how many rows will be added to the database today, just by taking a quick look at those historical gra...
<p>Hum, depending on your database engine, you'll get different results, but with PostgreSQL, I would do something like that :</p> <pre><code>SELECT date_trunc('hour', table.date), count(table.id) FROM table GROUP BY date_trunc('hour', table.date) ORDER BY date_trunc('hour', table.date) </code></pre> <p>The <a href="...
<p>I had a similar situation, using Oracle. With a table named <strong>reporting_data</strong>, I wanted a query that could tell me how many records had been inserted per hour, and how many had been inserted in 10 minute increments.</p> <p>Per hour was easy:</p> <pre><code> SELECT TO_CHAR(TRUNC(r.creation_date, '...
48,316
<p><a href="http://wiki.eclipse.org/index.php/ATF/JSDT" rel="nofollow noreferrer">Javascript Developer Tools</a> (JSDT) for Eclipse provides a nice outline view of Javascript classes, with a little symbol next to them to indicate visibility. </p> <p>Looking at <em>Preferences->Javascript->Appearance->Members Sort Orde...
<p>Seems that it is just a standard Java-based settings tree (used in many plugins) but without real implementation of JS <a href="http://javascript.crockford.com/private.html" rel="nofollow noreferrer">private members</a> stuff. Oh, we can hope that it is reserved for future use :)</p>
<p>There's no syntactical way of making a method <em>private, public</em> or <em>protected</em> in JavaScript, it strictly relies on where the method is defined (scope).</p> <p><em>Marking</em> a methods privacy is something else, there really isn't a standard for that. All I've ever heard of is the "underscore" for p...
25,472
<p>I converted my company's calendar to XSL and changed all the tables to divs. It worked pretty well, but I had a lot of 8 day week bugs to work out initially owing to precarious cross-browser spacing issues. But I was reading another post regarding when to use tables v. divs and the consensus seemed to be that you sh...
<p>A calendar is the perfect reason to use a table! Calendars inherently present tabular data and HTML tables are good at presenting tabular data. And HTML table markup provides nearly all the CSS hooks you need to associate CSS selectors with various parts of the table to dress it up. </p> <p>I'm all for using DIVs f...
<p>Tables are for displaying tabular data. So I would say <code>&lt;table&gt;</code> is ideal.</p>
6,357
<p>The company I work for has a large webapp written in C++ as an ISAPI extension (not a filter). We're currently enhancing our system to integrate with several 3rd party tools that have SOAP interfaces. Rather than roll our own, I think it would probably be best if we used some SOAP library. Ideally, it would be fr...
<p>You need to dereference the pointer to the array to get the array, then for each item in the array you will need to dereference the item to get the <code>PCREDENTIALS</code> instance.</p> <p>I found <a href="http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic33651.aspx" rel="nofollow no...
<p>You also need to calculate 'IntPtr p' correctly the code above is missing that and it will only fetch the 1st structure.</p> <p>Th following code will get all structures in 'IntPtr pCredentials'</p> <pre><code>int count; IntPtr pCredentials; if (CredEnumerate(filter, 0, out count, out pCredentials) != 0) { m_...
31,814
<p>I find myself attached to a project to integerate an interpreter into an existing application. The language to be interpreted is a derivative of Lisp, with application-specific builtins. Individual 'programs' will be run batch-style in the application.</p> <p>I'm surprised that over the years I've written a couple ...
<p>Short answer:</p> <p>The fundamental reading list for a lisp interpreter is SICP. I would not at all call it overkill, if you feel you are overqualified for the first parts of the book jump to chapter 4 and start interpreting away (although I feel this would be a loss since chapters 1-3 really are that good!).</p> <...
<p>Check out <a href="http://norvig.com/jscheme.html" rel="nofollow noreferrer">JScheme from Peter Norvig</a>. I found this amazingly simple to understand and port to C++. Uh, dunno about using scheme as a scripting language though - teaching it to jnrs is cumbersome and feels dated (helloooo 1980's).</p>
37,643
<p>I'm looking for a dead simple mailing list (unix friendly). Robustness, fine-grained configurability, "enterprise-readiness" (whatever that means) are not requirements. I just need to set up a tiny mailing list for a few friends. Rather than hack something up myself, I was wondering if anybody knows of anything alre...
<p>Mailman is one of the simplest mailing list packages I've come across, so if Mailman is more than you want to deal with I'd suggest just adding an entry into <code>/etc/aliases</code> for your mailing list.</p> <p>Of course you have to manage it by hand, but you said it's only for a few friends so that may not be a...
<p>If you want something easy to setup, with a user interface on top then I would recommend to check out <a href="https://wpmailster.com/" rel="nofollow noreferrer">WP Mailster</a> (WordPress plugin) or <a href="https://www.brandt-oss.com/mailster" rel="nofollow noreferrer">Mailster</a> (Joomla plugin).</p> <p>No matt...
9,219
<p>I have an application that reads a table from a database. </p> <p>I issue an SQL query to get a result set, based on a unique string value I glean from the results, I use a case/switch statement to generate certain objects (they inherit TreeNode BTW). These created objects get shunted into a Dictionary object to b...
<p>Is there a reason you are using the external dictionary? I would populate the tree directly as the data is queried.</p> <p>If you do require the dictionary, you could set the .Tag property of the tree node to point to the data in your dictionary.</p>
<p>have you considered using a Virtual Tree view which only loads the nodes the user actually wants to look at - i've had good success with the component from www.infralution.com </p>
8,010
<p>How do you generate C# classes for accessing WMI?</p>
<p>To generate strongly typed WMI classes, use the Management Strongly typed class generator (MgmtClassGen.exe). It's usually in C:\Program Files\Microsoft Visual Studio X\SDK\vX\Bin. The parameters are <a href="http://msdn.microsoft.com/en-us/library/2wkebaxa.aspx" rel="noreferrer">at MSDN</a> and they even have <a ...
<p>You can try WMICodeCreator it generates vbscript jscript vb.net and c# code <a href="http://www.microsoft.com/downloads/details.aspx?familyid=2cc30a64-ea15-4661-8da4-55bbc145c30e&amp;displaylang=en" rel="nofollow noreferrer">Download WMICodeCreator from Microsoft</a></p>
6,627
<p>I was wondering - do any of you actually use the various classes in the System.Security.Permissions namespace? I mainly develop desktop/server-side components (i.e., no web) and the general assumption is that FullTrust is always available and no testing is performed on environments for which this is not the case. ...
<p>The .NET code access security is more relevant when users run code directly off a server over the internet, in which case they can't necessarily trust it to automatically do things such as access the file system. I don't know of anyone who makes their code available like that, though.</p>
<p>If you deploy your desktop applications with ClickOnce, then the security sandbox can come into play.</p>
20,514
<p>I had a fresh look at Haxe again recently and realized that I had overlooked some of its elegance before. But I guess it lacks some visibility among the developers still.</p> <p>So my question is, does anybody here use it for production? If so, how do you use it? What are the gotchas or difficulties you encounter? ...
<p>I use Haxe to develop all my Flash applications, and I love it. I develop on Linux and with Emacs, and I really like how I can make Haxe fit within my preferred development environment. I just use simple Makefiles that look something like:</p> <pre> project.swf: Project.hx haxe project.hxml </pre> <p>It's r...
<p>We used it at a previous internship, for an internal web system. We only compiled to js and I just once compiled some minor code to both js and C#. I can say it worked quite well and many custom widgets were made at the time. Debugging the produced js wasn't that bad either, but it sometimes didn't produce the code ...
41,568
<p>Is it possible to identify classes that implement IDisposable. I was hoping to do so in the Visual Studio Color settings or with an addon.</p> <p>I don't use Resharper and I have heard that FXcop has this feature. I was looking for something different than these options.</p>
<p>You can use the Class View and Object Browser to determine it. But going to the definition is the best idea as the MetaData generated will show you all the methods and the inheritance of the class</p>
<p>Not at a risk of coming across the wrong way (so please don't take it that way), but the best way is to know your code and know the Framework. You should only need to look something up a couple of times to learn which are which. There is not really a dependable way apart from either checking if .Dispose() is a met...
40,347
<p>This is a fairly basic question, which for some reason, a proper solution escapes me at the moment. I am dealing with a 3rd-party SDK which declares the following structure:</p> <pre><code>struct VstEvents { VstInt32 numEvents; ///&lt; number of Events in array VstIntPtr reserved; ///&lt; zero (Reserved ...
<p>If you know how many there are you can allocate it with</p> <pre><code>struct VstEvents *evnts; evnts = (struct VstEvents*)malloc(sizeof(struct VstEvents) + numEvents*sizeof(VstEvent*)); </code></pre> <p>This will allocate 2 <strong>extra</strong> slots </p>
<p>What the structure is declaring is an array (of size 2) of pointers to VstEvent objects. You should allocate a VstEvent and assign it to events[0], setting numEvents to 1. If you have 2 VstEvents, then allocate another VstEvent, assign it to events[1], and set numEvents to 2. If you need more than 2, then you'll ...
46,838
<p>The IIS 6.0 is serving my Classical ASP pages in a serial fashion (one at a time)</p> <p>The #2 request will be handled by the web server only when the #1 request ends. </p> <p>If the #1 request takes a little longer, the #2 request will have to wait for the #1 ends to starts being handled by IIS.</p> <p><strong>...
<p>Yes, IIS or the site is most likely configured for server-side debugging, which causes all requests to the site to go through a single thread.</p> <p>To check if this is the case/turn it off:</p> <ol> <li>In the Properties pages for any Web site or Web virtual directory, click the Home Directory or Virtual Directo...
<p>Is this happening across machines? Like if you start loading a page on one computer, then another, the second is blocked? I've seen this on a single computer, but only because the browser is limiting connections to the server</p>
11,901
<p>I've installed TFS 2008, but I can't seem to access the server. When I try to connect to it in Visual Studio, I can't. If I try by browser on a remote PC, I get a generic page cannot be displayed. On the server, I get a 403. Nothing was touched in IIS and the service is running as a Network Service. Any ideas?</p>
<p>try:</p> <p><a href="http://localhost:8080/Services/V1.0/ServerStatus.asmx" rel="nofollow noreferrer">http://localhost:8080/Services/V1.0/ServerStatus.asmx</a>. This will tell you if TFS is up and running. If you are getting anything else you need to look into IIS issues.</p>
<p>What happens if you send a simple HTTP request to the server directly?</p> <p>ie: telnet 8080 [enter] GET / HTTP/1.1[enter] [enter] [enter]</p> <p>That might give a hint about whether IIS is actually serving anything. If you can do that on the server, what about from a different machine? If the results are diff...
15,754
<p>I've tried reading a JPG file using the <code>StreamReader</code> class' <code>ReadToEnd()</code> method which returns a string.</p> <p>For some reason though, when I write this string out to a file, it doesn't open.</p> <p>Is something lost when reading data into a string?</p>
<p>Strings are for <em>text</em> data. They're not for binary data - if you use them this way you <em>will</em> lose data (there are encodings you can use which won't lose data if you're lucky, but there are subtle issues which still make it a really bad idea.)</p> <p>If you're actually dealing with a file, the easies...
<p>You just can't do it this way.... Use FileStream instead.</p> <p>You cant use string to read binary files, some characters won't make its way as far as I know.</p>
30,027
<p>Both about <code>-a</code> and <code>-e</code> options in <a href="http://www.gnu.org/software/bash/manual/bashref.html#Bash-Conditional-Expressions" rel="noreferrer">Bash documentation</a> is said:</p> <pre><code>-a file True if file exists. -e file True if file exists. </code></pre> <p>Trying to get wha...
<p>I researched, and this is quite hairy:</p> <p><code>-a</code> is deprecated, thus isn't listed in the manpage for <code>/usr/bin/test</code> anymore, but still in the one for bash. Use <code>-e</code> . For single '[', the bash builtin behaves the same as the <code>test</code> bash builtin, which behaves the same a...
<p>The double bracket [[ exp ]] is a bash builtin. In bash -a and -e are the same, probably for some backwards compatibility.</p> <p>The single bracket [ exp ] is an alias for the external command "test". In "test", -a is a logical AND. Although [ nothing AND $STRING ] looks like it should be false, test has some synt...
41,587
<p>I am running the free version of Helicon ISAPI Rewrite on IIS and have several sites running through the same set of rewrite rules. Up 'til now this has been fine as all the rules have applied to all the sites. I have recently added a new site which I don't want to run through all the rules. Is there any way to make...
<p>I've done something similar, to stop mod_rewrite on a WebDAV folder: </p> <pre><code># stop processing if we're in the webdav folder RewriteCond %{REQUEST_URI} ^/webdav [NC] RewriteRule .* - [L] </code></pre> <p>That should work for your purposes too. If not or if you are interested in additional references, see t...
<p>I don't know ISAPI Rewrite syntax, but on <a href="http://iirf.codeplex.com" rel="nofollow noreferrer">IIRF</a>, the "break out" rule is like this: </p> <pre><code>## Break out of processing for all other requests to mysite.com RewriteCond %{SERVER_NAME} ^(?:www\.)?mysite\.com$ RewriteRule (.*) - [L] </code></pre...
28,343
<p>I use <a href="http://files.emacsblog.org/ryan/elisp/maxframe.el" rel="noreferrer">maxframe.el</a> to maximize my Emacs frames.</p> <p>It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor). </p> <p>When maximizing an Emacs frame, the frame e...
<p>I quickly scanned the reference that you provided to <code>maxframe.el</code> and <em>I don't think</em> that you're using the same technique that I use. Does the following code snippet help you?</p> <pre><code> (defun toggle-fullscreen () "toggles whether the currently selected frame consumes the entire display ...
<p>This sort of thing is the job of your window manager, not the job of emacs. (For example, Xmonad handles full-screen emacs just fine.)</p>
11,891
<p>Basically the subject says it all: We have a couple of components running on Java 5, they're talking to each other via RMI. Should we expect any problems, if we move some of them to Java6? By moving I mean compiling them with <code>-source/target 1.6</code> and running on a java6 vm.</p>
<p>Nope, you shouldn't expect any problems with that. But anyway take a look to <a href="http://java.sun.com/javase/6/docs/technotes/guides/rmi/relnotes.html" rel="nofollow noreferrer">the Release notes for RMI in java 6</a></p> <p>Good luck!</p>
<p>We have successfully pulled in Java 5 serialized objects into Java 6 objects so there should be no limitation on the serialization front.</p> <p>You should also be able to switch between 32bit and 64bit Java as well without issues.</p>
31,070
<p>What is the purpose/meaning of the Version property on a FormsAuthenticationTicket?</p>
<p>Just storing the ticket version number, you can understand the structure of the ticket by this value. It stores 1 for asp.net 1.1 and 2 for asp.net 2.0. Maybe in the future Microsoft will add some extra fields to the ticket then the version number will be 3.0. This number can be used by another software to different...
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.web.security.formsauthenticationticket.version.aspx" rel="nofollow noreferrer">docs</a> are less than enlightening on this one, though the default version number did change <a href="http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentica...
34,404
<p>Has anyone came across where they have to deal with .truststore file? and knowing how to import .cer into .truststore file? </p> <p>I am not sure if I have to use Java Keytool or Linux command (such as openssl command).</p> <p>Thanks</p>
<pre><code># Copy the certificate into the directory Java_home\Jre\Lib\Security # Change your directory to Java_home\Jre\Lib\Security&gt; # Import the certificate to a trust store. keytool -import -alias ca -file somecert.cer -keystore cacerts -storepass changeit [Return] Trust this certificate: [Yes] </code></pre> ...
<p>The way you import a .cer file into the trust store is the same way you'd import a .crt file from say an export from Firefox.</p> <p>You do not have to put an alias and the password of the keystore, you can just type: </p> <pre><code>keytool -v -import -file somefile.crt -alias somecrt -keystore my-cacerts </code...
48,817
<p>In all honesty, I think the answer is "no;" however, I want to get a second opinion. Basically, I need one micro-controller device to send a steady signal to another one, but the communicate between them is using RS232. So I think that I have to create/update the communication messages to get it to do what I want.</...
<p>You should be able to set something like DTR (Data Terminal Ready), pin 20, or DSR (Data Set Ready), pin 6, high and keep it there as your steady-state signal. This is how modems/terminals detect that there is a device on the other end that is ready to communicate. It all depends on what level of access you have to...
<p>It might be possible to do something like that, provided you don't mind a burst-like interface. One micro could transmit a byte and the other could do something to that byte and send it back as a response.</p>
28,872
<p>I have a some .py files that use spaces for indentation, and I'd like to convert them to tabs.</p> <p>I could easily hack together something using regexes, but I can think of several edge cases where this approach could fail. Is there a tool that does this by parsing the file and determining the indentation level ...
<p>If there are not many files to convert, you can open them in <a href="http://www.vim.org/" rel="noreferrer">vim</a>, and use the <code>:retab</code> command.</p> <p>See <a href="http://www.vim.org/htmldoc/usr_30.html#30.5" rel="noreferrer">the vim documentation</a> for more information.</p>
<p>In emacs, <code>M-x tabify</code> will convert spaces to tabs where possible. You'll probably want to set the <code>tab-width</code> variable appropriately.</p> <p>I don't know if this addresses your concern that spaces be interpreted in the same way as the python interpreter, but you could always load up python-mo...
43,984
<p>There is a pretty strong need for us to design some workflows around various processes. The problem is none of us actually know any workflow technology yet, and finding good data to compare the available options has been tedious and not entirely fruitful.</p> <p>So I figured I'd ask you guys.</p> <p>The main tech...
<p>Sharepoint and WF more like complementary technologies, designed as two different workflow authoring tools in the same ecosystem. There's a Sharepoint workflow designer, and a WF (Windows Workflow Foundation) workflow designer.</p> <p>The Sharepoint designer is meant to be an Office-like workflow editing experience...
<p>It is possible to 'rehost' the WF designer (the one from Visual Studio) in your own application, so that users can author workflows. There are a number of code examples on the web, the most important one from MS itself: <a href="http://msdn.microsoft.com/en-us/library/aa480213.aspx" rel="nofollow noreferrer">http://...
30,863
<p>Using a 3D pen I printed a small box. However, I was doing it on plain paper and of course the paper didn't come off the plastic very well. It didn't matter for that specific case, but if I want to print something else, which non-sticky surface would you recommend? Is there any way to use transparent surface (so tha...
<p>You could use a piece of glass, that's what most people using 3D printers have as a build surface. An easy source of glass for pen use would be a picture frame but the edges are likely sharp so be careful. Acrylic would also work and is easily obtained in small pieces from places like Lowes/Home Depot, I used Acry...
<p>Someone trying to get a surface to not stick. This is a first. I would try glass first. If you still have issues, I would look into coated surface, like an old tefflon pan (do not cook with PLA residue). I would suggest oil but you might start a fire.. </p>
521
<p>I have a pdf file of a logo, about 1"x2" in dimension. Can anybody provide the code snippet to import that PDF logo into another PDF file using the <a href="http://framework.zend.com/manual/en/zend.pdf.html" rel="nofollow noreferrer">Zend_PDF</a> API's? </p> <p>Ideally, I'd like to be able to place it like the PN...
<p>It looks like as of this date, there's no way to do it using the Zend_PDF API's. The Zend_Pdf_Page class has a drawContentStream() which looked promising, but when I checked into it, the method body was empty. Maybe a later release of the API will support it. </p> <p>So, if you want place another PDF inside anot...
<p>Not what you asked for, but probably what you need (:</p> <p>Convert the smaller logo pdf to a TIFF/PNG/WhatEver (using, for example, imagemagick's <code>convert</code>, or the GIMP). Then, place this image with the normal Zend API.</p> <p>This conversion could also be done on the fly, using the Imagick php class,...
9,034
<p>I was reading <a href="http://www.ibm.com/developerworks/java/library/j-dcl.html" rel="nofollow noreferrer">this article</a> about "Double-Checked locking" and out of the main topic of the article I was wondering why at some point of the article the author uses the next Idiom: </p> <blockquote> <p>Listing 7. Att...
<p>The point of locking twice was to <em>attempt</em> to prevent out-of-order writes. The memory model specifies where reorderings can occur, partly in terms of locks. The lock ensures that no writes (including any within the singleton constructor) appear to happen after the "instance = inst;" line.</p> <p>However, to...
<p>All right, but the article said that </p> <blockquote> <p>The code in Listing 7 doesn't work because of the current definition of the memory model. The Java Language Specification (JLS) demands that code within a synchronized block not be moved out of a synchronized block. However, it does not say that code not i...
19,021
<p>As an engineer I was initially interested in making parts. For example I designed and printed a better part for something which wasn't available locally, and even had a client who wanted 150 of them. But print time was 23 hours per part. and I didn't have full confidence in the robustness of the part. The layer line...
<blockquote> <p>Under what circumstances</p> </blockquote> <p>When your part has internal geometry that would be difficult and expensive to reproduce using other methods. For example fishing lures which need internal water channels. Fittings or covers that would normally require several parts to be sealed together coul...
<p>I've only just started my journey in 3d printing, but I have a little hobbyist experience in other forms of &quot;structural crafting&quot;. I can see a few ways you can use 3d printing to enhance other techniques - the main one being that a printed part can be used to make a mold, which you can then use to cast alu...
2,128
<p>Can anyone explain what is windows workflow and how can we use in the work organization. </p>
<p>Windows Workflow Foundation is a fascinating concept. It allows you to create powerful applications (or just parts of them) using a combination of flowchart-like concepts and normal code.</p> <p>The deeper value of this may not be immediately obvious. Say you're building a large e-commerce site. Over time, your wor...
<p>Windows Workflow Foundation puts the inner core concepts of development part right in front of you. So it becomes a little complex but a very powerful way of working and creating builds. The basic Idea of <strong>development using the flowchart</strong> like concepts makes it very intuitive, it becomes very easy t...
11,491
<p>I have been trying to implement Win32's <code>MessageBox</code> using GTK. The app uses SDL/OpenGL, so this isn't a GTK app.</p> <p>I handle the initialization (<code>gtk_init</code>) sort of stuff inside the <code>MessageBox</code> function as follows:</p> <pre><code>int MessageBox(HWND hwnd, const char* text, cons...
<p>Hmm, ok. I'd suggest code like this, then:</p> <pre class="lang-c prettyprint-override"><code>typedef struct { int type; int result; } DialogData; static gboolean display_dialog(gpointer user_data) { DialogData *dialog_data = user_data; GtkWidget *dialog; if (dialog_data-&gt;type &amp; ...
<p>A few things:</p> <p>You are creating (and not using) an unnecessary toplevel window, named <code>window</code>. You can just delete these lines:</p> <pre><code>window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJE...
2,276
<p>I feel like developers talk about memory leaks but when you ask them what that means many have no idea. To prevent these situations, let's decide on one.</p> <p>Please no Wikipedia definitions...</p> <blockquote> <p>What is your best definition of a <strong>memory leak</strong> and what is the <em>best way</e...
<p>There are two definitions (at least for me):</p> <p><strong>Naive definition:</strong> Failure to release <em>unreachable</em> memory, which can no longer be allocated again by any process during execution of the allocating process. This can mostly be cured by using GC (Garbage Collection) techniques or detected by...
<p><b>edit: This answer is wrong. I'm leaving it up as an example of how easy it is to be mistaken about something you think you know very well.</b> Thank you to everyone who pointed out my mistake.</p> <p>A memory leak is: A programming error. Your software borrows some memory from the system, uses it, and then fails...
40,218
<p>I have a FAT12 image file and I have to open it and read it. I would like to view this image file(directories/files with in) so I can have an idea of what outcomes I should be getting. Anyone know of a good software that would let me view this FAT12 image file? Also can someone guide towards the right directions whe...
<p>There are a number of open source FAT filesystem implementations around.</p> <p>One which I think has nice clear portable code, though there are bugs, particularly in FAT12 implementation, is <a href="http://www.larwe.com/zws/products/dosfs/index.html" rel="noreferrer">http://www.larwe.com/zws/products/dosfs/index....
<p>On Linux you can just mount it using the loopback device.</p>
40,359
<p>Are there any MVC frameworks available for WPF other than <a href="http://www.codeplex.com/caliburn/" rel="nofollow noreferrer">Caliburn</a> (which looks awesome btw)?</p>
<p>Both Caliburn and PRISM are very nice. However if you go down the path of MVC you will miss out on the powerful 2 way binding. Consider MVVM, it's a very clean and practical approach for WPF. This is the pattern Microsoft used for their expression blend.</p>
<p>one additional possibility is pureMVC (www.puremvc.org)</p> <ul> <li>it seems well-proven, has <a href="http://puremvc.org/component/option,com_wrapper/Itemid,35/" rel="nofollow noreferrer">good short doc/UML</a>, and the project is responsive, and has been ported to .NET - there exists an WPF demo, it will be publ...
43,509
<p>What's the best way of capturing an mp3 stream coming off of http and saving it to disk with python?</p> <p>Thus far I've tried</p> <pre><code>target = open(target_path, "w") conn = urllib.urlopen(stream_url) while True: target.write(conn.read(buf_size)) </code></pre> <p>This gives me data but its garbled or ...
<p>If you're on Windows, you might accidentally be doing CRLF conversions, corrupting the binary data. Try opening <code>target</code> in binary mode:</p> <pre><code>target = open(target_path, "wb") </code></pre>
<p>Perhaps the syntax changed from the previous urllib answer (that got me to the correct answer btw), but this syntax works for python3:</p> <pre><code>import urllib.request urllib.request.urlretrieve(stream_url, target_path) </code></pre>
22,719
<p>Is there a way to change several textbox's readonly attribute programatically in .net.</p>
<p>Assuming your textboxes all begin with the same prefix and exist in the page controls collection:</p> <pre><code>string commonTextBoxPrefix = "txt"; foreach (Control c in this.Controls) { if (c.GetType() == typeof(TextBox) &amp;&amp; c.Name.StartsWith(commonTextBoxPrefix)) { ((TextBox)c).Rea...
<p>You could load them as an array and change them with a loop</p>
46,300
<p>What are good ways of achieving this DB agnosticism without actually coding two DAL's? I've heard that the Data Access Application Block is suitable for this.</p>
<p>You could also look at the various ORM libraries like NHibernate. When you are targeting multiple databases, it is best to look for a tool that can create your database from configuration files or from code. That will prevent you from having to create identical databases in MySQL and MSSql.</p>
<p>Use the ADODB abstraction library for MySQL. Native MySQL library calls are pretty ugly and primitive, so you'll probably want something higher-level in any case.</p>
33,810
<p>I'm trying to upgrade a package using yum on Fedora 8. The package is <code>elfutils</code>. Here's what I have installed locally:</p> <pre><code>$ yum info elfutils Installed Packages Name : elfutils Arch : x86_64 Version: 0.130 Release: 3.fc8 Size : 436 k Repo : installed Summary: A collection of utilitie...
<p>OK, I figured it out. I needed to upgrade the <code>fedora-release</code> package. That allowed me to see all of the updated packages. Thanks to ethyreal for pointing me to the Yum upgrade FAQ.</p>
<p>i know this seems silly but did you try removing it and reinstalling?</p> <pre><code>yum remove elfutils </code></pre> <p>then</p> <pre><code>yum install elfutils </code></pre> <p>alternatively you could try updating everything:</p> <pre><code>yum update </code></pre> <p>...if their is no update marked in the ...
12,996
<p>Is there a way via System.Reflection, System.Diagnostics or other to get a reference to the actual instance that is calling a static method without passing it in to the method itself?</p> <p>For example, something along these lines</p> <pre><code>class A { public void DoSomething() { StaticClass.Ex...
<p>I do not believe you can. Even the StackTrace and StackFrame classes just give you naming information, not access to instances. </p> <p>I'm not sure exactly why you'd want to do this, but know that even if you could do it it would likely be very slow.</p> <p>A better solution would be to push the instance to a thr...
<p>I feel like I'm missing something, here. The static method can be called from literally anywhere. There's no guarantee that a class A or class B instance will appear anywhere in the call stack.</p> <p>There's got to be a better way to accomplish whatever you're trying to do.</p>
12,265
<p>Anyone have a good set of sqlplus configuration directives to help transform a given sql query into nicely tab separated output for pulling into a spreadsheet or further processing?</p>
<p>As Justin pointed out in his link, using the <code>set colsep</code> function SQLPlus command saves typing a separator for each column.</p> <p>But for tab-delimited, <code>set colsep Chr(9)</code> won't work. </p> <p>For UNIX or LINUX, use <code>set colsep ' '</code> with the space between the single-quotes bein...
<p>Check out the Oracle documentation:</p> <ul> <li><a href="http://68.142.116.68/docs/cd/B19306_01/server.102/b14357/ch6.htm#i1081008" rel="nofollow noreferrer">Formatting SQLPlus Reports</a></li> <li><a href="http://68.142.116.68/docs/cd/B19306_01/server.102/b14357/ch7.htm#sthref1452" rel="nofollow noreferrer">Gener...
13,178
<p>I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c#35342">Hidden Features of C#</a>; to become a how-to of tips and trick for windows development on a ma...
<p>@Andrew - I'm exactly in your situation. I use a MBP while my company work is purely Microsoft based: i.e., .NET, COM etc. While nothing can beat running Vista natively in Boot Camp (I've never seen Vista run so fast), the niceties of having your Mac OS be the "main" OS, for internet, mail etc. has gotten me to the ...
<p>I use a Mac Book Pro as well but I run Vista. I set aside a little space so I could also run Leopard and just use Boot Camp. You can use Boot Camp to just boot from windows so you never have to deal with Leopard unless you want to. </p> <p>I would highly reccomend it because Apple makes great hardware while Microso...
6,637
<p>Does anyone know how to get/set the call divert settings in codes running on Windows mobile 5/6? I am new to windows mobile development and wonder if there is anyway to do it using C# and .NET CF?</p>
<p>I assume you mean call forwarding? In general terms, the <a href="http://msdn.microsoft.com/en-us/library/ms899558.aspx" rel="nofollow noreferrer">Telephony API (TAPI)</a> is used for programmatically controlling the phone interface. Call forwarding is specifically handled by <a href="http://msdn.microsoft.com/en-...
<p>Thank you very much for your help. I do mean call forwarding and what I would like to do is to have a simple application, perhaps with only 2 big buttons. When pressed, one should forward the incoming calls to my work phone and the other should forward them to my home phone. Being a (desktop application) developer m...
10,616
<p>I was wondering if there is an iterator in the STL that dereferences the object pointed before returning it. This could be very useful when manipulating containers aggregating pointers. Here's an example of what I would like to be able to do:</p> <pre><code>#include &lt;vector&gt; #include &lt;iterator&gt; #include...
<p>Try Boost's <a href="http://www.boost.org/doc/libs/1_37_0/libs/iterator/doc/indirect_iterator.html" rel="noreferrer"><code>indirect_iterator</code></a>.</p> <p>An <code>indirect_iterator</code> has the same category as the iterator it is wrapping. For example, an <code>indirect_iterator&lt;int**&gt;</code> is a ran...
<p>If it is impossible using Boost, writing a custom iterator is not that hard. Here is an example of a "dereference iterator" that meets the InputIterator requirements :</p> <pre><code>#include &lt;iterator&gt; template &lt;typename T&gt; struct PointedType; template &lt;typename T&gt; struct PointedType&lt;T*&gt; ...
45,855
<p>Is it a good practice to comment code that is removed? For example:</p> <pre><code>// Code to do {task} was removed by Ajahn on 10/10/08 because {reason}. </code></pre> <p>Someone in my developer group during a peer review made a note that we should comment the lines of code to be removed. I thought this was a ter...
<p>Generally, code that is removed should not be commented, precisely because it clutters the codebase (and, why would one comment on something that doesn't exist?).</p> <p>Your defect tracking system or source control management tools are where such comments belong.</p>
<p>I also think it's a terrible suggestion :)</p> <p>You should use source control and if you remove some code you can add a comment when you commit. So you still have the code history if you want...</p>
35,576
<p>Has anyone tried using these new VS2008 MFC classes yet? I can't seem to find any examples anywhere. Even the VS2008 samples(1) don't mention these classes. (They use CToolTip.)</p> <p><em>(1) Update: My mistake. I had downloaded the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=01AE159F-08CD-49...
<p>With a <strong>debugger</strong> you can step through the program assembly interactively.<br /> With a <strong>disassembler</strong>, you can view the program assembly in more detail.<br /> With a <strong>decompiler</strong>, you can turn a program back into partial source code, assuming you know what it was written...
<p>The <a href="http://www.ntcore.com/exsuite.php" rel="nofollow noreferrer">explorer suite</a> can do what you want.</p>
34,401
<p>Is there a way to have a function return a editable reference to some internal data. Here's an example I hope helps show what I mean.</p> <pre><code>class foo { public int value; } class bar { bar() { m_foo = new foo(); m_foo.value = 42; } private m_foo; foo getFoo(){return m_...
<p>Actually, your code sample, after some cleaning up, does demonstrate that when you assign 37 to value, you are changing bar's interman m_foo too. So the answer is, your function is returning a reference type. Now, maybe your real code is different, and it's returning not an reference type but an int, a value typ...
<p>You're already returning the reference of <code>foo</code> in <code>getFoo</code> (this happens by default). So any changes that you make to the return value of <code>getFoo</code> will be reflected in the internal <code>foo</code> data structure in <code>bar</code>.</p>
35,836
<p>When I get a reference to a <code>System.Diagnostics.Process</code>, how can I know if a process is currently running?</p>
<p>This is a way to do it with the name:</p> <pre><code>Process[] pname = Process.GetProcessesByName("notepad"); if (pname.Length == 0) MessageBox.Show("nothing"); else MessageBox.Show("run"); </code></pre> <p>You can loop all process to get the ID for later manipulation:</p> <pre><code>Process[] processlist = P...
<p>Maybe (probably) I am reading the question wrongly, but are you looking for the HasExited property that will tell you that the process represented by your Process object has exited (either normally or not).</p> <p>If the process you have a reference to has a UI you can use the Responding property to determine if th...
32,822
<p>For PHP, what is the default time after which an HTTP request is deemed to have timed out? </p> <p>I'm using the PECL HTTP extension to make HTTP requests. I can set a timeout limit when making a request, however I'd like to know what the default is if nothing is explicitly specified.</p> <p>I've hunted through th...
<p>I'm quite sure what you're looking for is the <a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout" rel="nofollow noreferrer">default_socket_timeout</a> php.ini option. It appears the default is 60 seconds.</p>
<p>Just for future reference: <a href="http://svn.php.net/viewvc/pecl/http/trunk/http_request_api.c?view=markup" rel="nofollow">http://svn.php.net/viewvc/pecl/http/trunk/http_request_api.c?view=markup</a></p> <p>If I understood it correctly, the default timeout options values are:</p> <ul> <li><em>timeout</em> = <cod...
20,615
<p>I have a language-agnostic question about an algorithm.</p> <p>This comes from a (probably simple) programming challenge I read. The problem is, I'm too stupid to figure it out, and curious enough that it is bugging me.</p> <p>The goal is to sort a list of integers to ascending order by swapping the positions of n...
<p>Only read the first two paragraph is you just want a hint. There is a an efficient solution to this (unless I made a mistake of course). First sort the list. Now we can write the original list as a list of products of disjoint cycles.</p> <p>For example 5,3,4,2,1 has two cycles, (5,1) and (3,4,2). The cycle can be ...
<p>As a hint, this reeks of dynamic programming; that might not be precise enough a hint to help, but I'd rather start with too little!</p>
38,583
<p>I need to handle resultsets returning stored procedures/functions for three databases (Oracle, sybase, MS-Server). The procedures/functions are generally the same but the call is a little different in Oracle.</p> <pre><code>statement.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); ... statement.execute(); ...
<p>I suspect you would want to use the DatabaseMetaData class. Most likely <a href="http://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getDatabaseProductName--" rel="noreferrer">DatabaseMetaData.getDatabaseProductName</a> would be sufficient, though you may also want to use the getDatabaseProductV...
<p>You can use org.apache.ddlutils, class <a href="http://db.apache.org/ddlutils/api/org/apache/ddlutils/PlatformUtils.html" rel="nofollow">Platformutils</a>: </p> <pre><code>databaseName = new PlatformUtils().determineDatabaseType(dataSource) </code></pre>
31,703
<p>Deletion operations seems to be the slowest in a YUI datatable. I have a datatable with > 300 rows. I need to delete selected rows. I tried removing the selected records from the <code>recordset</code> and then calling <code>table.render()</code> .. While this is okay, can it be made better?</p>
<p>Have a look at the API docs on the "deleteRow" method for the datatable widget (at <a href="http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_deleteRow" rel="nofollow noreferrer">http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_deleteRow</a>). This looks to me like this is ...
<p>To my knowledge that is the fastest way to delete a row from a yui datatable. However, for your user's sake, unless 300 rows is necessary, you should consider pagination which is improved in version 2.6.0 (and has been split out and can now be used on other objects and not just DataTable).</p>
44,857
<p>One of the many things that's been lacking from my <a href="https://stackoverflow.com/questions/61553/track-your-reputation">scraper service</a> that I set up last week are pretty URLs. Right now the user parameter is being passed into the script with <em>?u=</em>, which is a symptom of a lazy hack (which the script...
<p>I'd be gently inclined toward leading with the userid -- option #2 -- since (what exists of) the directory structure is two different functions over a user's data. It's the user's chart, and the user's update.</p> <p>It's a pretty minor point, though, without knowing if there's plans for significant expansion of t...
<p>I agree from a context standpoint, the application followed by the parameters make much more sense to me than the surrogate key for an item followed by the context of what the item is. Ultimately I'd suggest which ever is more natural for you to program.</p>
13,772
<p>Should we add a tag for 'laser' for those of us who are attaching laser cutters/burners to 3D printers to turn them into 3D CNC. Or is this drifting too far off topic from "3d printing"?</p>
<p>A good question. I'm currently using insights I obtained from mucking about with a 3D printer with Arduino Mega 2560 and RAMPS 1.4 to dive into retrofitting an elderly CNC router (but, as a router, still, not as a printer) with a new control system (presently thinking and have on order Arduino Uno R3 and Arduino CNC...
<p>The tag <a href="https://3dprinting.stackexchange.com/questions/tagged/laser" class="post-tag" title="show questions tagged &#39;laser&#39;" rel="tag">laser</a> has been created. Would you like to provide usage guidance and edit the tag summary and body?</p> <p>So far I have found one question which is laser relate...
44
<p>I often have data in Excel or text that I need to get into SqlServer. I can use ODBC to query the Excel file and I can parse the text file. What I want though is some tool that will just grab the data and put it into tables with little / no effort. Does anyone know of such a tool?</p>
<p>Have you tried the <strong>SQL Server Import/Export Wizard</strong> ?</p> <p>In SQL Server Management Studio, right-click your Database Name, and select <strong>Tasks</strong> menu, <strong>Import Data</strong>. For Data Source, select <strong>Microsoft Excel</strong>, browse to the <strong>.XLS</strong>...</p>
<p>Seems like it'd be pretty easy to write a script that reads the text file, and converts it to "INSERT * into TABLE" Sql statements. I suspect this has already been done, but a simple implementation would be less than 100 lines of code in your favorite scripting language.</p> <p>Hey, Google says SQLServer comes with...
14,946
<p>It's hard to put this into the title, so let me explain.</p> <p>I have an application that uses Direct3D to display some mesh and directshow(vmr9 + allocator) to play some video, and then send the video frame as texture to the Direct3D portion to be applied onto the mesh. The application needs to run 24/7. At least...
<p>Yes you can do this with Direct3D 9Ex. This only works with Vista and you must use a Direct3DDevice9Ex. You can read about sharing <a href="http://msdn.microsoft.com/en-us/library/bb219800(VS.85).aspx" rel="nofollow noreferrer">resources here.</a></p>
<p>If you separate it out as a separate <strong>process</strong> then I suspect this would not be possible, but if it were a child <strong>thread</strong> then they would have shared memory addressing I believe.</p>
42,944
<p>When desinging UI for mobile apps in general which resolution could be considered safe as a general rule of thumb. My interest lies specifically in web based apps. The iPhone has a pretty high resolution for a hand held, and the Nokia E Series seem to oriented differently. Is <strong>240×320</strong> still considere...
<p>Not enough information...</p> <p>You say you're targeting a "Mobile App" but the reality is that mobile could mean anything from a cell phone with 128x128 resolution to a MID with 800x600 resolution.</p> <p>There is no "safe" resolution for such a wide range, and if you're truly targeting all of them you need to d...
<p>You mentioned Web based apps. Any particular framework you have in mind?</p> <p>In many cases, <a href="http://wurfl.sourceforge.net/index.php" rel="nofollow noreferrer">WALL</a> seems to help to large extent.</p> <p>Here's one Article, <a href="http://www.packtpub.com/article/adapting-user-devices-mobile-web-tech...
4,762
<p>nHibernate is not able to retrieve manually changed data from repository table? I have disabled second level cache also but looks like it(nhibernate) is retrieving sometimes from cache and sometimes from repository table.</p>
<p>There are two types of caches in nhibernate: session caches and second-level caches. The session cache is always caching objects seen by that session - it's how nhibernate knows which objects have changed and need to be persisted. The second-level cache, which you disabled, is below that. The information you're seei...
<p>I think you're going to have to be a bit more descriptive of your exact problem to get an answer; I have some minimal experience with nhibernate, but I can't really go about replicating what's going on and try to fix it without, say, some code.</p>
15,826
<p>OK, so we all know the daily build is the heart beat of a project, but whats the single best way of automating it? </p> <p>We have perl scripts wrapping our pipeline which includes ClearCase, VS2005 (C++), Intel FORTRAN, Inno setup. We use cron jobs on UNIX to schedule the build, and host a simple Apache web server...
<p>We're in the process of implementing CC.Net. So far it seems like it would fit your model pretty well. </p> <p>Out of the box it offers automated building, results tracking and notification. I'm not sure how detailed the build-in-progress monitoring is though.</p>
<p>I know this is a really old question, but it's still coming up in searches, so someone should mention <a href="http://jenkins-ci.org/" rel="nofollow noreferrer">Jenkins</a> - the open source continuation of Hudson.</p> <p>From the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins" rel="nofollow noref...
7,731
<p>The source database is quite large. The target database doesn't grow automatically. They are on different machines.</p> <p>I'm coming from a MS SQL Server, MySQL background and IDS11 seems overly complex (I am sure, with good reason).</p>
<p>One way to move data from one server to another is to backup the database using the dbexport command.</p> <p>Then after copying the backup files to the destination server run the dbimport command.</p> <p>To create a new database you need to create the DBSpace for the new database using the onmonitor tool, at this ...
<p>have you used the export tool ? There used to be a way if you first put the db's into quiescent mode and then you could actually copy the DBSpaces across (dbspaces tool I think... its been a few years now).</p> <p>Because with informix you used to be able to specify the DBSpaces(s) to used for the table (maybe eve...
7,486
<p>What is your favorite method to handle errors in Bash? The best example of handling errors I have found on the web was written by William Shotts, Jr at <a href="http://www.linuxcommand.org" rel="noreferrer">http://www.linuxcommand.org</a>. </p> <p>He suggests using the following function for error handling in Bash...
<p>Use a trap!</p> <pre><code>tempfiles=( ) cleanup() { rm -f &quot;${tempfiles[@]}&quot; } trap cleanup 0 error() { local parent_lineno=&quot;$1&quot; local message=&quot;$2&quot; local code=&quot;${3:-1}&quot; if [[ -n &quot;$message&quot; ]] ; then echo &quot;Error on or near line ${parent_lineno}: ${...
<p>Using trap is not always an option. For example, if you're writing some kind of re-usable function that needs error handling and that can be called from any script (after sourcing the file with helper functions), that function cannot assume anything about exit time of the outer script, which makes using traps very...
9,039
<p>Let's assume I have a model called "product." Let's assume that product has three fields. These fields are 'name' (type string), 'cost' (type integer), and 'is_visible' (type bool).</p> <p>1) How can I do a search query using the Rails "find" method (if there is another method, that's fine) so that I can search f...
<p>You would need to use the conditions option on the find method. The conditions option can be either a Hash, Array, or String. There are lots of options for conditions, so I recommend reading the <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html" rel="noreferrer">API help</a> for it. For example if...
<p>This is exactly the problem SQL was designed to solve, so why not to use it? Just add an appropriate :condition and your problem is solved.</p>
36,567
<p>I am building a small system administration web application (think Web-Min, but in RoR) and I need to be able to access system parameters from my Ruby code. For instance, I want to allow the user to change the hostname, time zone, or network config of the server. </p> <p>My current thoughts are to have a separate...
<p>You can use <a href="http://backgroundrb.rubyforge.org/" rel="nofollow noreferrer">BackgrounDRb</a>. Its purpose is to offload tasks from rails apps, and you can run the server under a different user.</p>
<p>One person suggested using something like <code>result = %x[uptime]</code> and pointed me to this <a href="http://blog.jayfields.com/2006/06/ruby-kernel-system-exec-and-x.html" rel="nofollow noreferrer">very helpful blog post</a>. I think this is workable by combining some sort of wrapper script that is called with...
32,695
<p>We're working on a rich client (written in Flex) that is connected to a Java backend, using both RMI and JMS. I was thinking about implementing the client in a DDD fashion so that it has Repositories for the CRUD operations on the domain objects.</p> <p>The problem is however that all backend communication happens ...
<p>Flex and Flash Remoting is inherently asynchronous so fighting against that paradigm is going to give you a ton of trouble. Our service delegates return AsyncToken from every method and we've never had a problem with it.</p> <p>If you want to ensure that the application doesn't render a new view or perform some ot...
<p>One straegy would be to create a facade in front of the repository. Your client will make asychronous calls to the facade which in turn makes a synchronous call to your repository. This will allow your repository to continue working in a synchronous manner while the facade manages the asynchronous aspects of your ca...
21,458
<p>I've a python script that has to launch a shell command for every file in a dir:</p> <pre><code>import os files = os.listdir(".") for f in files: os.execlp("myscript", "myscript", f) </code></pre> <p>This works fine for the first file, but after the "myscript" command has ended, the execution stops and does n...
<blockquote> <p>subprocess: The <code>subprocess</code> module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.</p> </blockquote> <p><a href="http://docs.python.org/library/subprocess.html" rel="noreferrer">http://docs.python.org/library/subprocess.ht...
<p>this worked for me fine!</p> <p><code>shell_command = "ls -l" subprocess.call(shell_command.split()) </code></p>
42,147
<p>i need to get the color at a particular coordinate from a texture. There are 2 ways i can do this, by getting and looking at the raw png data, or by sampling my generated opengl texture. Is it possible to sample an opengl texture to get the color (RGBA) at a given UV or XY coord? If so, how?</p>
<p>Off the top of my head, your options are</p> <ol> <li>Fetch the entire texture using glGetTexImage() and check the texel you're interested in.</li> <li>Draw the texel you're interested in (eg. by rendering a GL_POINTS primitive), then grab the pixel where you rendered it from the framebuffer by using glReadPixels.<...
<p>As others have suggested, reading back a texture from VRAM is horribly inefficient and should be avoided like the plague if you're even remotely interested in performance.</p> <p>Two workable solutions as far as I know:</p> <ol> <li>Keep a copy of the pixeldata handy (wastes memory though)</li> <li>Do it using a s...
21,942
<p>When we use datatable.newrow command, a new empty row added to bottom of rows. However I want newrow to added to top of datatable. How can I make it?</p>
<p>You use the NewRow to create a row with the same columns. To actually get it into the DataTable, you've got to do</p> <pre><code>myDataTable.Rows.InsertAt(myDataRow, 0); </code></pre> <p>Where 0 is the index you want to insert it at.</p>
<p>This One is Wrong</p> <pre><code>myDataTable.Rows.InsertAt(0,myDataRow); </code></pre> <p>Please use the below line instead of that</p> <pre><code>myDataTable.Rows.InsertAt(myDataRow,0); </code></pre>
43,842
<p>I have a form I am submitting via AJAX (using prototype and the built-in rails 'form_remote_tag' helper).<br> What I would like is to update one div (a status area) if there are form validation errors but a different div (the div where the form lives) if the submit goes through sucessfully.</p> <p>My code looks som...
<p>Found the issue! I was including the namespace correcly as I thought - but the real issue was that the app was only INCLUDING the .NET 3.5 assemblies and not being compiled using the 3.5 compiler, was missing some entries from web.config which I realised when I created an empty project and tried it (successfully) in...
<p>You should remove the assembly name from the import namespace...</p> <p>I guess your extension method is located in an namespace called Formatting.</p> <pre><code>namespace Formatting { public static class DateTimeExtender { public static string ToCustomShortDate(this DateTime date) { ...
38,671
<p>How to perform validation for a radio button group (one radio button should be selected) using jQuery validation plugin?</p>
<p>With newer releases of jquery (1.3+ I think), all you have to do is set one of the members of the radio set to be required and jquery will take care of the rest:</p> <pre><code>&lt;input type="radio" name="myoptions" value="blue" class="required"&gt; Blue&lt;br /&gt; &lt;input type="radio" name="myoptions" value="r...
<p>Puts the error message on top.</p> <pre class="lang-css prettyprint-override"><code>.radio-group { position: relative; margin-top: 40px; } #myoptions-error { position: absolute; top: -25px; } </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;div class=&quot;radio-group&quot;&gt; ...
35,033
<p>OK... I'm a VB.NET WinForms guy trying to understand WPF and all of its awesomeness. I'm writing a basic app as a learning experience, and have been reading lots of information and watching tutorial videos, but I just can't get off the ground with simple DataBinding, and I know I'm missing some basic concept. As muc...
<p>Here's how you need to change your XAML (the code is fine). </p> <pre><code>&lt;Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" Data...
<p>Data binding with a CLR property requires an extra step. You have to implement INotifyPropertyChanged and fire the PropertyChanged event whenever that CLR property changes. This won't make it appear in Blend, but you can bind to the property using Text="{Binding SomeText}" and setting the window's DataContext to you...
26,039