instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have to write a process (in Java) which periodically hits a URL, reads the returned XML document, and persists that data into the DB. This data is further used by my application, so I have modeled them as Hibernate-mapped POJOs.</p>
<p>I can parse the XML and then create appropriate POJOs, but I was looking for a... | <p>Another alternative could be <a href="http://jibx.sourceforge.net/" rel="nofollow noreferrer">JiBX</a> </p>
<p>Also, although you said you don't want to parse the XML, <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/package-summary.html" rel="nofollow noreferrer">XPath</a> can be a very concise wa... | <p>Using Hibernate you can directly map XML to table. This is experimental feature. Check here
<a href="http://www.hibernate.org/hib_docs/v3/reference/en-US/html/xml.html" rel="nofollow noreferrer">http://www.hibernate.org/hib_docs/v3/reference/en-US/html/xml.html</a></p>
| 32,910 |
<p>I hope there's a SharePoint expert here on SO who can help with this.</p>
<p>Here's the problem. My SharePoint logs contain this line, several times:</p>
<p><code>An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an... | <p>By far the best location for checking Disposal caveats is:</p>
<p><a href="http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example... | <p>I suggest you to take a read on : </p>
<ul>
<li><p><strike><strong>MSDN</strong> : <a href="http://msdn.microsoft.com/en-us/library/bb687949.aspx" rel="nofollow noreferrer">Best Practices: Common Coding Issues When Using the SharePoint Object Model</a></strike></p></li>
<li><p><strike><strong>MSDN</strong> : <a hre... | 26,898 |
<p>Printer: Ender 3 Pro - Direct drive, BLTouch, stock magnetic print bed surface<br />
Material: PLA - multiple brands</p>
<p>Slicer Settings:</p>
<ul>
<li>Layer Height .2 mm</li>
<li>Initial Layer Height .1 mm</li>
<li>Line Width .4 mm (with .4 mm nozzle) and also tried .39 mm</li>
<li>Wall thickness 1.2 mm (3 lines)... | <p>Assuming you do have a direct drive system as described.
Is this correct?</p>
<blockquote>
<p>Retraction Distance 6 mm speed 25 mm/s</p>
</blockquote>
<p>A retraction distance of 6 mm for direct a drive is huge and could easily be pulling the filament out so far it might become problematic. Most of my direct drive p... | <p>You appear to have severe underextrusion. It may be that you are trying to melt plastic faster than your printer can physically accomplish which would explain why it starts good and then the nozzle gets cold and then as the layers get small it comes good.
That doesn't explain why reducing the print speed doesn't hel... | 2,000 |
<p>We have a SharePoint WSS site and some of our users on on the Mac OSX platform. Are there any tips or tricks to get a similar experience to Windows with document shares and calendars on the Mac?</p>
<p>Edit: Browsing a SharePoint WSS site on a Mac, whether using Firefox or Safari, has a very similar look and feel ... | <p>Unfortunately, the "full" Sharepoint Experience is limited to running Internet Explorer 6/7 and Office 2007.</p>
<p>On the Mac, I recommend using Firefox (Camino?) which seems to work a bit better than Safari.</p>
<p>Edit: When you say "Similar experience", what exactly are you missing? I don't have any Mac here, ... | <p>ActiveX is used to enable the bridge between MOSS and Office, and as ActiveX is only on Windows, you will find that you cannot get the full experience if you do not use Windows as your OS.</p>
| 3,041 |
<p>We used Drools as part of a solution to act as a sort of filter in a very intense processing application, maybe running up to 100 rules on 500,000 + working memory objects.
turns out that it is extremely slow.
anybody else have any experience using Drools in a batch type processing application?</p>
| <p>I haven't worked with the latest version of Drools (last time I used it was about a year ago), but back then our high-load benchmarks proved it to be utterly slow. A huge disappointment after having based much of our architecture on it.</p>
<p>At least something good I remember about drools is that their dev team w... | <p>this optimizer can also be set by using parameter
-Dmvel2.disable.jit=true</p>
| 11,848 |
<p>I have the following string:</p>
<p><code>$_='364*84252';</code></p>
<p>The question is: how to replace <code>*</code> in the string with something else? I've tried <code>s/\*/$i/</code>, but there is an error: <code>Quantifier follows nothing in regex</code>. On the other hand <code>s/'*'/$i/</code> doesn't caus... | <p>Something else is weird here...</p>
<pre><code>~> cat test.pl
$a = "234*343";
$i = "FOO";
$a =~ s/\*/$i/;
print $a;
~> perl test.pl
234FOO343
</code></pre>
<p>Found something:</p>
<pre><code>~> cat test.pl
$a = "234*343";
$i = "*4";
$a =~ m/$i/;
print $a;
~> perl test.pl
Quantifier follows nothing... | <p>The error must be coming from <code>$i</code>. <code>s/\*/foo/</code> works fine.</p>
| 22,972 |
<p>In the vxWorks shell, there are a number of routines you can use to display information about the system. </p>
<p>These routines are usually referred to as <strong>show</strong> routines because they tend to have the form of "xxxShow".</p>
<p>Is there a list of these routines available?</p>
| <p>I work with VxWorks 5.5 and use the symbol lookup function "lkup" to find functions and/or variables that I may be interested in.</p>
<p>Execute the following command where ">" is the VxWorks shell prompt.</p>
<pre><code>> lkup "Show"
</code></pre>
<p>This will output a list of symbols that include the "Show" ... | <p>There is no comprehensive list of all the show routines available. This will depend on your kernel configuration and what components are included.</p>
<p>Here are a few show routines that I have found useful in the past.</p>
<p>adrSpaceShow(details 0, 1) - Show details of the Address Space, including physical add... | 17,921 |
<p>what is the proper way to scale an SDL Surface? I found one explanation online but it required redrawing the Surface pixel by pixel. It seems like there should be some way of doing this natively through SDL rather than redrawing the image like that. I haven't been able to find anything in the SDL documentation that ... | <p>SDL doesn't support scaled blitting. According to the documentation of <a href="http://www.libsdl.org/cgi/docwiki.cgi/SDL_BlitSurface" rel="noreferrer">SDL_BlitSurface</a>:</p>
<blockquote>
<p>Note: the SDL blitter does not (yet)
have the capability of scaling the
blitted surfaces up or down like it is
the ... | <p>For completeness, and because the question does not specify SDL version, scaling is possible in SDL2 using the API method <code>SDL_RenderCopyEx</code>. No additional libs besides the basic SDL2 lib are needed.</p>
<pre><code>int SDL_RenderCopyEx(SDL_Renderer* renderer,
SDL_Texture* ... | 42,566 |
<p>When I open a page(.aspx,xslt,css..etc) from the solution explorer in VS 2008 , it opens to the left of my current active tab. I am used to VS2003/VS2005 where the new page opens up to the right of current active page. How do i set all the pages to open to the right?</p>
<p>Thanks</p>
| <p>It seems this can't be done in VS 2005/VS 2008</p>
<p><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=360962" rel="nofollow noreferrer">http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=360962</a>
<a href="http://www.codeverge.net/ng.asp-net-for... | <p>It seems this can't be done in VS 2005/VS 2008</p>
<p><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=360962" rel="nofollow noreferrer">http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=360962</a>
<a href="http://www.codeverge.net/ng.asp-net-for... | 39,493 |
<p>I'm loading the XML in, and I'm able to read the XML nodes into text fields in my flash. It is also loading the URL, but the last one from the loop. It's not loading the one that I click on. I tried using <code>event.target</code>, but that is not working. I'm pretty close to figuring it out, I'm just not sure where... | <p>It seems to me that you have made this hard on yourself. I may be incorrect as it is hard to traverse through the code you have presented. The concept of an XML playlist and clicking a display object to play sounds is quite easy and I will demonstrate.</p>
<p>The XML</p>
<pre><code><?xml version="1.0" encodin... | <p>I found a solution to my problem!</p>
<p>My solution was to create an array which stored all the URLs by <code>trackNum</code>, then create instance names inside my while loop. Then, I used <code>event.target.name</code> with substring to trim off the text and leave me with just the numbers. It works awesome!</p>
... | 48,340 |
<p>I have this code that generates markets I want to be clickable with a pop up info window. </p>
<pre><code>for (i = 0; i < marker_array.length; i++) {
var point = new GLatLng(marker_array[i][0], marker_array[i][1]);
var marker = new GMarker(point, markerOptions);
GEvent.addListener(marker, "click", ... | <p>I believe your problem is that the variable html_data is the same for all iterations of this loop. You should update that variable each go-through in the loop for the values to be different.</p>
| <p>I'm not quite sure if I follow, but are you saying that all popups have the same data in them?</p>
<p>I think that this is the problem, and that's because the way the event listeners work. When the click function happens it evaluates the listener event. So the HTML you're showing is always the same, as the variable... | 47,613 |
<p>Or better said: When to use array as a field data type in a table?</p>
<p>Which solution provides better search results?</p>
| <p>I've considered this problem as well and the conclusion that I came to, is to use arrays when you want to eliminate table joins. The number of elements contained in each array isn't as important as the size of the tables involved. If there are only a few thousand rows in each table, then joining to get the 50 sub ro... | <p>The tables will always provide better search results assuming you're querying something within the actual array. With a subtable, you can index the contents trivially, whereas with an array, you'd have to literally create 50 indexes (one for each potential element within the array).</p>
| 35,378 |
<p>I have some user generated content I'm trying to render on my site. The rich text box editor I'm using renders font changes using <code><font /></code> tags, which are overridden by CSS on the page.</p>
<p>Does anyone know if there is a way to allow rules defined using the <code><font /></code> tag to s... | <p>A year late, but thought I'd share nonetheless.</p>
<p>I was frustrated by this, as well. I was using a freeware RTE JavaScript component that produced <code><FONT /></code> tags. It wasn't convenient to replace it, as it was for a client and it was a callback to fix this CSS override problem.</p>
<p>Unfortu... | <p><font> is just an element like any other; it can be styled using CSS. You can write CSS to allow the font tag's styles to push down as follows:</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>... | 35,196 |
<p>I want to play around with silverlight without having to buy a Visual Studio 2008 license.<br>
I already used my trial time with Visual Studio, so I'm trying to find another solution.</p>
<p>Any thing out there?</p>
<p>Thanks</p>
| <p>Visual Web Developer Express SP1 is supported with RC0 and later. Install it first, then install the tools. </p>
| <p>What I heard, you can use VS Express SP1 with Silverlight. </p>
| 24,054 |
<p>Should the folders in a solution match the namespace?</p>
<p>In one of my teams projects, we have a class library that has many sub-folders in the project.</p>
<p>Project Name and Namespace: <code>MyCompany.Project.Section</code>.</p>
<p>Within this project, there are several folders that match the namespace sect... | <p>Also, note that if you use the built-in templates to add classes to a folder, it will by default be put in a namespace that reflects the folder hierarchy.</p>
<p>The classes will be easier to find and that alone should be reasons good enough.</p>
<p>The rules we follow are:</p>
<ul>
<li>Project/assembly name is t... | <blockquote>
<p>What's the standard?</p>
</blockquote>
<p>There is no official standard but conventionally the folder-to-namespace mapping pattern is most widely used.</p>
<blockquote>
<p>In class libraries do the folders usually match the namespace
structure or is it a mixed bag?</p>
</blockquote>
<p>Yes, in ... | 2,667 |
<p>When using regular expressions in Ruby, what is the difference between $1 and \1?</p>
| <p>\1 is a backreference which will only work in the same <code>sub</code> or <code>gsub</code> method call, e.g.:</p>
<pre><code>"foobar".sub(/foo(.*)/, '\1\1') # => "barbar"
</code></pre>
<p>$1 is a global variable which can be used in later code:</p>
<pre><code>if "foobar" =~ /foo(.*)/ then
puts "The matchi... | <p>Keep in mind there's a third option, the block form of <code>sub</code>. Sometimes you need it. Say you want to replace some text with the reverse of that text. You can't use $1 because it's not bound quickly enough:</p>
<pre><code>"foobar".sub(/(.*)/, $1.reverse) # WRONG: either uses a PREVIOUS value of $1,
... | 36,737 |
<p>I was listening to a <a href="http://www.hanselminutes.com/default.aspx?showID=143" rel="noreferrer">recent episode of Hanselminutes</a> where Scott Hanselman was discussing accessibility in web applications and it got me thinking about accessibility in my own applications.</p>
<p>We all understand the importance o... | <p>Check out <a href="http://www.standards-schmandards.com/index.php?show/fangs" rel="nofollow noreferrer">Fangs</a></p>
<p><a href="http://www.standards-schmandards.com/index.php?show/fangs" rel="nofollow noreferrer">Fangs</a> is an in-browser tool for Firefox that emulates what a screen reader “sees” when visiting a... | <p>Biggest problem with screen readers is usually tables to position things on your page. Screenreaders can't really handle those. Put stuff in div's in your html and put them in a sensible order. Then position the div's on your page with css. Use tables to display content that should be in a table.</p>
| 8,659 |
<p>I'm working on a large c++ system that is has been in development for a few years now. As part of an effort to improve the quality of the existing code we engaged on a large long-term refactoring project.</p>
<p>Do you know a good tool that can help me write unit tests in C++? Maybe something similar to Junit or Nu... | <p>Applying unit tests to legacy code was the <strong>very reason</strong> <a href="https://rads.stackoverflow.com/amzn/click/com/0131177052" rel="noreferrer" rel="nofollow noreferrer">Working Effectively with Legacy Code</a> was written. Michael Feathers is the author - as mentioned in other answers, he was involved ... | <p>Check out fructose: <a href="http://sourceforge.net/projects/fructose/" rel="nofollow noreferrer">http://sourceforge.net/projects/fructose/</a></p>
<p>It's a very simple framework, containing only header files and thus easy portable.</p>
| 11,683 |
<p>I'm trying to find some info on the best and most common RESTful url actions.</p>
<p>for example, what url do you use for displaying the details of an item, for editing the item, updating, etc.</p>
<pre><code>/question/show/<whatever>
/question/edit/<whatever>
/question/update/<whatever> (this is... | <p><strong>Use URLs to specify your objects, not your actions:</strong></p>
<p>Note what you first mentioned is not RESTful:</p>
<pre><code>/questions/show/<whatever>
</code></pre>
<p>Instead, you should use your URLs to specify your objects:</p>
<pre><code>/questions/<question>
</code></pre>
<p>Then y... | <p>Your four examples could be:</p>
<pre><code>GET /questions/123
POST (or PUT) /questions/123 q=What+is+the+meaning+of+life
POST (or PUT) /questions/123 q=What+is+the+meaning+of+life
GET /questions
</code></pre>
<p>To add a question:</p>
<pre><code>POST /questions q=What+is+the+meaning+of+life
</code></pre>
<p>The... | 31,989 |
<p>I have a xml file like this:</p>
<pre><code><customer>
<field1 />
<field2 />
<field3>
<item1 />
</field3>
<field3>
<item1 />
</field3>
</customer>
</code></pre>
<p>field* can appear in any order and only field3 can appear more than onc... | <h2>Try this</h2>
<p>I'm not a guru, but this appears to work. </p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="customer" type="customerType"/>
<xs:complexType name="customerType">
<xs:sequence>
... | <p>Hum, this is the kind of work xsd is really not handy for. Anyway, this should do the trick if I did not make a mistake:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/NewXMLSchema"
xmlns:tns="http://www.example... | 41,406 |
<p>What free and commercial garbage collection libraries are available for C++, and what are the pros and cons of each?</p>
<p>I am interested in hard-won lessons from actual use in the field, not marketing or promotional blurb.</p>
<p>There is no need to elaborate on the usual trade offs associated with automatic ga... | <p>I have used the <a href="http://hboehm.info/gc/" rel="noreferrer">Boehm collector</a> in the past with good success. It's open source and can be used in commercial software.</p>
<p>It's a conservative collector, and has a long history of development by one of the foremost researchers in garbage collection technolog... | <p>Here's a commercial product I found in just looking for this same thing</p>
<p><a href="http://www.harnixtechnologies.ca/hnxgc/" rel="nofollow noreferrer">http://www.harnixtechnologies.ca/hnxgc/</a></p>
<p>Back in the day, there was also a product called Great Circle from Geodesic Systems, but doesn't look like they... | 10,662 |
<p>I'm looking for a strong filament that can handle a large tension load and no bending deformation when a perpendicular force is applied to it. Any suggestions?</p>
| <p>Carbon or glass fiber reinforced PLA likely has the strongest without deformation. PLA will snap before deforming.</p>
<p>Fiber reinforced ABS is also an option. ABS is stronger but will bend before breaking. </p>
<p>Both are hard on nozzles and may require a stainless steel nozzle.</p>
| <p>As far as I know, Nylon filaments are among the strongest. I'd look at the technical specs of <a href="http://taulman3d.com/index.html" rel="nofollow">Taulman3D's Filament</a>. They're the only nylon I've ever tried, and I know they have in-depth specs of how their filament holds up. I'm sure you can find other prov... | 381 |
<p>I am a beginner at SQL Server and I have a question about how best to do this.</p>
<p>I have a table that looks like this:</p>
<p>ID Parent Level<br>
1 NULL 0<br>
2 ... | <p>This will show you the rows that have issues.</p>
<pre><code>select
a.id,
a.level,
b.level as parentlevel
from
tablename a
join tablename b on a.parent = b.id
where
a.level <> b.level+1
</code></pre>
| <p>If you are using SQL Server 2005 or SQL Server 2008, then you can use a recursive CTE (common table expression). The <a href="http://msdn.microsoft.com/en-us/library/ms186243.aspx" rel="nofollow noreferrer">books online article</a> is pretty straight forward, but here's how you can do it with your code.</p>
<p>-- ... | 49,346 |
<p>I have an script that falls over if any of the procedures it is trying to create already exists. How can I check/drop if this procedure is already created?</p>
| <p>I would guess something along the lines of:</p>
<pre><code>IF EXISTS
(
SELECT *
FROM SYSPROCS
WHERE SPECIFIC_SCHEMA = ???
AND SPECIFIC_NAME = ???
AND ROUTINE_SCHEMA = ???
AND ROUTINE_NAME = ???
)
DROP PROCEDURE ???
</code></pre>
<p>I don't know if you actually need the SPECIFIC_* ... | <p>You might check for existence this way (note - make sure of case):</p>
<pre><code>SELECT *
FROM QSYS2/PROCEDURES
WHERE PROCNAME LIKE 'your-procedure-name'
AND PROCSCHEMA = 'your-procedure-library'
</code></pre>
| 19,002 |
<p>Common 3D printers (read "cheap") may be used to print masks for PCBs (printed-circuit boards) which use PTH (through-hole) components.</p>
<p>But can they be used to print PCBs which use SMD components? I'd like to make boards at least for Arduino-like SMD chips.</p>
| <p>In addition to the thermal issues Tormod raised, there is a conductivity issue. Present conductive filaments are much less conductive than copper. The power loss may be enough to affect functionality. Also, the lost power goes to heat, making the thermal problems worse.</p>
<p>For bulk materials, "volume resistivit... | <p>In theory, I imagine you can, but there are some practical considerations that might need some thought:</p>
<p>If you have a desktop printer with multiple extruders, you could probably print with both one <em>conductive</em> and one <em>structural</em> filament, and thereby build circuits in 3D.</p>
<p>One concern... | 153 |
<p>I have a solution with many projects. There is actually a Core project and a few plugins. I changed OutputPath for all plugins so all binaries end up in the Core bin\debug folder. (this is necessary as the Core do not have a reference on plugins, hence it does not "include" plugins binaries when it is compiled.)</p>... | <p>Rather than changing the output location of the plug-ins, what you could do is create a post-build script (Properties \ Build Events tab) for them that will copy the them to the Core folder. That would prevent the confusion with output folders.</p>
<p>This command line should do the trick for you:</p>
<pre><code>c... | <p>Instead of using "..\Core\bin\debug", use "$(SolutionDir)\Core\bin\debug".</p>
| 37,036 |
<p>I've got a young nephew who aspires to grow up to be a game programmer and i'd like to introduce him to the world of open-source as well as get him a sweet gift. </p>
<p>Anything like that out there?</p>
| <p>Well, this is a tricky question because we don't know the level your nephew is at, nevermind the fact that it's difficult to produce a very nice showy game without a lot more work than a beginner might put forth.</p>
<h2>X Game Station</h2>
<p>Nevertheless, <a href="http://www.xgamestation.com/" rel="noreferrer">A... | <p>Ars Technica just came out w/ an <a href="http://arstechnica.com/news.ars/post/20081001-pandora-targeting-wiz-in-open-source-gaming-handheld-war.html" rel="nofollow noreferrer">article</a> about open-source gaming consoles. They are hand-helds, so I don't know if that's an issue but they seem to be pretty nice, with... | 17,779 |
<p>I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do it by calling cygwin from a post-build event, but I was hoping for at best a Visual Studio plugi... | <p>I am not aware of any plugin that does it natively, especially since Mono users seem to prefer <a href="http://www.monodevelop.com/Main_Page" rel="nofollow noreferrer">MonoDevelop</a>.</p>
<p>However, it should be possible to use Cygwin and a custom MSBuild Task or Batch file in order to achieve that by using the n... | <p>If you don't mind using Java tools it's possible to build Debian packages with <a href="https://github.com/tcurdt/jdeb" rel="nofollow">jdeb</a> in an Ant script. That's probably lighter than relying on Cygwin.</p>
| 2,526 |
<h2>The problem</h2>
<p>When I print with my mElephant 3D printer from Makeblock, the prints come out with waved walls like in the picture below. I am using PLA filament from <a href="https://makeblock.lt" rel="noreferrer">https://makeblock.lt</a></p>
<p><img src="https://makeblock.lt/up/so/3d-waves.jpg" alt="3d-wave... | <p>I had the same problem with ABS, but printing different test objects I found out that the distance between the wavy structures depends on the cross sectional area of the object. Printing the testcube in 70.1% (1/sqrt(2) times of the original size) takes half the time per layer and the distance between two grooves do... | <p>Looks like something is catching on the z axis. A bent peice would likely cause much smaller deformations unless it was very obviously bent. Something could be loose, allowing the vertical play, perhaps the motor mounts.</p>
<p>More likely I think is a level-difference between the z-axis worm gears, possibly caused... | 514 |
<p>We are in the initial planning stages of building out a mobile site for one of our clients. This mobile site will be in addition to the main site that we have already built for them. We've determined that the content is going to be a small subsection of the main site and will target the main audience that is expec... | <p>Newer phones come with WAP2 which uses HTML Mobile Profile (XHTML MP), which is quite similar to normal HTML. Older phones use Wireless Markup Language (WML). </p>
<p>Depending on your audience I would consider making a mobile phone friendly version of the site using XHTML MP and drop WML completely. By mobile pho... | <p>I think the main difference with the 2.5G phones and the new 3G phones is that while 2.5G phones used their own browsers, browsers on 3G phones have become much more similar/accurate in their rendering capabilities.</p>
<p>On the other hand, you can use CSS to render the same HTML in either a large screen format or... | 3,086 |
<p>I have a bit of html like so:</p>
<pre><code><a href="#somthing" id="a1"><img src="something" /></a>
<a href="#somthing" id="a2"><img src="something" /></a>
</code></pre>
<p>I need to strip off the links so I'm just left with a couple of image tags. What would be the most effici... | <pre><code>$("a > img").parent() // match all <a><img></a>, select <a> parents
.each( function() // for each link
{
$(this).replaceWith( // replace the <a>
$(this).children().remove() ); // with its detached children.
});
</code></pre>
| <p>In plain javascript it would be something like:</p>
<pre><code><script type="text/javascript">
window.onload = function(){
var l = document.getElementsByTagName("a");
for(i=0, im=l.length; im>i; i++){
if(l[i].firstChild.tagName == "img"){
l[i].parentNode.replaceChild(l[i].firstChild,l[i]);
... | 22,387 |
<p>I have a large GUI project that I'd like to port to Linux.
What is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective Or is better to use something more generic other than X?</p>
<p>I feel like if I chose one of Gnome or KDE, I'm clo... | <p>Your best bet may be to port it to a cross-platform widget library such as <a href="http://en.wikipedia.org/wiki/WxWidgets" rel="noreferrer">wxWidgets</a>, which would give you portability to any platform wxWidgets supports.</p>
<p>It's also important to make the distinction between Gnome libraries and GTK, and lik... | <p>Have you thought of using Mono? Programs like Paint.NET work great under Linux & Windows.</p>
| 5,633 |
<p>I'm creating a small app in ASP.NET MVC that generates ics (iCal) files based on certain criterias. The generated files are accessible through a permanent URL (<a href="http://myserver/some/criterias.ics" rel="noreferrer">http://myserver/some/criterias.ics</a>).</p>
<p>I am looking for a way to display the calendar... | <p>I've found <a href="http://instantcal.com/" rel="noreferrer">InstantCal</a>, which does what I want. The display it creates is not that great though. Also, it seems buggy in Chrome.</p>
<p>I'd like something similar, with a simpler, nicer interface.</p>
| <p>You can import .ics files to Google Calender and view it there. Last Evening I exported a Calender from MS Outlook in CSV format and Imported that into Google Calender and I was able to share the same with my Colleagues. </p>
<p>The Procedure though is not very visible on the interface. I had to look for the <code>... | 38,579 |
<p>I'm using a custom <code>tintColor</code> on my <code>UINavigationController</code>'s navigation bar, and because the color is so light I need to use dark colored text. It's relatively easy to swap out the title view, and the custom buttons I've added on the right hand side, but I can't seem to get a custom view to ... | <p>This works, solves the original question (change the Navbar BACK button - and no buttons on other toolbars, no buttons on tab bars, etc):</p>
<pre><code>[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor], U... | <p>@DrMickeyLauer
Iterating the hierarchy to set the text color is possible in my development environment.<br>
When you populate your <code>UINavigationBar's</code> left and right views, your <code>UINavigationBar</code> will have <code>UIButtons</code> as subviews. If you're getting fancy and parenting UIToolbars to ... | 42,065 |
<p>What would be the Master Pages equivalent in the Java web development world? I've heard of Tiles, Tapestry and Velocity but don't know anything about them. Are they as easy to use as Master Pages? </p>
<p>I want something as easy as set up one template and subsequent pages derive from the template and override c... | <p>You should also check out <a href="https://facelets.java.net/" rel="nofollow noreferrer">Facelets</a>; there is a <a href="http://www.ibm.com/developerworks/java/library/j-facelets/" rel="nofollow noreferrer">good introductory article</a> on DeveloperWorks.</p>
<p>The Facelets <code><ui:insert/></code> tag is... | <p>I've used <a href="http://wiki.sitemesh.org/display/sitemesh/Home" rel="nofollow">sitemesh</a> in previous projects and it's pretty easy to set up. Essentially, you create decorators which are equivalents of master pages. You then define which child pages use which decorators. See <a href="http://today.java.net/pub/... | 4,515 |
<p>I'm trying to work through the problems on <a href="http://projecteuler.net" rel="noreferrer">projecteuler.net</a> but I keep running into a couple of problems.</p>
<p>The first is a question of storing large quanities of elements in a <code>List<t></code>. I keep getting OutOfMemoryException's when storing l... | <p>Consider <a href="https://learn.microsoft.com/en-us/dotnet/api/system.numerics.biginteger" rel="nofollow noreferrer">System.Numerics.BigInteger</a>.</p>
| <p>If you want to work with incredibly large numbers look here...</p>
<p><a href="https://github.com/Arduan77/Miki-Calculator/tree/Update20220303" rel="nofollow noreferrer">MIKI Calculator</a></p>
<p>I am not a professional programmer i write for myself, sometimes, so sorry for unprofessional use of c# but the program ... | 35,239 |
<p>What are the motivations for using a message based system?</p>
<p>I'm seeing a lot about service buses such as <a href="http://www.nservicebus.com/" rel="noreferrer">NServiceBus</a> and <a href="http://code.google.com/p/masstransit/" rel="noreferrer">Mass Transit</a> and I'm wondering what the benefits of the under... | <p>There are multiple advantages to using message based systems.</p>
<ol>
<li>Messages form a well defined technology neutral interface between applications.</li>
<li>Enables loose coupling of applications.</li>
<li>Lots of options for performance, tuning and scaling:
<ul>
<li>Deploy requester and service process on d... | <p>There is one main issue, and that is of reliability. In distributed systems, sync calls can fail of downstream system is getting overloaded. Downstream systems all would then need to be tuned to load coming from upstream, which is impractical. Messaging systems can take care of spikes. Even better is to use load bal... | 48,974 |
<p>Trying to establish a connection between my windows box (2003 server) and the oracle (11g) database.</p>
<p>I'm able to successfully ping the oracle host from the windows box. However tnsping command fails with the error tns-12532 error. </p>
<p>Any ideas to solve this issue?</p>
| <p>From <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28278/net12500.htm#sthref3514" rel="nofollow noreferrer">the Oracle Error Messages documentation</a>:</p>
<blockquote>
<p><strong>ORA-12532: TNS:invalid argument</strong></p>
<p><strong>Cause:</strong> An internal function received an invalid par... | <p>Sorry for the obvious question, but have you confirmed that you can connect to the db from another pc?</p>
| 36,707 |
<p>I am using <strong>gcc</strong> for <strong>windows</strong>. The OS is <strong>windows XP</strong>.
How do I import the homepath variable into my c program so I can write to c:\%homepath%\desktop? I would like to use something similar to:</p>
<p><code>fd = fopen("C:\\%%homepath%%\\desktop\\helloworld.txt","w")</c... | <p>Use getenv() to get the value of an environment variable, then use sprintf or strcat to compose the path.</p>
| <p>Note: you actually need to get the value of HOMEDRIVE as well, and prepend that to HOMEPATH. In many corporate environments, the home directories are kept on large network appliances or servers.</p>
| 10,158 |
<p>I have a web service that has 8 web methods. These methods are called synchronously, the first call authenticates the user, and the rest of the methods perform a unit of work, these methods are called upon until the work is done.</p>
<p>I need to store the state of the work (e.g. what actions to perform next, and w... | <p>You should take a look at <a href="http://msdn.microsoft.com/en-us/netframework/aa663328.aspx" rel="nofollow noreferrer">Windows Workflow Foundation (WF)</a>. You can design your workflow, then plug in persistence models and such.</p>
<p>That being said - you can't use the session! it won't scale once you create ... | <p>Idea 2 is mimicking Session state management. I don't see an intrinsic benefit from performing your own session statement management.</p>
| 27,960 |
<p>Is it good practice to delegate data validation entirely to the database engine constraints?</p>
<p>Validating data from the application doesn't prevent invalid insertion from another software (possibly written in another language by another team). Using database constraints you reduce the points where you need to ... | <p>Validate at input time. Validate again before you put it in the database. And have database constraints to prevent bad input. And you can bet in spite of all that, bad data will still get into your database, so validate it again when you use it.</p>
<p>It seems like every day some web app gets hacked because the... | <p>I would say it's potentially a bad practice, depending on what happens when the query fails. For example, if your database could throw an error that was intelligently handled by an application, then you might be ok.</p>
<p>On the other hand, if you don't put any validation in your app, you might not have any bad d... | 11,462 |
<p>In CakePHP putting a querystring in the url doesn't cause it to be automatically parsed and split like it normally is when the controller is directly invoked. </p>
<p>For example:</p>
<pre><code>$this->testAction('/testing/post?company=utCompany', array('return' => 'vars')) ;
</code></pre>
<p>will result in... | <p>I have what is either a hack (i.e. may not work for future CakePHP releases) or an undocumented feature.</p>
<p>If the second testAction parameter includes an named array called 'url' then the values will be placed in the $this->params object in the controller. This gives us the same net result as when the controll... | <p>use _GET['parmname'];</p>
| 24,529 |
<p>Please respond with <strong>one by one</strong>.</p>
<p>If you explain why it is not true then try to avoid general statements and provide particular examples.</p>
| <p>That all the parentheses make code unreadable. After about two weeks, and with a decent text editor, you just stop noticing them.</p>
<p>[ETA - just found a quote by long-time lisper Kenny Tilton: "Parentheses? What parentheses? I haven't noticed any parentheses since my first month of Lisp programming. I li... | <p>Any sufficiently advanced application is indistinguishable from line noise.</p>
| 15,405 |
<p>Does anyone know of a simple method for solving this?</p>
<p>I have a table which consists of start times for events and the associated durations. I need to be able to split the event durations into thirty minute intervals. So for example if an event starts at 10:45:00 and the duration is 00:17:00 then the returned... | <p>You could create a lookup table with just the times (over 24 hours), and join to that table. You would need to rebase the date to that used in the lookup. Then perform a datediff on the upper and lower intervals to work out their durations. Each middle interval would be 30 minutes.</p>
<pre><code>create table #inte... | <p>You could create a lookup table with just the times (over 24 hours), and join to that table. You would need to rebase the date to that used in the lookup. Then perform a datediff on the upper and lower intervals to work out their durations. Each middle interval would be 30 minutes.</p>
<pre><code>create table #inte... | 31,496 |
<p>I need to determine if I'm on a particular view. My use case is that I'd like to decorate navigation elements with an "on" class for the current view. Is there a built in way of doing this?</p>
| <p>Here what i am using. I think this is actually generated by the MVC project template in VS:</p>
<pre><code>public static bool IsCurrentAction(this HtmlHelper helper, string actionName, string controllerName)
{
string currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
... | <p>Here is something a little different, use a FilterAttribute:</p>
<pre><code> [NavigationLocationFilter("Products")]
public ViewResult List()
{
return View();
}
</code></pre>
<p>...</p>
<pre><code>public class NavigationLocationFilterAttribute : ActionFilterAttribute
{
public string Curr... | 6,177 |
<p>void (int a[]) {
a[5] = 3; // this is wrong?
}</p>
<p>Can I do this so that the array that is passed in is modified?</p>
<p>Sorry for deleting, a bit new here...</p>
<p>I have another question which might answer my question:</p>
<p>If I have</p>
<pre><code>void Test(int a) {
}
void Best(int &a) {
}... | <pre><code>void Test(int a[])
{
a[5] = 3;
}
</code></pre>
<p>just alternate syntax for:</p>
<pre><code>void Test(int* a)
{
*(a+5) = 3;
}
</code></pre>
<p>No array is passed, just a pointer. The original array is modified.</p>
<p>As for your second revision, given:</p>
<pre><code>void Test(int a)
{
}
v... | <p>The primary motivator for passing arrays by reference is to prevent stack overflows and needless copying of large objects. For example, imagine if I had a function like this:</p>
<pre><code>void foo(int x[500000000000]);
</code></pre>
<p>The stack would probably overflow the first time you called the function if ... | 41,329 |
<p>I remember from way back at university using a switch with 'binary search' or 'binary switch'. Something like that, My google foo is broken today. Anyway it goes down like this: You define an array of possible options (Strings usually), some magic happens, and those options in the array become the cases in the switc... | <p>I think what you are looking for is an <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html" rel="noreferrer">Enum</a>. </p>
<p>From the link above...</p>
<pre><code>public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
public class EnumTest {
Day day;... | <p>Normally, I wouldn't abuse a switch in such a way (even if I could). Try you might, you won't be able to get arrays to work in a switch statement because it only allows constant values in the case lines. Are you sure that you are not thinking of some pattern like below or an enumeration?</p>
<pre><code>final int RE... | 35,835 |
<p>Is it possible in a Compact Framework application to prevent the garbage collector from unconditionally stopping at least one of the threads, or to block GC collects at least in some portions of the code?</p>
<p>I think it has to deal with setting real time priorities, but I found a lot of advice against doing it.... | <p>The GC needs to freeze all threads in order to inspect all objects. How could it do its job, if some thread is running and is modifying/creating an object?</p>
<p>Better don't do it.</p>
<p>What you can do thogh, is to invoke GC.Collect() and GC.WaitForPendingFinalizers() before you enter in a state where you do n... | <p>Unmanaged code is not allowed to access unpinned managed objects, but it will run without blocking during garbage collection. If you have certain routines that must keep running during garbage-collection, and they don't require access to unpinned managed objects, you could write those routines in unmanaged code and... | 35,752 |
<p>I'm getting the following error when my win32 (c#) app is calling web services.</p>
<pre><code>The request failed with HTTP status 504: Gateway timeout server response timeout.
</code></pre>
<p>I understand 'I think' that this is because the upstream request does not get a response in a timely fashion.</p>
<p>But my... | <p>You can't. The problem is not that your app is impatient and timing out; the problem is that an intermediate proxy is impatient and timing out. "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI." (<a href="http://www.w3.org/Protocols/rf... | <p>I have had another issue giving me a 504. It's pretty far out but I'll write it up here for googlers and posterity...</p>
<p>I have a client calling an IIS hosted webservice hosted in another domain (Active Directory). There is not full trust between the client domain and the domain where the web services is hosted... | 32,706 |
<p>I hope someone can help me with this, I'm mostly a C# developer so my
C and C++ skills are bad. I have a native C dll that is a plugin of a
larger application. I cross compile this dll for windows on linux
using gcc.</p>
<p>In the native dll when I create a D3DSurface I want to call a function
in a Mixed Mode C++... | <p>Have you looked into <a href="http://en.wikipedia.org/wiki/Microsoft_XNA" rel="nofollow noreferrer">Microsoft XNA</a>? It supposedly has managed wrappers for DirectX.</p>
| <p>You can use <code>void *</code> in the mixed-mode DLL. There is an implicit cast from a pointer to anything (including a pointer to <code>IDirect3DSurface</code>) to <code>void *</code>. You can then cast that pointer to <code>IntPtr</code>.</p>
| 33,487 |
<p>So, I've spent enough time using ASP.NET webforms to know that I'd almost rather go back to doing classic ASP than use them. But I'm hesitant to move to ASP.NET MVC until it becomes more mature. Are there any open source alternatives?</p>
<p>The main thing I'm looking for is something that's easy to learn and to ... | <p>We have used <a href="http://www.castleproject.org/projects/monorail" rel="nofollow noreferrer">MonoRail</a> RC2 for our small business's online store for the past 18 months. It replaced a 7 year old disaster of classic ASP pages. MonoRail RC2 has worked well for us, serving an average of ~14,000 page requests per d... | <p>One alternative that seems interesting is <a href="http://www.castleproject.org/monorail/index.html" rel="nofollow noreferrer">MonoRail</a> although I haven't tested it out fully.</p>
| 38,585 |
<p>I have N items of 2D image data that will be rectangular and I want to pack them into a single power of 2 texture as efficiently as possible.</p>
<p>A simple non-efficient and naive implementation of an algorithm to pack these rects would be easy to whip up, but I'm sure people have come up with algorithms to do th... | <p>Your problem in 1D is called Bin Packing. Perhaps that's a good start for your search.</p>
<p>Note that the problem you want to solve is really hard (it is NP-hard). So you should not search for the optimal solution, but some clever heuristical algorithm.</p>
<p>I think bottom-up dynamic programming is possible fo... | <p>I had a similar problem but I was packing squares. Try this: <a href="http://www.mrashid.info/blog/stacking-squares-problem.php" rel="nofollow">http://www.mrashid.info/blog/stacking-squares-problem.php</a></p>
<p>The C++ code is not very elegant but at least you get the basic idea on how to approach this problem.</... | 33,052 |
<p>I'm having some trouble with the Google Maps API; I want to determine a LatLong for a certain place (for example, from the name of a city), then focus my map on it. The LatLong part is working, and so is centering the map on that point. However, I cannot figure out how to determine what a good zoomlevel might be whe... | <p>I just asked this question at Google IO. This feature exists, but is undocumented and doesn't have accessors for it yet. What you want to do is get the <a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding_Structured" rel="nofollow noreferrer">Structured Address</a>. Inspect the json str... | <p>Are you getting your location points from the Geocoder? If you are, you can grab the accuracy of the point and base your zoom on that (higher accuracy = higher zoom).</p>
| 40,278 |
<p>I want to create a simple bit of JS code that creates an image element in the background and doesn't display anything. The image element will call a tracking URL (such as Omniture) and needs to be simple and robust and work in IE 6 =< only. Here is the code I have:</p>
<pre><code>var oImg = document.createElem... | <pre><code>oImg.setAttribute('width', '1px');
</code></pre>
<p><code>px</code> is for CSS only. Use either:</p>
<pre><code>oImg.width = '1';
</code></pre>
<p>to set a width through HTML, or:</p>
<pre><code>oImg.style.width = '1px';
</code></pre>
<p>to set it through CSS.</p>
<p>Note that old versions of IE don't ... | <p>As others pointed out if you are allowed to use a framework like jQuery the best thing to do is use it, as it high likely will do it in the best possible way. If you are not allowed to use a framework then I guess manipulating the DOM is the best way to do it (and in my opinion, the right way to do it).</p>
| 28,058 |
<p>Is there a way to get the raw SQL string executed when calling PDOStatement::execute() on a prepared statement? For debugging purposes this would be extremely useful.</p>
| <p>I assume you mean that you want the final SQL query, with parameter values interpolated into it. I understand that this would be useful for debugging, but it is not the way prepared statements work. Parameters are not combined with a prepared statement on the client-side, so PDO should never have access to the que... | <p><a href="https://stackoverflow.com/a/8403150/128761">Mike's answer</a> is working good until you are using the "re-use" bind value.<br>
For example: </p>
<pre><code>SELECT * FROM `an_modules` AS `m` LEFT JOIN `an_module_sites` AS `ms` ON m.module_id = ms.module_id WHERE 1 AND `module_enable` = :module_enable AND `s... | 25,846 |
<p>I'm trying to write an audio analysis application, and I need to identify local maxima in a 2D array which represents a spectrogram. I've already got an open source library that can generate the spectrogram using Fast Fourier Transforms, but I was wondering if anybody knew of any good libraries to help me with actua... | <p>No, I don't believe so.</p>
<p>Certainly the C# compiler disallows it when converting a lambda expression:</p>
<pre><code>int x;
Expression<Func<int,int>> foo = (x=y); // Assign to x and return value
</code></pre>
<p>This yields the error:</p>
<pre><code>CS0832: An expression tree may not contain an ... | <p>You could probably work around it by nexting expression trees. Call a lambda function, where an argument is the value of the assignee.</p>
| 25,637 |
<p>I have a project I'm working on (for school) that I'm digging into the Boost libraries for the solutions. I need some way to distribute the required Boost source code with my application so that it can be compiled without the libraries being installed on the system doing the compiling. (School computers lack just ab... | <p>It depends on the library you're using. If you're using a header-only library (most of the boost libraries are, some notable exceptions are signals, serialisation and date/time) you can just copy those header files. Otherwise you'll need to copy the cpp files, too. My suggestion is to just include them into your pro... | <p>I've come across this before, embedding boost into my projects. Each individual boost library comes with various project files for building with different make systems (Jam, make, Visual Studio 6...) but they're never so great with the newer versions of VS.</p>
<p>I always prefer to create a new project file and e... | 17,579 |
<p>Suppose I have one html page with frames. The left frame is simply a list of links, which will be displayed in the right frame. Is it possible, using javascript, to generate the contents of the left frame when the page loads?</p>
| <p>Better to have a Public property/method and get the information. </p>
<p>What would you do if you would need 3..4..5 informations, having 5 parameters out? More clean to have accessors to get your information from the Dialog.</p>
| <p>I prefer this one because I don't like the approach of getting result from a property or a method after you have done with the class. After dialog form was shown and closed I think the object should not be used any more because logically you have done with the dialog then why should I use its property or method to g... | 35,581 |
<p>I am working on a web-application in which dynamically-created images are used to display information. This data is currently sent to the images using a GET query-string but with more complex images and data I am worried about running into problems with the url character limit.</p>
<p>I could simply pass the record... | <p>In the end, I think quering the database will probably be faster. To get a small string (say up to 2000 characters) from the database is very quick and probably faster than having the user post it all the time, especially if there is more than 1 on a page.</p>
<p>The best option would be create the image once and c... | <p>One option could be to store this data in a session variable. You should do some tests to see which way your server(s) handle it better</p>
| 20,753 |
<p>I have some code where I'm returning an array of objects.</p>
<p>Here's a simplified example:</p>
<pre><code>string[] GetTheStuff() {
List<string> s = null;
if( somePredicate() ) {
s = new List<string>(); // imagine we load some data or something
}
return (s == null) ?
ne... | <p>Even if it's being called "hundreds and hundreds" of times, I'd say it's a premature optimization. If the result is clearer as an empty array, use that.</p>
<p>Now for the actual answer: yes, an empty array takes some memory. It has the normal object overhead (8 bytes on x86, I believe) and 4 bytes for the count. I... | <p>If I understand correctly, a small amount of memory will be allocated for the string arrays. You code essentially requires a generic list to be created anyway, so why not just return that?</p>
<p>[EDIT]Removed the version of the code that returned a null value. The other answers advising against null return values ... | 18,315 |
<p>Can anyone recommend some useful performance analysis tools for PHP scripts? Anything that could help me find problematic or unusually slow blocks of code, details about execution time, etc. would be really helpful. I know there are tools out there, but I'm wondering what people recommend as being the most useful an... | <p>Try <a href="http://code.google.com/p/webgrind/" rel="noreferrer" title="webgrind">webgrind</a>. It gives you the profiling of CacheGrinder in an easy to read, browser based format. I'm on a Mac and it has made profiling a breeze.</p>
| <p>See SD's <a href="http://www.semanticdesigns.com/Products/Profilers/PHPProfiler.html" rel="nofollow noreferrer">PHP Profiler</a>. Measures frequence of execution across your entire application and provides a hotspot graphical display of highly-executed code. No changes necessary to PHP server to install this.</p>... | 17,534 |
<p>Say I have a controller with an Index Method and a Update Method. After the Update is done I want to redirect to Index(). Should I use return RedirectToAction("Index") or can I just call return Index()? Is there a difference?</p>
<pre><code>public ActionResult Index()
{
return View("Index", viewdata);
}
public A... | <p>Use the redirect otherwise the URL on the client will remain the same as the posted URL instead of the URL that corresponds to the Index action.</p>
| <p>Other things to consider:</p>
<ul>
<li><p>Redirect action after a POST will act more nicely when the user clicks Refresh button, since they won't be prompted to resend data to server.</p></li>
<li><p>Form data will be lost with the redirect action unless you maintain them explicitly through, say, TempData. Without... | 42,379 |
<p>Is there any way to determine a removable drive speed in Windows without actually reading in a file. And if I do have to read in a file, how much needs to be read to get a semi accurate speed (e.g. determine whether a device is USB2 or USB1)?</p>
<p><strong>EDIT</strong>: Just to clarify, USB2 and USB1 were an exa... | <p><a href="http://www.computerperformance.co.uk/vbscript/wmi_disks_physical.htm" rel="nofollow noreferrer">WMI - Physical Disks Properties</a> is an article I found which would at least help you figure out what you have connected. I foresee things heading toward tables equating particular manufacturers and models to s... | <p>Several megabytes, I'd say. Transfer speeds can start out slow, and then speed up as the transfer progresses. There are also variations because of file sizes (a single 1GB file will transfer much faster than 1GB of smaller files).</p>
<p>Best way to do that would be to copy a file to/from the device, and time how l... | 22,178 |
<p>I'm working on a problem that requires caching paginated "search" results: <a href="https://stackoverflow.com/questions/347277/paginating-very-large-datasets">Paginating very large datasets</a></p>
<p>The search works as follows: given an item_id, I find the matching item_ids and their rank.</p>
<p>I'm willing t... | <p>MySQL can handle this many rows, and there are several techniques to scale when you are starting to hit the wall. <a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning.html" rel="nofollow noreferrer">Partioning</a> and <a href="http://dev.mysql.com/doc/refman/5.1/en/replication.html" rel="nofollow noreferrer"... | <p>MySQL can handle it. The real question is: can it handle it in a reasonable amount of time? That depends on your query. Like Eran Galperin said in his answer, look into partitioning and replication for optimization.</p>
| 45,263 |
<p>We are trying to lighten our page load as much as possible. Since ViewState can sometimes swell up to 100k of the page, I'd love to completely eliminate it.</p>
<p>I'd love to hear some techniques other people have used to move ViewState to a custom provider.</p>
<p>That said, a few caveats:</p>
<ul>
<li>We serve... | <p>How do you handle Session State? There is a built-in "store the viewstate in the session state" provider. If you are storing the session state in some fast, out of proc system, that might be the best option for the viewstate.</p>
<p>edit: to do this add the following code to the your Page classes / global page ba... | <p>Due to the typical organizational bloat, requesting new hardware takes eons, and requesting hardware that would involve a complete rewire of our current setup would probably get some severe resistance from the engineering department.</p>
<p>I really need to come up with a software solution, because that's the only ... | 7,042 |
<p>Is it possible to pump monochrome (graphical data with 1 bit image depth) texture into OpenGL?</p>
<p>I'm currently using this:</p>
<pre><code>glTexImage2D( GL_TEXTURE_2D, 0, 1, game->width, game->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, game->culture[game->phase] );
</code></pre>
<p>I'm pumping it ... | <p>The smallest uncompressed texture-format for luminance images uses 8 bits per pixel.</p>
<p>However, 1 bit per pixel images can be compressed without loss to the S3TC or DXT format. This will still not be 1 bit per pixel but somewhere between 2 and 3 bits. </p>
<p>If you really need 1 bit per pixel you can do so w... | <p>The smallest uncompressed texture-format for luminance images uses 8 bits per pixel.</p>
<p>However, 1 bit per pixel images can be compressed without loss to the S3TC or DXT format. This will still not be 1 bit per pixel but somewhere between 2 and 3 bits. </p>
<p>If you really need 1 bit per pixel you can do so w... | 42,464 |
<p><strong>What is the best way to make one of the branches of a subversion repository the new trunk?</strong> </p>
<p>There has been a major rewrite for the entire system: things have been moved around, rewritten, replaces, removed, renamed etc. The rewritten code has been tested and is ready to replace the old trun... | <p>Use <a href="http://svnbook.red-bean.com/en/1.1/re18.html" rel="noreferrer">svn move</a> to move the contents of the old trunk somewhere else and rename the branch to trunk afterward.</p>
<p>Note that copy and move in svn work like file operations. You can use them to move/copy stuff around in your repository and t... | <p>It is a really weird/unusual configuration in SVN, even I think it is far from being a "good practice" at all, anyway, I guess you could do something like:</p>
<ul>
<li>Checkout all the sourcetree (svn co therootsourcetree)</li>
<li>Remove the trunk (svn rm trunk)</li>
<li>Copy the branch to the trunk (svn cp branc... | 42,935 |
<p>When creating a new ASP.NET project in Visual Studio should I chose create: website or project? </p>
<p>I understand that web application project was the way to do it back in the day with VS 2003 but is it still applicable today? What are some of the caveats using one over the other?</p>
| <p>There's a <a href="http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5" rel="noreferrer">pretty good comparison chart on MSDN</a>.</p>
<p>Website projects are simple, in that all files added to the project folders are automatically compiled and included, which was supposedly added to make it mo... | <p>I strongly disagree with some of what the <a href="http://igurr.com/blogs/programming/archive/2009/03/25/websites-and-web-projects.aspx" rel="nofollow noreferrer">Websites and Web Projects</a> article says.</p>
<p>First, it wasn't any "small" group of developers who rebelled - I'd suggest it was most of us, who had... | 3,195 |
<p>This morning I ran into an issue with returning back a text string as result from a Web Service call. the Error I was getting is below</p>
<pre><code>************** Exception Text **************
System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'GetFilingTreeXML'... | <p>Try this blog post <a href="https://web.archive.org/web/20210128000850/http://geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx" rel="nofollow noreferrer">here</a>. You can modify the MaxStringContentLength property in the Binding configuration.</... | <p><a href="http://joewirtley.blogspot.com/2007/08/maximum-string-content-length-and.html" rel="nofollow noreferrer">Jow Wirtley's blog post</a> pointed me in the right direction.</p>
<p>All I had to do was update the bindings in the app.config of the client app and it all works now.</p>
| 9,117 |
<p>What's your favorite open source database design/modeling tool?</p>
<p>I'm looking for one that supports several databases, especially Firebird SQL but I can't find one on Google.</p>
| <p>I've used <a href="http://fabforce.net/dbdesigner4/" rel="noreferrer">DBDesigner</a> before. It is an open source tool. You might check that out. Not sure if it fits your needs.</p>
<p>Best of luck!</p>
| <p>I like <a href="http://www.azzurri.jp/en/clay/index.html" rel="nofollow noreferrer">Clay</a> Eclipse plugin. I've only used it with MySQL, but it claims Firebird support.</p>
| 15,149 |
<p>If I have a key set of 1000, what is a suitable size for my Hash table, and how is that determined?</p>
| <p>It depends on the load factor (the "percent full" point where the table will increase its size and re-distribute its elements). If you know you have exactly 1000 entries, and that number will never change, you can just set the load factor to 1.0 and the initial size to 1000 for maximum efficiency. If you weren't s... | <p>Twice is good.</p>
<p>You don't have a big keyset.
Don't bother about difficult discussions about your HashTable implementation, and go for 2000.</p>
| 36,337 |
<p>Right, so I'm having a go at Iron Python Studio as I'm quite familiar with VS2005 and want to try Python with an integrated GUI designer. But as soon as I add a PictureBox I'm in trouble. When running the project I get complaints about BeginInit and soon enough the form designer stops working.<br>
Is this because I'... | <p>I'm having the same problem. What you can do is manually remove the BeginInit() and EndInit() calls, it should work fine then.</p>
| <p>Have you checked out <a href="http://blogs.msdn.com/ironpython/" rel="nofollow noreferrer">IronPython Blog</a> on MSDN? You could probably drill down from there and find a definitive answer. If you do, be sure you update your question here!</p>
| 14,561 |
<p>I'm a newbie in C# bu I'm experienced Delphi developer.
In Delphi I can use same code for MenuItem and ToolButton using TAction.OnExecute event and I can disable/enable MenuItem and ToolButton together using TAction.OnUpdate event.
Is there a similar way to do this in C# without using external libraries? Or more - H... | <p>Try the a modification of the command pattern:</p>
<pre><code>public abstract class ToolStripItemCommand
{
private bool enabled = true;
private bool visible = true;
private readonly List<ToolStripItem> controls;
protected ToolStripItemCommand()
{
controls = new List<ToolStripIt... | <p>You can enable or disable a control and all its children by setting its <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.enabled.aspx" rel="nofollow noreferrer">Enabled property</a>.</p>
| 15,319 |
<p>I often find that I do a less than complete work on a feature, especially in the Design phase. I detect several reasons:</p>
<ol>
<li>I'm over-optimistic</li>
<li>I feel the need to provide quick solutions, so sometimes I fool myself into thinking the design is fool-proof when in fact it's still full of holes, just... | <p>I use a couple of techniques. The first is a simple paper to-do list. In the morning I write down my tasks for the day. I try to work on a task until I can cross it off. I cross it off only when I'm done to my own satisfaction. My to-do list helps me stay focused. When an interruption comes in, I can consciously cho... | <p>I have learned, through years of mistakes (though still making them), that almost anything I want to use repeatedly, or distribute, needs to be designed properly. So getting burned enough times will end your optimism.</p>
<p>When getting pressure from management, I tell them I will have to put in the thought anywa... | 43,864 |
<p>I know that I can use $('#myId').load('aPage.html'); to load a page into an element, how do I do use that to alter an image?</p>
| <pre><code>$("selectorforyourimage").attr("src","newimagelocation");
</code></pre>
| <p>Note, that the image will load no sooner, than you load it, so you may want to <strong>preload</strong> it.</p>
<p>For this, you can use <a href="http://plugins.jquery.com/project/Preload" rel="nofollow noreferrer">this plugin</a> or <a href="http://www.mattfarina.com/2007/02/01/preloading_images_with_jquery" rel="... | 45,984 |
<p>I like ReSharper, but it is a total memory hog. It can quickly swell up and consume a half-gig of RAM without too much effort and bog down the IDE. Does anybody know of any way to configure it to be not as slow?</p>
| <p>Turn off the on-the-fly compilation (which, unfortunately, is one of its best features)</p>
| <p>In previous versions I had the same problem, when 4.0 came out these problems have seemed to have gone away. Now with 4.1 i do not feel the huge slow down i used to have. My IDE does not freeze up anymore.</p>
<p>have you tried upgrading ?</p>
| 10,957 |
<p>I'm starting to re-skill myself in Desktop applications. I've been doing Web applications for a few years now.</p>
<p>I've got come decent C# books that I am going through, but they are more like language references. What I would like is a list/site/book with practical exercises, preferably graded in terms of diffi... | <p>On the topic of learning C# language itself and the runtime, I would recommend the <a href="http://msdn.microsoft.com/en-us/vcsharp/aa336766.aspx" rel="nofollow noreferrer">Learn C#</a> section on the MSDN. There are links to lot of articles and trining materials abtou C#. You can combine this with Jesse Liberty's <... | <p>There are a lot of good C# tutorials on <a href="http://www.functionx.com/csharp/" rel="nofollow noreferrer">C# Practical Learning</a>, ranging across several topics.</p>
<p>I also recommend <a href="http://oreilly.com/catalog/9780596514822/" rel="nofollow noreferrer">Head First C#</a> if you want to try a non-refe... | 34,924 |
<p>After watching every possible YouTube video on the subject and reading any source available, and although I'm a PhD and quite computer savvy, I still can't make my Anet A6 (no probe) behave in terms of Z offset. I upgraded to silicone bed buffers instead of the stock springs; now my bed is ~5 mm raised, and I don't ... | <p>So the new silicone buffers raised the bed by 5 mm? When this happens, you should raise the endstop also with 5 mm. Else the printer will go down to the Z endstop that is effectively 5 mm below the level of the bed. I guess the buffers cannot be compressed by 5 mm, so you need to move the endstop up to the level you... | <p>Setting any offset will move the whole print ("effectively shifts the coordinate space") - so you can set up for printing above or below bed, or shifting several cm to the right, for example - and then your print may not actually fit the printing space. For example: my frame is blocking X moves at the top,... | 1,832 |
<p>As far as I know there's no way to hint the c# compiler to inline a particular function and I guess it's like that by design.</p>
<p>I also think that not letting the programmer to specify what to inline and what not is generally a good idea, as it would imply that you think you're smarter than the JIT compiler (my... | <p>Short answer: no</p>
<p>Long answer: <a href="http://blogs.msdn.com/ericgu/archive/2004/01/29/64644.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/ericgu/archive/2004/01/29/64644.aspx</a></p>
<p>Criteria for inlining: <a href="http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx" rel="nofollow ... | <p><a href="http://web.ics.purdue.edu/~ssanty/images/1.gif" rel="nofollow noreferrer">alt text http://web.ics.purdue.edu/~ssanty/images/1.gif</a></p>
| 30,922 |
<p>What kind of scenarios can XSL processing instructions be used or applied? When is it good or bad to use them?</p>
<p>Clean slate here, I don't have a good handle on this particular element.</p>
<p>Example from w3schools:</p>
<p><xsl:processing-instruction name="process-name">
<!-- Content:template --&... | <p>It's very simple: you'd use <code><xsl:processing-instruction></code> if you needed to output a processing instruction in your output XML. If you have no need for PI's in your output, then you don't need the processing-instruction element. </p>
<p>As to why you might need a PI in your output, that depends en... | <p>Processing instructions let you insert things like <?php ?> or <?xml ?> into the output code. I myself have never actually found a use for them, so if you don't understand them, you probably don't need 'em. <a href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions" rel="nofollow noreferrer">C... | 38,918 |
<p>I want to get the size of an http:/.../file before I download it. The file can be a webpage, image, or a media file. Can this be done with HTTP headers? How do I download just the file HTTP header?</p>
| <p>Yes, assuming the HTTP server you're talking to supports/allows this:</p>
<pre><code>public long GetFileSize(string url)
{
long result = -1;
System.Net.WebRequest req = System.Net.WebRequest.Create(url);
req.Method = "HEAD";
using (System.Net.WebResponse resp = req.GetResponse())
{
if (... | <pre><code> HttpClient client = new HttpClient(
new HttpClientHandler() {
Proxy = null, UseProxy = false
} // removes the delay getting a response from the server, if you not use Proxy
);
public async Task<long?> GetContentSizeAsync(string url) {
using (HttpResponse... | 14,949 |
<p>I'd sooner not just permanently have a bunch of files checked out to me, but I'd like a way to prevent some really critical files being changed without my being aware of it.</p>
<p>PS Yes I know SourceSafe is terrible. </p>
| <p>You can only set access rights on a project by project basis. </p>
<p>This is done by running the the Source Safe Administration application and then go to Tools > Rights By Project. Select the required project and then give a users the required priveledges.<br>
In order to protect a subset of files place them in ... | <p>It's been a while since I've had to use Source Safe but I don't think it has this kind of functionality built it.</p>
<p>Can you set up a separate repository/instance that excludes the users who shouldn't be allowed to modify them?</p>
<p>Or failing that, just keep the files always checked out on your machine :P</... | 16,340 |
<p>Simply setting the SVN_EDITOR variable to "mate" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't returned to the svn command for use.</p>
| <p>You need to include a command line option in your SVN_EDITOR (or EDITOR) variable</p>
<p>export SVN_EDITOR='mate -w'</p>
<p>This makes the svn command wait for the editor to close/release the file before continuing, which is where the process is getting mucked up now.</p>
<p>See <a href="http://manual.macromates.... | <p>I found this thread googling for textmate as svn editor. While trying I found out that you can also set the editor-cmd in <code>~/.subversion/config</code> file and more important you should set the value to <code>mate -wl1</code> because in this way the caret will be placed on the first line of the file, the place ... | 11,830 |
<p>If I have a type defined as a <strong>set of</strong> an enumerated type, it's easy to create an empty set with [], but how do I create a <em>full</em> set?</p>
<p>EDIT: Yeah, the obvious solution is to use a for loop. That's also a really bad solution if there's another way. Does anyone know of a way that'll wor... | <p>Low() and High() are "compiler magic" functions that can be evaluated at compile time.
This allows their use in constant declarations like the following:</p>
<pre>
var
MySet : TBorderIcons;
MySet2 : TBorderIcons;
const
AllIcons : TBorderIcons = [Low(TBorderIcon)..High(TBorderIcon)];
begin
MySet := [Low(TBor... | <p>Per Barry's suggestion:</p>
<pre><code>FillChar(VarSet, SizeOf(VarSet), $FF);
</code></pre>
| 31,840 |
<p>How can I find out the date a MS SQL Server 2000 object was last modified?</p>
<p>I need to get a list of all the views, procs, functions etc that were modified since Aug 15th. In sysObjects I can see the date objects were created but I need to know when they were last altered.</p>
<p>NB: this is an SQL 2000 data... | <p>Note that SQL Server actually does <strong>not</strong> record the last modification date. It does not exist in any system tables. </p>
<p>The Schema Changes History report is actually constructed from the <a href="http://msdn.microsoft.com/en-us/library/ms191006.aspx" rel="noreferrer">Default Trace</a>. Since many... | <p>This is not always correct because modify_date is Date the object was last modified by using an ALTER statement. <strong>If the object is a table or a view, modify_date also changes when a clustered index on the table or view is created or altered.</strong></p>
| 10,391 |
<p>Just started getting a bunch of errors on our C# .Net app that seemed to be happening for no reason. Things like System.IndexOutOfRangeException on a SqlDataReader object for an index that should be returned and has been returning for a while now.</p>
<p>Anyways, I looked at the Task Manager and saw that sqlservr.e... | <p>I'd certainly be <em>very</em> surprised if it's the database itself, SQLServer is an extremely solid product - far better than anything in Office or Windows itself, and can generally be relied on absolutely and completely.</p>
<p>1.5Gb is <em>nothing</em> for a rdbms - and and all of them will just keep filling up... | <p>SQL needs the ram that it is taking. If it was using 1.5 gigs, its using that for data cache, procedure cache, etc. Its generally better left alone - if you set a cap too low, you'll end up hurting performance. If its using 1.5 gigs on a 4 gig web box, i wouldn't call that abnormal at all.</p>
<p>Your errors cou... | 48,761 |
<p>Say I have the following in my <code>models.py</code>:</p>
<pre><code>class Company(models.Model):
name = ...
class Rate(models.Model):
company = models.ForeignKey(Company)
name = ...
class Client(models.Model):
name = ...
company = models.ForeignKey(Company)
base_rate = models.ForeignKey(Rate)
... | <p>ForeignKey is represented by django.forms.ModelChoiceField, which is a ChoiceField whose choices are a model QuerySet. See the reference for <a href="http://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield" rel="noreferrer">ModelChoiceField</a>.</p>
<p>So, provide a QuerySet to the field's <code>qu... | <p>According to the Django documentation, you can apply filters to your default queryset using the <code>__init__</code> method of the model form.</p>
<p><a href="https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey" rel="nofollow noreferrer">https://docs.dja... | 37,249 |
<p>Is there a benefit to using one over the other? In Python 2, they both seem to return the same results:</p>
<pre><code>>>> 6/3
2
>>> 6//3
2
</code></pre>
| <p>In Python 3.x, <code>5 / 2</code> will return <code>2.5</code> and <code>5 // 2</code> will return <code>2</code>. The former is floating point division, and the latter is <em><strong>floor division</strong></em>, sometimes also called <em><strong>integer division</strong></em>.</p>
<p>In Python 2.2 or later in the... | <p><code>5.0//2</code> results in <code>2.0</code>, and not <code>2</code>, because the <strong>return type</strong> of the return value from <code>//</code> operator follows Python coercion (type casting) rules.</p>
<p>Python promotes conversion of lower data type (integer) to higher data type (float) to avoid data lo... | 22,228 |
<p>I'm trying to use opengl in C#. I have following code which fails with error 2000 ERROR_INVALID_PIXEL_FORMAT<br>
First definitions:</p>
<pre><code>[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern IntPtr GetDC(IntPtr hWnd);
[StructLayout(LayoutKind.Se... | <p>Found solution.<br>
Problem is very strange ugly and really hard to find. Somwhere on the internet I found that when you are linking opengl32.lib while compiling c++ application it must be placed before gdi32.lib. The reason for this is that (supposedly) opengl32.dll is overwriting ChoosePixelFormat and SetPixelForm... | <p>I cannot test this right now, but my first suspicion would be the structure packing. Have you tried setting the packing to 1 in the StructLayout attribute? For example:</p>
<pre><code>[StructLayout(LayoutKind.Sequential, Pack=1)]
</code></pre>
<p>Cheers,
Brian</p>
| 24,256 |
<p>I wish to execute a javascript function after asp.net postback with out using ajax.</p>
<p>I've tried the following in my even method with no luck:</p>
<pre><code>Page.ClientScript.RegisterStartupScript(GetType(), "ShowPopup", "showCheckOutPopIn('Livraison',556);");
</code></pre>
| <p>You should rather use the ScriptManager class, since the Page.ClientScript property is deprecated...</p>
<blockquote>
<p>The ClientScriptManager class is new in ASP.NET 2.0 and replaces Page class methods for managing scripts that are now deprecated.<br />
<a href="http://msdn.microsoft.com/en-us/library/syst... | <p>I don't remember offhand what is the exact syntax/usage for the Page.ClientScript stuff ... that looks like it should work offhand. But if push comes to shove, just have a simple user control that you can enable/disable dynamically that will write out a javascript method in script blocks after the postback. When t... | 41,530 |
<p>This is a follow-up to <a href="https://stackoverflow.com/questions/269417/which-language-should-i-use">two</a> <a href="https://stackoverflow.com/questions/271488/linking-languages">questions</a> I asked a week or so back. The upshot of those was that I was building a prototype of an AI-based application for the we... | <p>Python is a good choice. </p>
<p>I would avoid the CGI model though - you'll pay a large penalty for the interpreter launch on each request. Most Python web frameworks support <a href="http://www.wsgi.org/wsgi/" rel="nofollow noreferrer">the WSGI standard</a> and can be hooked up to servers in a myriad of ways, b... | <p>It is easier to write web-apps in python than it's in php. Particularly because python is not a broken language.</p>
<p>Pick up some web framework that supports mod_wsgi or roll out your own. WSGI apps are really easy to deploy after you get a hold from doing it.</p>
<p>If you want templates then genshi is about t... | 37,022 |
<p>I use this tool called <a href="http://www.lazycplusplus.com/" rel="nofollow noreferrer">Lazy C++</a> which breaks a single C++ .lzz file into a .h and .cpp file. I want <a href="http://makepp.sourceforge.net/" rel="nofollow noreferrer">Makepp</a> to expect both of these files to exist after my rule for building .lz... | <p>I've never used Makepp personally, but since it's a drop-in replacement for GNU Make, you should be able to do something like:</p>
<pre><code>build: foo.h foo.cpp
g++ $(CFLAGS) foo.cpp -o $(LFLAGS) foo
foo.h foo.cpp: foo.lzz
lzz foo.lzz
</code></pre>
<p>Also not sure about the lzz invocation there, but that... | <p>Lzz is amazing! This is just what I was looking for <a href="http://groups.google.com/group/comp.lang.c++/browse_thread/thread/c50de73b70a6a957/f3f47fcdcfb6bc09" rel="nofollow noreferrer">http://groups.google.com/group/comp.lang.c++/browse_thread/thread/c50de73b70a6a957/f3f47fcdcfb6bc09</a></p>
<p>Actually all you... | 5,608 |
<p>I have a paragraph of text in a javascript variable called 'input_content' and that text contains multiple anchor tags/links. I would like to match all of the anchor tags and extract anchor text and URL, and put it into an array like (or similar to) this:</p>
<pre>Array
(
[0] => Array
(
[0] ... | <pre><code>var matches = [];
input_content.replace(/[^<]*(<a href="([^"]+)">([^<]+)<\/a>)/g, function () {
matches.push(Array.prototype.slice.call(arguments, 1, 4))
});
</code></pre>
<p>This assumes that your anchors will always be in the form <code><a href="...">...</a></code> i.e. ... | <p>I think <a href="http://docs.jquery.com/" rel="nofollow noreferrer">JQuery</a> would be your best bet. This isn't the best script and I'm sure others can give something better. But this creates an array of exactly what you're looking for.</p>
<pre><code><script type="text/javascript">
// From http://brand... | 48,209 |
<p>I have often heard this term being used, but I have never really understood it.</p>
<p>What does it mean, and can anyone give some examples/point me to some links?</p>
<p>EDIT: Thanks to everyone for the replies. Can you also tell me how the canonical representation is useful in equals() performance, as stated in ... | <p>Wikipedia points to the term <a href="http://en.wikipedia.org/wiki/Canonicalization" rel="noreferrer">Canonicalization</a>.</p>
<blockquote>
<p>A process for converting data that has more than one possible representation into a "standard" canonical representation. This can be done to compare different representat... | <p>canonical representation means view the character in different style
for example if I write a letter A means another person may write the letter A in different style:)</p>
<p>This is according to OPTICAL CHARACTER RECOGNITION FIELD</p>
| 35,408 |
<p>I've got a code like this : </p>
<pre><code>Dim Document As New mshtml.HTMLDocument
Dim iDoc As mshtml.IHTMLDocument2 = CType(Document, mshtml.IHTMLDocument2)
iDoc.write(html)
iDoc.close()
</code></pre>
<p>However when I load an HTML like this it executes all Javascripts in it as well as doing request to some reso... | <pre><code>Dim Document As New mshtml.HTMLDocument
Dim iDoc As mshtml.IHTMLDocument2 = CType(Document, mshtml.IHTMLDocument2)
'add this code
iDoc.designMode="On"
iDoc.write(html)iDoc.close()
</code></pre>
| <p>It sounds like you're screenscraping some resource, then trying to programmatically do something w/ the resulting HTML?</p>
<p>If you know it is valid XHTML ahead of time, then load the XHTML string (which is really XML) into an <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx" rel="nofo... | 16,539 |
<p>When reviewing our codebase, I found an inheritance structure that resembles the following pattern:</p>
<pre><code>interface IBase
{
void Method1();
void Method2();
}
interface IInterface2 : IBase
{
void Method3();
}
class Class1 : IInterface2
{
...
}
class Class2 : IInterface2
{
...
}
class... | <p>Well, first of all, I'm generally against implementing an interface by throwing NotImplementedException exceptions. It is basically like saying "Well, this class can also function as a calculator, err, almost".</p>
<p>But in some cases it really is the only way to do something "the right way", so I'm not 100% again... | <p>Inheritance in interfaces is used several places in the .Net framework. So while not everything in there there is perfect I suppose this is seen as ok. Look at the IEnumerable interface for example. </p>
<p>As to throwing NotImplementedExceptions I would say it depends on how you use them in your code. You can for ... | 39,684 |
<p>does anyone know about a open source expert system? actually, I'm rather interested in calling its inferential engine from C#.</p>
| <p>Take a look at <a href="http://clipsrules.sourceforge.net/" rel="nofollow noreferrer">CLIPS</a> -- it is coded in C.</p>
<p>There's more info on CLIPS at <a href="http://en.wikipedia.org/wiki/CLIPS" rel="nofollow noreferrer">Wikipedia</a>.</p>
| <p>You can try JESS, but it is Java-based. Amzilogic also provide a good platform.</p>
| 48,270 |
<p>Is this possible? I am looking forward to a tutorial which explains the steps to achieve this.</p>
| <p><a href="http://testdriven.net/" rel="nofollow noreferrer">TestDriven.NET</a> has the ability to test (NUnit/MSTest/etc) with Team Coverage (which you already have since you have Team System : Dev).</p>
<p>Walkthrough: <a href="http://weblogs.asp.net/nunitaddin/archive/2006/11/08/Driving-MSTest-and-Team-Coverage-us... | <p>TestDriven.NET will also work very well with NCover. You can get some very nice html reports out of NCover, and you can integrate it with Nant.</p>
| 27,814 |
<p>I have yet another managed C++ KeyValuePair question where I know what to do in C#, but am having a hard time translating to managed C++. Here is the code that does what I want to do in C#:</p>
<pre><code>KeyValuePair<String, String> KVP = new KeyValuePair<string, string>("this", "that");
</code></pre>
... | <p>This should do it:</p>
<p><code>KeyValuePair< String ^, String ^> k(gcnew String("Foo"), gcnew String("Bar"));</code></p>
<p>KeyValuePair is an immutable type, so you have to pass everything to the constructor, which looks the same as in C#, except you write it like this if the object is on the stack.</p>
| <p>try</p>
<pre><code>System::Collections::Generic::KeyValuePair< System::String^, System::String^>^ k = gcnew System::Collections::Generic::KeyValuePair< System::String^, System::String^>(gcnew System::String("foo") ,gcnew System::String("bar")) ;
</code></pre>
| 44,775 |
<p>I used to be able to do the following in Preview 3</p>
<pre><code><%=Html.BuildUrlFromExpression<AController>(c => c.AnAction(par1, par2)%>
</code></pre>
<p>How am I supposed to create urls in a strongly typed way with the MVC Beta?
The only thing so far I have found is </p>
<pre><code><%= Html.... | <p>You need the ASP.NET MVC Beta Futures, which is a separate download</p>
<p><a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=18459" rel="nofollow noreferrer">ASP.NET MVC Beta Futures</a></p>
<p>then your original code will work as before.</p>
<p>See this post for getting it working:
<... | <p>The <a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=18459" rel="nofollow noreferrer" title="ASP.NET MVC Beta Futures"><code>Microsoft.Web.Mvc</code></a> assembly provides extension methods to the <code>HtmlHelper</code> which allow something like</p>
<pre><code><%= Html.ActionLink&... | 26,854 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.