instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Since I'm sure many people have different standard, I've made this post a community wiki.</p>
<p>My question is, what's a good naming scheme for table aliases? I've been using the first letter of every word from the table name, but it's been getting quite unreadable. Here's a quick example.</p>
<pre><code>FROM inc... | <p>The whole point of an alias is to shorten the name so you don't need verbosity. </p>
<p>It only needs to be unique within a given query, so there's no need for a scheme for naming them.</p>
<p>Edit: Also, the aliases you'd use depend highly on the table naming scheme. If all your tables have a 5-part name where th... | <p>Although I'm not an Oracle guy (actually, this question should apply to almost any RDBMS), my <a href="https://stackoverflow.com/questions/218123/what-was-the-strangest-coding-standard-rule-that-you-were-forced-to-follow#218414">answer to "What was the strangest coding standard rule that you were forced to follow"</... | 37,854 |
<p>I am using sybase database to query the daily transaction report. I had subquery within my script. </p>
<p>Here as it goes:</p>
<pre><code>SELECT orders.accountid ,items.x,etc
(SELECT charges.mistotal FROM charges where items.id = charges.id)
FROM items,orders
WHERE date = '2008-10-02'
</code></pre>
<p>Here I am ... | <pre><code>SELECT TOP 1 *
FROM dbo.YourTable
ORDER BY Col DESC
</code></pre>
<p>In your case, I guess that would be</p>
<pre><code>SELECT TOP 1 charges.mistotal
FROM charges where items.id = charges.id
ORDER BY charges.mistotal DESC
</code></pre>
| <p>SELECT TOP 1 charges.mistotal FROM charges where items.id = charges.id
ORDER BY charges.id DESC</p>
<p>The order by clause will make sure it comes back in the order of the id, and the DESC means descending so it will give you the largest (newest) value first. TOP 1 of course makes sure you just get that one.</p>
| 19,386 |
<p>Is there a way to create C# objects and call methods from unmanaged C++, but without using COM Iterop? I am looking for something like JNI (but for .Net), where you can manually create the VM, create objects, etc.</p>
| <p>If you are using C++/CLI then you can interact directly with both the managed world and unmanaged code, so interop is trivial. </p>
<p>You can also host the CLR yourself, and whilst the hosting API is COM based, you can then create any managed object. The process isn't a difficult as it sounds as a few API calls ... | <p>You can decide file-by-file in your C++ project whether or not to use managed C++. Try changing the settings a file in your project so that it compiles as managed. Put the calls there to your C# object.</p>
<p>There's a cost to crossing the C++/C# border, so you should analyse where to do it. Like, you wouldn'... | 35,059 |
<p>What are the differences between delegates and an events? Don't both hold references to functions that can be executed?</p>
| <p>An <strong>Event</strong> declaration adds a layer of abstraction and protection on the <strong>delegate</strong> instance. This protection prevents clients of the delegate from resetting the delegate and its invocation list and only allows adding or removing targets from the invocation list.</p>
| <p>An event in .net is a designated combination of an Add method and a Remove method, both of which expect some particular type of delegate. Both C# and vb.net can auto-generate code for the add and remove methods which will define a delegate to hold the event subscriptions, and add/remove the passed in delegagte to/f... | 4,884 |
<p>I keep hearing that <code>div</code> tags should be used for layout purposes and not <code>table</code> tags. So does that also apply to form layout? I know a form layout is still a layout, but it seems like creating form layouts with <code>div</code>s requires more <code>html</code> and <code>css</code>. So with th... | <p>Yes, it does apply for form layouts. Keep in mind that there are also tags like FIELDSET and LABEL which exist specifically for adding structure to a form, so it's not really a question of just using DIV. You should be able to markup a form with pretty minimal HTML, and let CSS do the rest of the work. E.g.:</p>
... | <p>If your forms are laid out in a tabular format (for example, labels on the left and fields on the right), then yes, use table tags.</p>
| 13,477 |
<p>I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading or changing pages. </p>
<p>What I wou... | <ol>
<li><a href="http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx" rel="noreferrer">Script Combining in .net 3.5 SP1</a></li>
<li><a href="http://developer.yahoo.com/performance/rules.html" rel="noreferrer">Best Practices for fast websites</a></li>
<li... | <p>You could turn on compression based on your client supporting it. See this article: <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d52ff289-94d3-4085-bc4e-24eb4f312e0e.mspx?mfr=true" rel="nofollow noreferrer">link text</a></p>
| 3,260 |
<p>I'm in the unfortunate position of having to implement a drop-down cascading menu on a site I'm building. I'm looking for a Suckerfish-style solution that is primarily CSS-based and works on a simple set of nested ULs and LIs.</p>
<p><a href="http://htmldog.com/articles/suckerfish/dropdowns/" rel="noreferrer">Son ... | <p>I would <em>strongly</em> suggest that you use <a href="http://users.tpg.com.au/j_birch/plugins/superfish/" rel="noreferrer">superfish</a>, the jQuery adaptation of the suckerfish menu. It has loads of features (and delay is one of them), adds some fancy animation capabilities, and degrades to the normal suckerfish ... | <p>I can't see a way to add delay outside of JavaScript - but if you're going to use JavaScript you may as well use a JavaScript controlled menu. </p>
<p>If you follow a semantically-correct nav pattern and set it up so it display's normally (e.g. static) when JavaScript is not present you should be fine with whateve... | 3,667 |
<p>I have heard this concept used frequently, but I don't have a really good grasp of what it is.</p>
| <p>Converting an object in memory into a format that can be written to disk, or sent over the wire, etc. </p>
<p><a href="http://en.wikipedia.org/wiki/Marshalling_(computer_science)" rel="noreferrer">Wikipedia's description</a>.</p>
| <p>In a very generic sense in programming it simply means taking data in one format and transforming it into a format that is acceptable by some other sub-system.</p>
| 18,629 |
<p>I just happened to read <a href="http://www.west-wind.com/Weblog/posts/536756.aspx" rel="nofollow noreferrer">jQuery Intellisense Updates from Microsoft</a> and was wondering if there was any editor or eclipse plugin available which provides intellisense complete or code assist. Are there any?</p>
| <p>I believe eclipse, with the <strong><a href="http://www.aptana.com/" rel="nofollow noreferrer">Aptana</a></strong> plugin, has some <a href="http://www.aptana.com/blog/lorihc/jquery1.2.6_now_available" rel="nofollow noreferrer">JQuery support</a>.</p>
<p>As mentionned <a href="http://www.aptana.com/docs/index.php/Ge... | <p>You can use the standalone version of <a href="http://www.aptana.com/studio/download" rel="nofollow noreferrer">Aptana Studio</a>, it's free and much lighter than the complete Eclipse.</p>
| 38,598 |
<p>When using the paginator helper in cakephp views, it doesnt remember parts of the url that are custom for my useage.</p>
<p>For example: </p>
<pre><code>http://example.org/users/index/moderators/page:2/sort:name/dir:asc
</code></pre>
<p>here <strong>moderators</strong> is a parameter that helps me filter by that ... | <p>The secret is adding this line to your view:</p>
<p><strong>$paginator->options(array('url'=>$this->passedArgs));</strong></p>
<p>(I created this question and answer because it is a much asked question and I keep having to dig out the answer since i cant remember it.)</p>
| <p>With that param 'url' you can only put your preferred string before the string pagination in url..</p>
<p>if I use this tecnique:</p>
<pre><code>$urlpagin = '?my_get1=1&my_get2=2';
$paginator->options = array('url'=>$urlpagin);
</code></pre>
<p>I only obtain:</p>
<pre><code>url/controller/action/?my_ge... | 17,827 |
<p>I'm looking to update our project's jaxb version from 1 to 2. Has anyone tried doing this on their projects and are there any tips that anyone wanting to do this? I understand that each project is unique, I'm just looking for general tips.</p>
| <p>JAXB2 will generate enum classes for simpletype restrictions. Any Java code which relies on setting string values for uses of these types will require you to use the appropriate enum instead. I think this is great, since you get the typechecking when compiling rather than a validation warning at runtime.</p>
<p>J... | <p>Today I was reading a tutorial on JAXB 1, and tried compiling the example using JAXB 2.1 (as included in JavaSE 6).
The elements in the XSD used unnamed types, such as:</p>
<pre><code><xs:element name="logging">
<xs:complexType>
<xs:attribute name="debug" type="xs:boolean" use... | 33,961 |
<p>Ok, i have simple scenario:</p>
<p>have two pages:
login and welcome pages.
im using FormsAuthentication with my own table that has four columns: ID, UserName, Password, FullName</p>
<p>When pressed login im setting my username like:</p>
<pre><code>FormsAuthentication.SetAuthCookie(userName, rememberMe ?? false);... | <p>I would store the user's full name in the session cookie after your call to FormsAuth</p>
<pre><code>FormsAuth.SetAuthCookie(userName, rememberme);
// get the full name (ex "John Doe") from the datbase here during login
string fullName = "John Doe";
Response.Cookies["FullName"].Value = fullName;
Response.Cookies[... | <p>There are no custom fields for forms authentication. You'll just have to use session. That's what it's there for you know. ;) Just don't forget - forms authentication cookie and session are two independant things. They even each have their own timeouts. So the session won't be reset when a user logs out unless you d... | 42,511 |
<p>I constantly hear how bad reflection is to use. While I generally avoid reflection and rarely find situations where it is impossible to solve my problem without it, I was wondering... </p>
<p>For those who have used reflection in applications, have you measured performance hits and, is it really so bad?</p>
| <p>It is. But that depends on what you're trying to do. </p>
<p>I use reflection to dynamically load assemblies (plugins) and its performance "penalty" is not a problem, since the operation is something I do during startup of the application.</p>
<p>However, if you're reflecting inside a series of nested loops with r... | <p>I think you will find that the answer is, it depends. It's not a big deal if you want to put it in your task-list application. It is a big deal if you want to put it in Facebook's persistence library.</p>
| 4,509 |
<p>I'm having trouble with branching in Visual Studio TFS. This may be due to the method in which I am developing, but if this is the case, please let me know what the best practice is with branching and I will change our procedure.</p>
<p>About a month ago, I branched a project so that I could begin developing a new... | <p>Sounds like you are doing the correct thing to me, you just need to merge your changes into your dev branch.</p>
<p>To merge the changes, you need to be in Source Control Explorer. Right click on the "source" branch (in your case that is the main branch) and then select "Merge". You will then go into the merge wi... | <p>You just need to merge those changes to the new-version-branch. </p>
<p>A good starting point is <a href="http://www.codeplex.com/BranchingGuidance" rel="nofollow noreferrer">the branching and merging guidance</a>. Read it to find out how you can organize your branches. </p>
| 35,300 |
<p>I remember working on a project with a group of developers and they always wanted static
html text to be inside of an out tag (<code><c:out value="words" /></code>). I don't remember why
this was the case.</p>
<p>Is this really a best practice when building jsp pages? What are the
advantages/disadvantages... | <p>It is a terrible idea for static text. You then have no barrier as to what is static and what is dynamically generated.</p>
<p>Besides which, on Servlet Spec 2.3+ you can have dynamic text mixed with static text as:</p>
<p>This is static, not <code>${dynamic}</code> text.</p>
<p>The only reasons to use <code>c:o... | <p>If you're just printing out plain text it's better to do it in HTML. The advantage of the <code>c:out</code> tag is that you can evaluate expressions inside the tag.</p>
<pre><code><c:out value="Hello ${user.firstName} ${user.lastName}"/>
</code></pre>
| 27,021 |
<p>I have a WPF control, that has a list of "Investors", and in the right column of the list, a "Delete" button.</p>
<p>I could either waste some time making an image of an "x" in photoshop. Or, I could just use Wingdings font and set the content to "Õ" (which makes a cool looking delete button).</p>
<p>Is this appro... | <p>Honestly, if you're using WPF, it's probably just as easy to use a path to make an 'x' shape:</p>
<pre><code> <Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value=... | <p>Most of the problem was forgetting to add the byte size. </p>
<p>In C# (Winform) I use:</p>
<pre><code>static Font wingdings2 = new Font("Wingdings 2", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
</code></pre>
<p>So I can :</p>
<pre><code>myTextBoxt.Font = wingdings2;
</c... | 31,591 |
<pre><code>void f(cli::array<PointF> ^points){
PointF& a = points[0];
// and so on...
}
</code></pre>
<p>Compile error at line 2. </p>
<pre><code>.\ndPanel.cpp(52) : error C2440: 'initializing' : cannot convert from 'System::Drawing::PointF' to 'System::Drawing::PointF &'
An object from ... | <p>If you just want to declare a reference to the first PointF in the array then you need to use a <a href="http://msdn.microsoft.com/en-us/library/8903062a(VS.80).aspx" rel="nofollow noreferrer">tracking reference</a> (%):</p>
<pre><code>void f(cli::array<PointF>^ points)
{
PointF% a = points[0];
}
</co... | <p>And here is your code changed to use gcroot:</p>
<pre><code>void f(cli::array<gcroot<PointF ^>> points){
gcroot<PointF ^> a = points[0];
// and so on... }
</code></pre>
| 30,515 |
<p>I have a C++ app in VS2005 and import a VB DLL. IntelliSense shows me all the symbols in the DLL as expected but it also shows all (or nearly all) of them again with an underscore prefix (no @s in them though). Why is this? What are the differences between the underscored items and the normal items?</p>
| <p>Assuming you're talking VB6, the leading underscore version _Klass is the Vb-generated default interface for the class Klass. This site has a nice explanation:
<a href="http://www.15seconds.com/issue/040721.htm" rel="nofollow noreferrer">http://www.15seconds.com/issue/040721.htm</a></p>
| <p>In (some) c# coding standards the underscore prefix denotes a private variable, that might explain it... is it VB or VB.Net?</p>
| 28,842 |
<p>I know I've seen this in the past, but I can't seem to find it now.</p>
<p>Basically I want to create a page that I can host on a <a href="http://www.codeplex.com/dasblog" rel="nofollow noreferrer">dasBlog</a> instance that contains the layout from my theme, but the content of the page I control.</p>
<p>Ideally th... | <p>The easist way to do this is to "hijack" the FormatPage functionality.</p>
<p>First add the following to your web.config in the newtelligence.DasBlog.UrlMapper section:</p>
<pre><code><add matchExpression="(?&lt;basedir&gt;.*?)/Static\.aspx\?=(?&lt;value&gt;.+)" mapTo="{basedir}/FormatPage.aspx?... | <p>I did something similar setting up a handler to stream video files from the blog on my home server. I ended up ditching it because it killed my bandwidth whenever someone would view a video, but I did have it up and working for a while.</p>
<p>To get it to work I had to check dasBlog out from source control and op... | 7,250 |
<p>Often, I found OutOfMemoryException on IBM Websphere Application Server.
I think this exception occur because my application retrieve Huge data from database. So, I limit all query don't retreive data more than 1000 records and set JVM of WAS follow</p>
<pre><code>+ Verbose garbage collection
+ Maximum Heap size = ... | <p>The answer to this is dependent on the message associated with the OutOfMemoryException. You can also try -XX:MaxPermSize=... and set it to something larger like 256m.</p>
<p>Also, if you have a recursive function somewhere, that may be causing a stack overflow. </p>
<p>If you can, please post the message associat... | <p>Try to reproduce the problem locally so you can use a tool like JProfiler to debug it. Even if you can't force an OOM locally, chances are you'll see the memory increase in JProfiler. Then you take snapshots and look for classes that aren't being garbage collected. It's not an exact science, but it's much easier th... | 22,099 |
<p>Does anyone know whether there's a way to mock Entity Data Provider so Unit Tests don't hit the live data? I found this blog but it seems the project hasn't been released: </p>
<p><a href="http://www.chrisdoesdev.com/index.php/archives/62" rel="nofollow noreferrer">http://www.chrisdoesdev.com/index.php/archives/62<... | <p>Mattwar has a <a href="http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx" rel="nofollow noreferrer">great article on his blog</a> about mocking up LinqtoSql with reflection -- perhaps you can use that as a starting point?</p>
| <p>I would be interested to know this myself. I don't think that it's possible, because one of the things that got the Agile/Alt.Net community in a tizzy about the Entity Framework was this very problem of the lack of persistence ignorance.</p>
| 12,100 |
<p>Greetings!</p>
<p>I'm calling a Web service from Javascript when a user clicks on a link. I need to get the coordinates where the user clicked so that I can display a DIV in an appropriate location. My client-side script looks like the following:</p>
<pre><code>var g_event;
function DoWork(event, theId)
{
... | <p>Why not extract and save the coordinates in DoWork and simply use them in DoWorkSuccess rather than saving the event. Of course this won't work if there is more data you are extracting from the event.</p>
<pre><code>var client_x;
var client_y;
function DoWork(event, theId)
{
var g_event;
if (IsIE())
... | <p>Have you tried setting <code>window.event.cancelBubble = true</code> in your DoWork function?</p>
<p>If not, quirks mode has good article on events and event bubbling - <a href="http://www.quirksmode.org/js/events_order.html" rel="nofollow noreferrer">http://www.quirksmode.org/js/events_order.html</a> that has help... | 43,102 |
<p>For example, I could write either of these:</p>
<pre><code>class example <T>
{
...
public void insert (T data)
{
...
}
}
</code></pre>
<p>or</p>
<pre><code>class example
{
...
public void insert (Object o)
{
...
}
}
</code></pre>
<p>Is there a signficant di... | <p>The only reason to write the latter is if you must target an earlier JVM. Generics are implemented by type-erasure, so they have no runtime impact - only added compile time checking which will improve your code.</p>
<p>Of course if you need a collection which holds any old object, or a mix of several which don't h... | <p>Some of the encounters where I had to use 'Object' instead of Generics were those of compulsion than of a choice. When working with pre-generic code or libraries built around pre-generic api, one has little choice. Dynamic proxies for example, Proxy.newProxy() returns Object type. Passing generic context (where a co... | 46,256 |
<p>Laboratory centrifuges have buckets that hold the sample tubes in inserts.</p>
<p>The buckets are the black things on the rotor in the upper left corner holding the bottles. Examples of inserts are shown below (the colorful containers with slots for tubes). These fit into the buckets and I'd like to print them sinc... | <p>It's difficult to determine if the buckets are fully enclosed, but I suspect that they are. The enclosure into which the inserts are placed will provide some structural support. </p>
<p>3D printed objects have relatively low torsion strength, but a reasonable compression strength, especially with high infill levels... | <p>The primary printer I use is a makerbot, and my gut is saying no. </p>
<p>150G's of loading even in the XY axis seems pretty excessive for a part made on a Makerbot. Also, given that this is a rotational, the weight and balance will need to be held to a pretty high tolerance otherwise you'll end up having an off-ba... | 551 |
<p>This is all being done in an ASP.NET web forms application:</p>
<p>I need a modal popup that will show the user a preview of images that match a search criteria (e.g. they search for "dog" and the popup shows them all dog-related pictures). The search results shouldn't be too long, but the popup should support the... | <p>i prefer the use of jquery because it doesnt require the use of any server-side computations. also if the app ever ported to another technology other than asp.net it will still most likely work.</p>
| <p>I've been quite happy with the jQuery plug-in <a href="http://www.ericmmartin.com/projects/simplemodal/" rel="nofollow noreferrer">Simple Modal</a>.</p>
| 31,936 |
<p>How can I format data coming from a DataBinder.Eval statement in an ASPX page?</p>
<p>For example, I want to display the published date of the news items in a particular format in the homepage. I'm using the ASP.NET 2.0 Repeater control to show the list of news items.</p>
<p>The code for this goes like this:</p>
... | <p>There is an optional overload for DataBinder.Eval to supply formatting:</p>
<pre><code><%# DataBinder.Eval(Container.DataItem, "expression"[, "format"]) %>
</code></pre>
<p>The format parameter is a String value, using the value placeholder replacement syntax (called composite formatting) like this:</p>
<pr... | <pre><code><asp:Label ID="ServiceBeginDate" runat="server" Text='<%# (DataBinder.Eval(Container.DataItem, "ServiceBeginDate", "{0:yyyy}") == "0001") ? "" : DataBinder.Eval(Container.DataItem, "ServiceBeginDate", "{0:MM/dd/yyyy}") %>'>
</asp:Label>
</code></pre>
| 34,683 |
<p>I'm using symfony and propel, and I'm trying to invoke a specific culture on an object and output some fields of that object to the screen in that specific culture. However, if the object's mapped database record doesn't have those fields in that specific culture, I would like it to default to the base culture (in t... | <p>You will have to overwrite symfony itself to make it default to another language.
Theres a good working solution here <a href="http://www.codemassacre.com/2008/03/10/symfony-default-language-fallback/" rel="nofollow noreferrer">http://www.codemassacre.com/2008/03/10/symfony-default-language-fallback/</a></p>
| <p>The <code>i18n</code> record you get back from <code>getTranslation($language)</code> can be tested with <code>isNew()</code>, that will tell you if Propel has just made it up <code>(true)</code> or if it came from the database <code>(false)</code>.</p>
| 31,377 |
<p>The Oracle view V$OSSTAT holds a few operating statistics, including:</p>
<ul>
<li>IDLE_TICKS Number of hundredths of a second that a processor has been idle, totalled over all processors</li>
<li>BUSY_TICKS Number of hundredths of a second that a processor has been busy executing user or kernel code, totalled ov... | <p>You'll need to include 'IOWAIT_TICKS` if they are available.</p>
<blockquote>
<p>IDLE_TICKS - Number of hundredths of a
second that a processor has been idle,
totaled over all processors</p>
<p>BUSY_TICKS - Number of hundredths of a second that a
processor has been busy executing
user or kernel code, totaled over a... | <p>I am not convinced I need to include USER_TICKS and SYS_TICKS.</p>
<p>The documentation for BUSY_TICKS states:</p>
<pre><code>"...been busy executing user or kernel code, totalled over all processors"
</code></pre>
<p>which suggests that BUSY_TICKS already includes USER_TICKS and SYS_TICKS.</p>
<p>Same for NICE_... | 25,408 |
<p>In Visual Studio 2008 in a C# WinForms project, there is a button on a form. In the properties view, the property "Font" is set to "Arial Unicode MS".</p>
<p>What do I need to put into the property "Text", so I get the unicode character \u0D15 displayed on the button?</p>
<p>When I put \u0D15 into the "Text" prope... | <p>You don't have to escape your unicode characters in strings as C# is inherently unicode. Just put your unicode characters as they are into the string. For example:</p>
<pre><code>button1.Text = "日本";
</code></pre>
| <p>Just try the following in you C# code:</p>
<pre><code>button.Text = "0x0D15";
</code></pre>
| 31,934 |
<p>We have just 'migrated' an SQL Server 2005 database from DEVEL into TEST. Somehow during the migration process the DB was changed from case insensitive to sensitive - so most SQL queries broke spectacularly.</p>
<p>What I would like to know, is - are there any clear benefits to having a case sensitive schema? </p... | <p>I just found out why WE make it case sensitive. It is to ensure that when we deploy it on the client site, our DB works regardless whether the client's SQL Server is set up case sensitive or not.</p>
<p>That is one answer I wasn't expecting.</p>
| <p>I do support for Sybase Advantage Database Server and it uses a flat file format allowing DBF's as well as our own proprietary ADT format. The case where I see case sensitivity being an issue is when using our Linux version of the server. Linux is a case sensitive OS so we have an option in our db to lowercase all c... | 27,708 |
<p>Anyone know of a Javascript Calendar that supports drag selection for multiple days? Need to be able to do it over months as well, not just restricted to one month.</p>
<p>Thanks a lot in advance, the ones here are no good for my problem:
<a href="http://www.javascript-examples.com/javascript-calendars/" rel="nore... | <p>As long as your old COM dll implements the exact same interfaces, there's no reason to unregister/register</p>
| <p>Two things you have to consider if you want just to replace the Com Dll:</p>
<ol>
<li>They old and new have the same GUID.</li>
<li>You haven't append any new interfaces to the updated com Dll.</li>
</ol>
<p>otherwise you should unreg/reg your com dll</p>
| 41,759 |
<p>I have a case where a 3rd party ad is bleeding through my modal window implementation. I'd like to up the z-index of the modal overlay as high as possible so the ad won't show on top of it. Is there a limit to z-index values? I'm sure if there is it varies by browser. Anyone know?</p>
| <p>Keep in mind that <code>z-index</code> doesn't work globally, but only within a 'stacking context' (which has hard to digest <a href="http://www.w3.org/TR/CSS21/visuren.html#z-index" rel="noreferrer">definition</a> in CSS), and if the ad establishes it's own stacking context, then <code>z-index</code> values you set... | <p>Quote from <a href="http://techtrouts.com/is-there-a-limit-to-the-css-z-index-property/" rel="nofollow noreferrer">http://techtrouts.com/is-there-a-limit-to-the-css-z-index-property/</a>:</p>
<p>Theorically the z-index property should be unlimited, or at least within an int type range, depending on OS and browser.
... | 28,191 |
<p>(assume php5) consider</p>
<pre><code><?php
$foo = 'some words';
//case 1
print "these are $foo";
//case 2
print "these are {$foo}";
//case 3
print 'these are ' . $foo;
?>
</code></pre>
<p>Is there much of a difference between 1 and 2?</p>
<p>If not, what about between 1/2 an... | <p>Well, as with all "What might be faster in real life" questions, you can't beat a real life test.</p>
<pre><code>function timeFunc($function, $runs)
{
$times = array();
for ($i = 0; $i < $runs; $i++)
{
$time = microtime();
call_user_func($function);
$times[$i] = microtime() - $time;
}
ret... | <p>Practically there is no difference at all! See the timings: <a href="http://micro-optimization.com/single-vs-double-quotes" rel="nofollow">http://micro-optimization.com/single-vs-double-quotes</a> </p>
| 3,458 |
<p>In c# (3.0 or 3.5, so we can use lambdas), is there an elegant way of sorting a list of dates in descending order? I know I can do a straight sort and then reverse the whole thing, </p>
<pre><code>docs.Sort((x, y) => x.StoredDate.CompareTo(y.StoredDate));
docs.Reverse();
</code></pre>
<p>but is there a lambda e... | <p>Though it's untested...</p>
<pre><code>docs.Sort((x, y) => y.StoredDate.CompareTo(x.StoredDate));
</code></pre>
<p>should be the opposite of what you originally had.</p>
| <pre><code>docs.Sort((x, y) => -x.StoredDate.CompareTo(y.StoredDate));
</code></pre>
<p>Note the minus sign.</p>
| 30,276 |
<p>How can I detect whether or not an input box is currently a jQuery UI autocomplete? There doesn't seem to be a native method for this, but I'm hoping there is something simple like this:</p>
<pre><code>if ($("#q").autocomplete)
{
//Do something
}
</code></pre>
<p>That conditional, however, seems to always retur... | <pre><code>if ($("#q").hasClass("ac_input")) {
// do something
}
</code></pre>
<p><strong>UPDATE</strong></p>
<p>The class name in the JQuery UI autocomplete widget is now 'ui-autocomplete-input' so that code would be:</p>
<pre><code>if ($("#q").hasClass("ui-autocomplete-input")) {
// do something
}
</code><... | <p>It's true because once you've included the autocomplete js, every $() object now has a autocomplete() method defined (in case you want to activate autocomplete for those elements). Your if() is just saying that that function is not null.</p>
<p>I, unfortunately don't have a system where I can check this (left the ... | 31,785 |
<p>I bumped into a strange situation with MSBuild just now. There's a solution which has three projects: LibX, LibY and Exe. Exe references LibX. LibX in its turn references LibY, has some content files, and also references to a third-party library (several pre-built assemblies installed in both GAC and local lib folde... | <p>There is a difference in behavior when building with MSBuild (i.e. command line, TFS Build and other tools) compared to building with Visual Studio. The secondary references are not included in the references variable sent into MSBuild compile tasks.</p>
<p>There are several extension points provided by MSBuild to ... | <p>The AfterResolveReferences method fails if you've got a directed graph not a tree with a "trying to deploy different copies of the dll" error. (cf. <a href="https://stackoverflow.com/questions/9742746/how-to-configure-msbuild-msvc-to-deploy-dependent-files-of-dependent-assemblies">How to configure msbuild/MSVC to de... | 16,599 |
<p>I've recently bought myself a preassembled Prusa i3 MK3S printed and made my first projects. One of them was making a cup with my name on it. I want to use it to drink tea, water etc. I know, however, that I need to chose my filament wisely, as using the wrong one might be unsafe. I know that PLA for example is Poly... | <p>Answer was moved to this question: <a href="https://3dprinting.stackexchange.com/questions/147/which-are-the-food-safe-materials-and-how-do-i-recognize-them">Which are the food-safe materials and how do I recognize them?</a></p>
| <p>I think this site will answer some questions about food safe 3D printing: <a href="https://all3dp.com/1/food-safe-3d-printing-abs-pla-food-safe-filament/" rel="nofollow noreferrer">12 Vital Facts About Food Safe 3D Printing</a></p>
<p>PLA is not a good choice for hot substances because it will deform at hot water t... | 1,361 |
<p>I'm trying to populate a TDBGrid with the results of the following TQuery against the file Journal.db:</p>
<pre><code>select * from Journal
where Journal.where = "RainPump"
</code></pre>
<p>I've tried both <code>Journal."Where"</code> and <code>Journal.[Where]</code> to no avail.</p>
<p>I've also tried: <code>se... | <p>You can insert the resultset into a new table with "values" (specifying no column names) where you have given your own column names in the new table and then do a select from that table, Using a TQuery, something like:</p>
<pre><code>Query1.sql.clear;
query1,sql.add('Insert into newtable values (select * from Journ... | <pre><code>select * from Journal where Journal."where" = "RainPump"
</code></pre>
| 14,652 |
<p>How should I choose an IPv4 multicast address for my application's use? I may need more than one (a whole range perhaps ultimately) but just want to avoid conflicts with other applications.</p>
<ul>
<li>Packets will be entirely contained within an administrative domain, probably a LAN</li>
<li>If several independen... | <p>It seems you've already found <a href="http://www.iana.org/assignments/multicast-addresses" rel="noreferrer"><code>http://www.iana.org/assignments/multicast-addresses</code></a>, so you've done the right thing by picking an address from the <code>239.255/16</code> range.</p>
<p>As those ranges are entirely for site... | <p><a href="https://datatracker.ietf.org/doc/html/draft-ietf-zeroconf-zmaap" rel="nofollow noreferrer">ZMAAP</a> is a zero-configuration alternative to <a href="https://www.rfc-editor.org/rfc/rfc2730" rel="nofollow noreferrer">MADCAP</a>. I doubt there are any public source implementations of it. If you find one, the... | 29,234 |
<p>I have this large C++ project that I need to build on a platform that does not have a parallel make (like make -j on Linux). The server has 6 CPU's and I want to do a parallel build manually. </p>
<p>I can generate a task list like this for about 300 object files. I use the Makefile for the dependency checks and in... | <p>In Perl the you should look at <a href="http://search.cpan.org/perldoc?Parallel::ForkManager" rel="nofollow noreferrer">Parallel::ForkManager</a>. You could do something like this:</p>
<pre><code>my @make_obj = qw(
obj1.o
obj2.o
obj3.o
...
);
my $fm = $pm = new Parallel::ForkManager(6);
foreach my $obj (@m... | <p>If the OS is properly handling inter-processor communication and scheduling, you should just be able to throw all the makes into backgrounded processes, as long as there are no interdependencies.</p>
<p>If they're all independent, I would issues a series of commands like this:</p>
<pre><code>make -f Makefile obj1.... | 30,855 |
<p>I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either PHP or some kind of DNS/<code>.htaccess</code> voodoo.</p>
<p>So if I go to <code>www.mydomain.com/test</code> it redirects (but keeps the url of (<cod... | <p>Instead of pointing <code>www.yourdomain.com/test</code> at your test server, why not use <code>test.yourdomain.com</code>?</p>
<p>Assuming you have access to the DNS records for <code>yourdomain.com</code>, you should just need to create an A record mapping <code>test.yourdomain.com</code> to your test server's IP... | <p>It is quite possible, if I understand what you're getting at.</p>
<p>You have a PHP server with your domain pointing to it. You also have a separate ASP.NET server that only has an IP address associated with it, no domain.</p>
<p>Is there any drawback to simply pointing your domain name to your ASP.NEt box?</p>
| 6,809 |
<p>I've had issues with my hot end and decided to replace the whole assembly with <a href="https://www.amazon.ca/Ewigkeit-Extruder-Printer-Assembled-Aluminum/dp/B07Q493RYW/ref=sr_1_4_sspa?keywords=hot%20end&qid=1574768751&sr=8-4-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUFYVDRSMjVZRDU3QkMmZW5jcnlwdGVkSW... | <p>I got my printer fixed and am posting steps I took for people with similar problems in the future. </p>
<p><strong>Initial problem:</strong></p>
<p>After I replaced my entire heating unit and reconnected the wires, my printer started to read about 135/185 °C for the nozzle and bed at room temperature. It gives the... | <p>For future readers,</p>
<p>On a second-hand 3D printer with unknown firmware, I compiled the Marlin 2.1.1 firmware for the Creality 4.2.7 board with the default configurations for the <code>BOARD_CREALITY_V427</code> board, and at room temperature, the hotend reads about 121 °C.</p>
<p>I then measured the hotend the... | 1,523 |
<p>As a long time Pascal and Delphi developer, I always line up my begin and ends thus :</p>
<pre><code>begin
if x = y then
begin
...
...
end
else
for i := 0 to 20 do
begin
...
...
end;
end;
</code></pre>
<p>What drives me nuts is code formatted thus :</p>
<pre><code>begin
... | <p>I personally use:</p>
<pre><code>if Condition then
begin
DoThis;
end else
begin
DoThat;
end;
</code></pre>
<p>See <a href="http://dn.codegear.com/article/10280#8.2.3" rel="nofollow noreferrer">Object Pascal Style Guide</a>.</p>
<blockquote>
<p>In compound if statements, put each
element separating stateme... | <p>I would never write the code (your second example) that way. It would be either (preferred)</p>
<pre><code>begin
if x = y then begin
...
end
else begin
for i := 0 to 20 do begin
...
end;
end;
end;
</code></pre>
<p>or </p>
<pre><code>begin
if x = y then begin
...
end
else for i... | 36,902 |
<p>I got a simple page with a HtmlInputHidden field. I use a javascript to update that value and when posting back the page i want to read the value of that HtmlInputHidden field.</p>
<p>The Value property of that HtmlInputHidden field is on postback the default value (the value it had when the page got created, not t... | <p>The input field needs to be within a form. Also make sure ViewState is enabled.</p>
| <p>You ideally want to use the asp.net HiddenField control</p>
<pre><code><asp:HiddenField id="myHiddenField" runat="server" />
</code></pre>
<p>Then you will be able to read the value from the code behind when the page is processing. </p>
<pre><code>string value = myHiddenField.Value; // retrieve the value in... | 21,415 |
<p>I use eclipse for quite a lot of work, including:</p>
<ul>
<li>multiple "utility" projects that include code that most of my java work makes use of</li>
<li>various plugin-related projects that I sync and use periodically (eg: the <a href="http://git.or.cz/gitwiki/EclipsePlugin" rel="nofollow noreferrer">Git</a> pl... | <p>It isn't quite clear to me what your need is. But have you tried using working sets in the Package Explorer? </p>
<p>Open the Package Explorer view, open its menu, and Select Working Set. That lets you give a name to a subset of all the projects loaded in your workspace.</p>
<p>Switch working sets using the pac... | <p>I would recommend using different workspaces, and then adding the common projects to each workspace (you can specify the location of the project to be outside of the workspace). I believe this will work, but I haven't tried it, so I can't be sure.</p>
<p>As @JesperE and @Dennis S suggested, working sets will help ... | 18,719 |
<p>Since I've started my first job as a professional software developer about two years ago, I've read many articles about commonly accepted methodologies (e.g. Scrum, XP), technologies (e.g. EJB, Spring), techniques (e.g. TDD, code reviews), tools (bug tracking, wikis) and so on in software companies. </p>
<p>For man... | <ul>
<li><strong>Test-Driven-Development</strong> - No way.</li>
<li><strong>Domain-Driven-Design</strong> - What's <em>design</em>? </li>
<li><strong>Model-Driven-Design/Architecture</strong> - What's <em>design</em>? We do have an architecture team. With one exception (the most junior architect), they couldn't cod... | <p>its nice to hear that MDA, DDD and Pair Programming is not used anywhere :D Martin Fowler is not god, just guys with some weird ideas.</p>
<ul>
<li>Test-Driven-Development - if you want to</li>
<li>Unit Testing - yes</li>
<li>Code Reviews - kindda</li>
<li>Innovative Technologies (Spring, Hibernate, Wicket, JSF, WS... | 28,408 |
<p>I'm curious about people's approaches to using stored procedures in a database that is accessed by many applications. Specifically, do you tend to keep different sets of stored procedures for each application, do you try to use a shared set, or do you do a mix?</p>
<p>On the one hand, reuse of SPs allows for fewer ... | <p>Stored procedures should be created based on the data you intend to return, not the application making the request. If you have a stored procedure that is GetAllItems, it should return all of the items in the database. If one of the applications would like to get all of the items by category, create GetAllItemsByCat... | <p>I don't think sharing Sprocs among multiple applications makes sense. </p>
<p>I can see the case for sharing a database in related applications, but presumably those applications are separate in large part because they treat the data very differently from one another. </p>
<p>Using the same architecture could work... | 11,004 |
<p>Since Access 2003 doesn't have the control anchoring functionality as exists in 2007, I was wondering if anyone has or is aware of some VBA script, or a freeware control, that can give this functionality?</p>
| <p>I know of no exact duplication of the 2007 functionality in 2003. There are multiple components for resolution independence (resizing the controls on a form based on the users monitor resolution) and for resizing with the form resize event (such as <a href="http://www.fmsinc.com/products/components/ControlTour/resiz... | <p>In case someone come looking for 2007 or higher like - 2010, 2013, 2016 version. Here is the answer.</p>
<p>The font size will not automatically change based on screen resolution in any version of Access, but starting with <strong>Microsoft Access 2007</strong> you can use new properties of controls to make them <s... | 25,649 |
<p>So after a long print the walls in the print begin to weaken and it appears they might not be printed at all. In the upside down picture you can see the weakness where the two pieces are separated. I'm wondering if perhaps reducing my speed and changing the extrusion size from .35 to .45 which is larger than the e... | <p>What you refer to as weak walls in fact are under-extruded walls. This can be caused by multiple sources, but, since the print recovers this most probably is caused by filament that is entangled on the spool (this causes more friction for the extruder and as such less flow, so under-extrusion; like as if the filamen... | <p>A filament tangle is one possibility, one alternative is that you are seeing a jam in the extruder. The trigger for a jam might be excessive retraction, heat soak or some other issue with the heat-break. Less likely, you might have an electrical problem which is position dependant.</p>
<p>The extrusion-related issu... | 1,405 |
<p>I need to change a static property on an object in our web application. The property has a default value that is hard-coded into the object. If I change the static property in my Application_Start does that change stick:</p>
<p>A) Forever (well, until the app is recycled)</p>
<p>B) Until the object is GC'd then ... | <p>The scope of a static variable is its AppDomain. So no, it won't get garbage collected - but if the AppDomain is recycled (which can happen a fair amount in ASP.NET) then you'll end up with a "new" static variable, effectively.</p>
| <p>In my experience with our web apps here, the answer is A. As far as I know, a static class will never be GCed, it lives on for the life of the process (in this case, the ASP.NET worker process)</p>
| 30,081 |
<p>How do I pad a numeric string with zeroes to the left, so that the string has a specific length?</p>
| <p>To pad strings:</p>
<pre><code>>>> n = '4'
>>> print(n.zfill(3))
004
</code></pre>
<p>To pad numbers:</p>
<pre><code>>>> n = 4
>>> print(f'{n:03}') # Preferred method, python >= 3.6
004
>>> print('%03d' % n)
004
>>> print(format(n, '03')) # python >= 2.6
00... | <p>You could also repeat "0", prepend it to <code>str(n)</code> and get the rightmost width slice. Quick and dirty little expression.</p>
<pre><code>def pad_left(n, width, pad="0"):
return ((pad * width) + str(n))[-width:]
</code></pre>
| 44,018 |
<p>I'm trying to write a page that calls PHP that's stored in a MySQL database. The page that is stored in the MySQL database contains PHP (and HTML) code which I want to run on page load.</p>
<p>How could I go about doing this?</p>
| <p>You can use the <a href="http://php.net/manual/en/function.eval.php" rel="nofollow noreferrer">eval</a> command for this. <strong>I would recommend against this though, because there's a lot of pitfalls using this approach.</strong> Debugging is hard(er), it implies some security risks (bad content in the DB gets ex... | <p>How I did this is to have a field in the database that identified something unique about the block of code needing to be executed. That one word is in the file name of that code. I put the strings together to point to the php file to be included. example:</p>
<pre><code>$lookFor = $row['page'];
include("resourc... | 6,269 |
<p>I am in the early stages of design of an application that has to be highly available and scalable. I want to use an eventual consistency data model for this for a number of reasons. I know and understand why this is an unpopular architectural choice for many solutions, but it's important in my case.</p>
<p>I am loo... | <p>If you want to have a Distributed System (that "Eventual Consistency" thing) you need people, build, maintain and to operate it.</p>
<p>I found that there are three classes of people which have very little problems with "Eventual Consistency":</p>
<ul>
<li>People with a solid background in distributed systems. The... | <p>How to achieve high availability and scalability using relational databases is well known and there is a vast body of knowledge out there on how to do this!</p>
<p>Google is a special case which does not apply to most sites, very very high volumes of queries, very very large amounts of data, and, most importantly n... | 45,400 |
<p>I'm working on <a href="http://github.com/rictic/code_swarm/tree/master/" rel="nofollow noreferrer">a source-code visualization project</a> that uses the Processing core library. The processing library has the option to use the jogl OpenGL library to render graphics which really improves performance. However, the ... | <p>Simple just try to load the class with your ClassLoader using <a href="http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#loadClass(java.lang.String)" rel="nofollow noreferrer">loadClass</a> and catch a ClassNotFound exception and UnsatisfiedLinkError to do fallback functionality.</p>
| <p>The other neat way to make sure you get to use Jogl is to deploy via JNLP. You can include Jogl as a remote dependency and the Java launcher will automatically fetch the appropriate native version.</p>
| 20,826 |
<p>I have a table with about 45 columns and as more data goes in, the longer it takes for the inserts to happen. I have increased the size of the data and log files, reduced the fill factor on all the indexes on that table, and still slower and slower insert times. Any ideas would be GREATLY appreciated.</p>
| <ul>
<li><p>For inserts, you want to DECREASE the fillfactor on the indexes on the table in order to reduce page splitting.</p></li>
<li><p>It is somewhat expected that it will take longer to insert as more data goes in, because your indexes just plain get bigger.</p></li>
<li><p>Try putting in data in batches instead ... | <p>How big is the table?</p>
<p>What is the context? Is this a batch of many new records?</p>
<p>Can you post the schema including index definition?</p>
<p>Can you SET STATISTICS IO ON, SET STATISTICS TIME ON, and post the display for one iteration?</p>
<p>Is there anything pathological about the data, or the conte... | 48,741 |
<p>I am trying to autoreload my page after every 20 seconds. I am using JavaScript for this instead of the <meta>.</p>
<p>I have <body onload="SetTimer()">
and here is my JavaScript function</p>
<pre><code> function SetTimer(){
setTimeout('window.location.replace(window.location.pathname)', 20000)
... | <pre><code> setTimeout('window.location.replace(window.location.href)', 2000);
</code></pre>
<p>did the trick</p>
| <p>window.location will include the GET parameters that were that was passed.</p>
<pre><code>function SetTimer(){
setTimeout('window.location.replace(window.location)', 20000)
}
</code></pre>
<p>If you are submitting parameters through POST, the best method will probably be to create a form with hidden inputs fo... | 37,937 |
<p>I'm trying to convert an openGL [edit: "card that I drew"(?):) thx unwind]containing a lot of textures (nothing moving) into one PNG file that I can use in another part of the framework I'm working with. Is there a C++ library that does that?</p>
<p>thanks!</p>
| <p>If you simply mean "take a scene rendered by OpenGL and save it as an image," then it is fairly straightforward. You need to read the scene with glReadPixels(), and then convert that data to an image format such as PNG (<a href="http://www.opengl.org/resources/faq/technical/miscellaneous.htm" rel="noreferrer">http:/... | <p>What is an "OpenGL file"? OpenGL is a graphics API, it doesn't specify any file formats. Do you mean a DDS file, or something?</p>
| 48,578 |
<p>What options are there for installing Django such that multiple users (each with an "Account") can each have their own database?</p>
<p>The semantics are fairly intuitive. There may be more than one User for an Account. An Account has a unique database (and a database corresponds to an account). Picture WordpressMU... | <p>The Django way would definitely be to have separate installations with their own database name (#1). #2 would involve quite a bit of hacking with the ORM, and even then I'm not quite sure it's possible at all.</p>
<p>But mind you, you don't need a WHOLE new installation of all the site's models/views/templates for ... | <p>The Django ORM doesn't provide multiple database support classes, but it is definitely possible - you'll have to write a custom manager and make a few other tweaks. Eric Florenzano has a great article with detailed code samples:</p>
<p><a href="http://www.eflorenzano.com/blog/post/easy-multi-database-support-djang... | 40,583 |
<p>I am trying to use symbolic links in one of the applications I have running on Tomcat5. Thanks to some help from <a href="https://stackoverflow.com/questions/315093/configure-symlinks-for-single-directory-in-tomcat">another StackOverflow question</a> I was able to do it
by creating a context.xml file in</p>
<p>/... | <p>See <a href="https://stackoverflow.com/questions/322260/which-tomcat-5-context-file-takes-precedence#322535">my answer</a> to the "<a href="https://stackoverflow.com/questions/322260/which-tomcat-5-context-file-takes-precedence">Which Tomcat 5 context file takes precedence</a>" question.</p>
<p>Regarding your speci... | <p>Just to add a point.</p>
<p>Usually th meta-inf/context.xml is copied to the conf/Catalina/localhost/myapplication.xml</p>
<p>When redploying a war file the conf/Catalina/localhost/myapplication.xml is deleted and a new one copied in as described above.</p>
<p>This can be a real pain. I like the idea of applicati... | 41,126 |
<p>I want to have a <code>PHP script</code> send a <code>XML</code> formatted string to another <code>PHP script</code> that resides on a different server in a different part of town.</p>
<p>Is there any nice, clean way of doing this?</p>
<p><code>(PHP5 and all the latest software available)</code></p>
| <p>check out <a href="http://au2.php.net/curl" rel="nofollow noreferrer">cURL</a> for posting data between pages.</p>
| <p><a href="http://phpxmlrpc.sourceforge.net/" rel="nofollow noreferrer">XML-RPC</a> or <a href="http://www.php.net/soap" rel="nofollow noreferrer">SOAP</a> or just a <a href="http://developer.yahoo.com/php/howto-reqRestPhp.html" rel="nofollow noreferrer">RESTful API</a></p>
| 14,011 |
<p>I have an <a href="https://www.thingiverse.com/thing:3723481" rel="nofollow noreferrer">STL</a> (Raspberry Pi 4 casing) that automatically places itself like below on the bed surface:</p>
<p><a href="https://i.stack.imgur.com/0Xm8V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Xm8V.png" alt="en... | <p>The second placement is a better choice from an overall standpoint. In the vertical placement, adhesion is going to be more critical, although Prusa printers have good bonding for PLA and ABS, from my direct experience.</p>
<p>The other aspect of more importance is that the holes are going to be distorted in the ver... | <p>You've already got the correct answer, but I want to address an additional misconception in your question: head movement efficiency. Most 3D print jobs are <em>acceleration-bound</em>, not <em>top-speed-bound</em>. Without really cranking up the acceleration limits (which requires Klipper and input shaper tuning), t... | 2,024 |
<p>I have been using my Anet A2 for about a year. A few problems but none that I haven't been able to resolve. Today it suddenly stopped auto homing.</p>
<p>Using the position commands I can advance the X and Y positively but not negatively (after I manually re-position the carriages before turning the printer on). ... | <p>The fuse rating is same as described on the board - so that shall be no issue with it.</p>
<p><strong>My main concern is why the fuse is down?</strong></p>
<p>Was there a short-circuit? As this is mains fuse - that suggest a big-bang, so, please check carefully hot-end and bed heater connections before restarting ... | <p>To add to the answer of <em>@profesor79</em> (which you <strong>absolutely need to address first</strong> (find the cause why it blew); else the fuse might blow again), you might be interested in installing fuse clamps. As <em>@fred_dot_u</em> mentions:</p>
<blockquote>
<p>use caution when soldering leads to the ... | 948 |
<p>If I have the following:</p>
<pre><code>{"hdrs": ["Make","Model","Year"],
"data" : [
{"Make":"Honda","Model":"Accord","Year":"2008"}
{"Make":"Toyota","Model":"Corolla","Year":"2008"}
{"Make":"Honda","Model":"Pilot","Year":"2008"}]
}
</code></pre>
<p>And I have a "hdrs" name (i.e. "Make"), how can I refe... | <p>I had to alter your code a little:</p>
<pre><code>var x = {"hdrs": ["Make","Model","Year"],
"data" : [
{"Make":"Honda","Model":"Accord","Year":"2008"},
{"Make":"Toyota","Model":"Corolla","Year":"2008"},
{"Make":"Honda","Model":"Pilot","Year":"2008"}]
};
al... | <p>perhaps try data[0].Make</p>
| 11,236 |
<p>Is there a course that can help non OO programmers how to develop in .NET in a good way?
I don't mean just the syntax and how to design a class and the relationship between class but how organize a solution into projects (naming, what to put on each one) what method is more suitable to access data (dataobjects, remo... | <p>You could learn that by looking at the real code. One of the things I like doing is to read good open source code. Try looking into NUnit source code which is very well done.</p>
| <p>Yes as mentioned go to <a href="http://www.codeplex.com" rel="nofollow noreferrer">CodePlex</a> and look at a variety of open source projects there and see how they set up things. For LOB applications it might be worth checking out Rocky Lhokta's <a href="http://www.lhotka.net/Default.aspx" rel="nofollow noreferrer"... | 20,059 |
<p>I printed a big base for a model, but the corners of the bottom bent up, making the whole base rock when set on a table. Is there a quick fix for a makerbot2 without a heated plate?</p>
| <ul>
<li><p>Consider using a different material. Since you're on a replicator 2 you're probably not printing with ABS (which would be a terrible choice for a large, flat model) but probably with PLA. Perhaps you could try printing with PET(G) instead, which tends to warp even less.</p></li>
<li><p>You could try modifyi... | <p>here are the options:</p>
<ul>
<li>Use brim settings which increase contact surface.</li>
<li>Use some sort of glue. People are using many things including hairspray. I do prefer paper glue stick.</li>
</ul>
| 290 |
<p><strong>Problem</strong><br>
I've got a number of Dojo components on a page. When the user tries to tab from an input like component to a grid like component, I get a JavaScript "Can't move focus to control" error. The user base uses IE6. </p>
<p><strong>Solution</strong><br>
The first element in the DojoX Grid l... | <p>Preventing tabbing may disrupt partially sighted users who are browsing your site using a screenreader.</p>
| <pre><code><input name="z" onfocus="this.blur()"/>
</code></pre>
| 41,564 |
<p>Been going over my predecessor's code and see usage of the "request" scope frequently. What is the appropriate usage of this scope?</p>
| <p>There are several scopes that are available to any portion of your code: Session, Client, Cookie, Application, and Request. Some are inadvisable to use in certain ways (i.e. using Request or Application scope inside your Custom Tags or CFC's; this is <a href="http://en.wikipedia.org/wiki/Coupling_%28computer_science... | <p>Okay, I just wanted to comment on your code. Please forgive me if I seem crazy. But you already verified that the structKeyExists in the beginning. Since you know it's going to be true, it wouldn't make sense to run another check. So my version of it would be this... But thats just me.</p>
<hr>
<pre><code><cfif... | 4,529 |
<p>I have a web server which saves cache files and keeps them for 7 days. The file names are md5 hashes, i.e. exactly 32 hex characters long, and are being kept in a tree structure that looks like this:</p>
<pre><code>00/
00/
00000ae9355e59a3d8a314a5470753d8
.
.
00/
01/
</code></pre>
<p>You get the id... | <p>When you store a file, make a symbolic link to a second directory structure that is organized by date, not by name. </p>
<p>Retrieve your files using the "name" structure, delete them using the "date" structure.</p>
| <p>How about having a table in your database that uses the hash as the key. The other field would then be the name of the file. That way the file can be stored in a date-related fashion for fast deletion, and the database can be used for finding that file's location based on the hash in a fast fashion.</p>
| 32,226 |
<p>I'm writing a C# app using the WebBrowser control, and I want all content I display to come from embedded resources - not static local files, and not remote files.</p>
<p>Setting the initial text of the control to an embedded HTML file works great with this code inspired by <a href="http://blog.topholt.com/2008/03/... | <p>I can see three ways to get this going:</p>
<p>1: write the files you need to flat files in the temp area, navigate the <code>WebBrowser</code> to the html file, and delete them once the page has loaded</p>
<p>2: as you say, an embedded web-server - herhaps <code>HttpListener</code> - but note that this uses HTTP.... | <pre><code>/// Hi try this may help u.
private string CheckImages(ExtendedWebBrowser browser)
{
StringBuilder builderHTML = new StringBuilder(browser.Document.Body.Parent.OuterHtml);
ProcessURLS(browser, builderHTML, "img", "src");
ProcessURLS(browser, builderHTML, "link", "href");
... | 34,555 |
<p>I recently purchased a 2D Barcode reader. When scanning a U.P.S. barcode, I get about half of the information I want, and about half of it looks to be encrypted in some way. I have heard there is a UPS DLL.</p>
<p>Example - Everything in bold seems to be encrypted, while the non-bold text contains valuable, legitim... | <p>The data after the SCAC is compressed and requires a DLL or some other component from UPS in order to decode. Note that a MaxiCode holds only about 100 characters of data so compression is required in order to encode more shipping data.</p>
| <p>This is a page I have come across before, however, this page discusses ENCODING a barcode, using plain English and some component. The information used to ENCODE is the information I would like to retrieve when DECODING. </p>
<p>Like I said, when the information is RETRIEVED, half of the information comes out Garbl... | 48,310 |
<p>I know questions of this kind <a href="https://stackoverflow.com/questions/24298/best-solution-for-authentication-in-ruby-on-rails">have</a> <a href="https://stackoverflow.com/questions/13254/open-id-authentication-in-ruby-on-rails">been</a> <a href="https://stackoverflow.com/questions/38901/strange-rails-authentica... | <p>Look into <a href="http://www.railslodge.com/plugins/966-restful-acl" rel="nofollow noreferrer">restful acl</a></p>
| <h1>Authority</h1>
<p>I've just released a gem called <a href="https://github.com/nathanl/authority" rel="nofollow">Authority</a> which is totally ORM-neutral; you can do whatever Ruby logic works for your app. </p>
<p>The original use case, for example, involved comparing roles described by a single-sign-on system w... | 40,508 |
<p>How can I generate valid XML in C#?</p>
| <p>It depends on the scenario. <code>XmlSerializer</code> is certainly one way and has the advantage of mapping directly to an object model. In .NET 3.5, <code>XDocument</code>, etc. are also very friendly. If the size is very large, then <code>XmlWriter</code> is your friend.</p>
<p>For an <code>XDocument</code> exam... | <p>As above.</p>
<p>I use stringbuilder.append().</p>
<p>Very straightforward, and you can then do xmldocument.load(strinbuilder object as parameter).</p>
<p>You will probably find yourself using string.concat within the append parameter, but this is a very straightforward approach.</p>
| 36,069 |
<p>How can I test my site in AOL without installing AOL? I did that once on my machine, and it killed it... ;)</p>
<p>I know, I know... I can use a Virtual Machine, but I'm really just looking for an AOL Browser... a separate browser install.</p>
| <p>You can download <a href="http://downloads.channel.aol.com/browser" rel="noreferrer">AOL Explorer</a> by itself.</p>
| <p>I found the accepted answer linked through to the generic downloads location, you can go directly to the product here: <a href="http://info.aol.co.uk/browser/" rel="nofollow">http://info.aol.co.uk/browser/</a></p>
| 35,638 |
<p>I've got a "Schroedinger's Cat" type of problem here -- my program (actually the test suite for my program, but a program nonetheless) is crashing, but only when built in release mode, and only when launched from the command line. Through caveman debugging (ie, nasty printf() messages all over the place), I have de... | <p>In 100% of the cases I've seen or heard of, where a C or C++ program runs fine in the debugger but fails when run outside, the cause has been writing past the end of a function local array. (The debugger puts more on the stack, so you're less likely to overwrite something important.)</p>
| <p>I agree with Rolf. Because reproducibility is so important, you shouldn't have a non-debug mode. All your builds should be debuggable. Having two targets to debug more than doubles your debugging load. Just ship the "debug mode" version, unless it is unusable. In which case, make it usable.</p>
| 22,535 |
<p>I have a T-SQL <strong>table variable</strong> (not a table) which has an auto incrementing identity column. I want to clear all data from this variable and reset the identity column value to 1. How can this be done?</p>
| <p>If you're using a table variable, you can't do it. If it were a table, you could truncate it or use <code>DBCC CHECKIDENT</code>. But, if you <em>have</em> to use a table variable, you have to use something other than an identity column. Or, more accurately, use the identity column in your table variable but output ... | <p>If you need to truncate the table variable in each turn of a while loop, you can put the <code>declare @myTbl (...)</code> statement in the loop. This will recreate the table and reset the identity column on each turn of the loop. However, it has a heavy performance hit. I had fairly tight loop, and redeclaring t... | 17,726 |
<p>Does anyone know of any HMM implementation in .net?</p>
<p>I've some stuff that I did that was basicly reverse engineered from what little knowledge that I have regarding the subject and some c++ code of a very domain specific application that one of my professors did. </p>
<p>I want to improve it somewhat and hav... | <p>A quick Google search returned this <a href="http://corsis.svn.sourceforge.net/viewvc/corsis/trunk/Tenka.Text/Tenka.Text/Statistics/MarkovNGramm.cs?view=markup" rel="nofollow noreferrer">C# implementation</a> of what appears to be a Hidden Markov Model (they said it was an <a href="http://en.wikipedia.org/wiki/N-gra... | <p>I'm sure it's very late, but maybe this will serve for reference for other people looking: the <a href="http://accord-net.origo.ethz.ch/" rel="nofollow">Accord.NET</a> framework integrates a simple, efficient implementation of HMMs.</p>
| 13,827 |
<p>I'm writing a J2SE desktop application that requires one of its components to be pluggable. I've already defined the Java interface for this plugin. The user should be able to select at runtime (via the GUI) which implementation of this interface they want to use (e.g. in an initialisation dialog). I envisage each p... | <p>After many tries for plugin-based Java architectures (what is precisely what you seem to look for), I finally found <a href="http://code.google.com/p/jspf/" rel="noreferrer">JSPF</a> to be the best solution for Java5 code. it do not have the huge needs of OSGI like solutions, but is instead rather easy to use.</p>
| <p>One approach I'm considering is having my application start up a lightweight OSGi container, which if I understand correctly would be able to discover what plugin JAR files exist in a designated folder, which in turn would let me list them for the user to choose from. Is this feasible?</p>
<p>I also found <a href="... | 10,717 |
<p>I used the owner-drawn strategy on CMyListBox class which derives from CListBox. I only want the DrawItem() method to perform when I insert an item in the listbox. But the method is invoked many times. How can I change to invoke it whenever I need.</p>
| <p>You could always cache the initial drawing by outputting the content to an in-memory bitmap and then drawing that, it does mean you need to track when something has changed so you can run the actual rending code agaain. It does save running through your render code everytime if there's a lot of it.</p>
| <p>The DrawItem() method is called whenever there is a requirement to draw any given item in the listbox. If you do not respond to it you are likely to get a blank area in your list box, where the drawn data has been erased and you have not refreshed it. If you really do not think the drawing is necessary, you could ... | 30,600 |
<p>Creating an XPathDocument with referenced DTD sometimes throws a web exception. Why?</p>
| <p>See <a href="http://todotnet.com/archive/2006/07/27/8248.aspx" rel="nofollow noreferrer">http://todotnet.com/archive/2006/07/27/8248.aspx</a></p>
<blockquote>
<p>Because in the construction of
XPathDocument, there's an http GET
command to see if it can access the
DTD. It's not doing anything with the
DTD.... | <p>See <a href="http://todotnet.com/archive/2006/07/27/8248.aspx" rel="nofollow noreferrer">http://todotnet.com/archive/2006/07/27/8248.aspx</a></p>
<blockquote>
<p>Because in the construction of
XPathDocument, there's an http GET
command to see if it can access the
DTD. It's not doing anything with the
DTD.... | 29,677 |
<p>There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally unacceptable, How can I limit the function execution time from my code? I guess the solution must utilize another thread.</p>
| <p>I'm not sure how cross-platform this might be, but using signals and alarm might be a good way of looking at this. With a little work you could make this completely generic as well and usable in any situation.</p>
<p><a href="http://docs.python.org/library/signal.html" rel="noreferrer">http://docs.python.org/libra... | <p>Here's a timeout function I think I found via google and it works for me.</p>
<p>From:
<a href="http://code.activestate.com/recipes/473878/" rel="nofollow noreferrer">http://code.activestate.com/recipes/473878/</a></p>
<pre><code>def timeout(func, args=(), kwargs={}, timeout_duration=1, default=None):
'''This ... | 47,855 |
<p>my <b>SSRS DataSet</b> returns a field with HTML, e.g.</p>
<pre><code><b>blah blah </b><i> blah </i>.
</code></pre>
<p>how do i strip all the HTML tags? has to be done with <b>inline</b> VB.NET</p>
<p>Changing the data in the table is not an option.</p>
<p><strong>Solution found</strong> ... | <p>Thanx to Daniel, but I needed it to be done inline ... here's the solution:</p>
<p><code>= System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]+>","")</code></p>
<p>Here are the links:</p>
<p><a href="http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx" rel="noreferrer">ht... | <p>If you know the HTML is well-formed enough, you could, if you make sure it has a root node, convert the data in that field into a System.Xml.XmlDocument and then get the InnerText value from it.</p>
<p>Again, you will have to make sure the text has a root node, which you can add yourself if needs be, since it will ... | 5,533 |
<p>I am in the process of figuring out a cache strategy for our current setup, currently have multiple web servers and wanted to know what is the best way to cache data in this environment. I have done research about MemCache and the native asp.net caching but wanted to get some feedback first. Should I go with a Linux... | <p>What about checking out <a href="http://code.msdn.microsoft.com/velocity" rel="nofollow noreferrer">Microsoft Velocity</a>?
Another option if you don't want to start using Microsoft CTP-ware is to check out <a href="http://www.alachisoft.com/ncache/" rel="nofollow noreferrer">Nache</a> which allows distributed cache... | <p>Another open source choice other than memcached probably worth looking into is Shared Cache. I haven't played with it. But it says to have c# native implementation.</p>
| 2,614 |
<p>For instance, my query is like the following using SQL Server 2005:</p>
<pre><code>SELECT * FROM Table WHERE FREETEXT(SearchField, 'c#')
</code></pre>
<p>I have a full text index defined to use the column SearchField which returns results when using:</p>
<pre><code>SELECT * FROM Table WHERE SearchField LIKE '%c#... | <p>The # char is indexed as punctuation and therefore ignored, so it looks like we'll remove the letter C from our word indexing ignore lists.</p>
<p>Tested it locally after doing that and rebuilding the indexes and I get results!</p>
<p>Looking at using a different word breaker language on the indexed column, so tha... | <p>Quoting a much-replicated help page about Indexing Service query language:</p>
<blockquote>
<p>To use specially treated characters such as &, |, ^, #, @, $, (, ), in a query, enclose your query in quotation marks (“).</p>
</blockquote>
<p>As far as I know, full text search in <code>MSSQL</code> is also done ... | 2,347 |
<p>Is it possible to specify a relative path reference in connectionstring, attachDbFileName property in a web.config?</p>
<p>For example, In my database is located in the App_data folder, I can easily specify the AttachDBFilename as|DataDirectory|\mydb.mdf and the |Datadirectory| will automatically resolve to the cor... | <p>I had the same problem with the following scenario: I wanted to use the same database as the application from my integration tests.</p>
<p>I went with the following workaround:</p>
<p>In the App.config of my test-project I have:</p>
<pre><code><appSettings>
<add key="DataDirectory" value="..\..\..\Book... | <p>In IIS you could also create a virtual directory that points at wherever the the real database is kept. Then your connection string just references the virtual directory.</p>
| 15,216 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/105372/c-how-to-enumerate-an-enum">C#: How to enumerate an enum?</a> </p>
</blockquote>
<p>The subject says all. I want to use that to add the values of an enum in a combobox.</p>
<p>Thanks</p>
<p>vIceBerg</p... | <pre><code>string[] names = Enum.GetNames (typeof(MyEnum));
</code></pre>
<p>Then just populate the dropdown withe the array</p>
| <p>It is often useful to define a Min and Max inside your enum, which will always be the first and last items. Here is a very simple example using Delphi syntax:</p>
<pre><code>procedure TForm1.Button1Click(Sender: TObject);
type
TEmployeeTypes = (etMin, etHourly, etSalary, etContractor, etMax);
var
i : TEmployee... | 18,639 |
<p>Where is the option in Visual Studio to make the Home key go to the start of the line?</p>
<p>Right now you have to do</p>
<p><kbd>Home</kbd>,<kbd>Home</kbd></p>
<p>or</p>
<p><kbd>Home</kbd>, <kbd>Ctrl</kbd>+<kbd>Left Arrow</kbd></p>
<p>i'd prefer that home goes to the start of the line. i saw it before, but no... | <p>In Tools/Customize/Keyboard, Reassign the "Home" key from Edit.LineStart" to "Edit.LineFirstColumn"</p>
<p><strong>Edit by OP:</strong> You must change <strong>Scope</strong> to <strong>Text Editor</strong> before this will work.</p>
<hr>
<p><strong>Visual Studio 2010</strong></p>
<p>Visual Studio 2010 removed ... | <p>From asking the same question on MSDN forums:</p>
<p>TaylorMichaelL said:</p>
<blockquote>
<p>The command you are interested in is
Edit.LineFirstColumn. <strong>You'll want to
change the scope to be the Text
Editor.</strong> You should remove any
existing shortcut key associated with
the command firs... | 10,939 |
<p>The problem I'm trying to solve is "What's at this position?"</p>
<p>It's fairly trivial to get the x/y position (offset) of a DIV, but what about the reverse? How do I get the id of a DIV (or any element) given an x/y position?</p>
| <p>Use a JQuery selector to filter the list of all DIVs for one that matches your position criteria?</p>
| <p>this might be a little too processor intensive but going over the whole list of div elements on a page, finding their positions and sizes then testing if they're under the mouse. i don't think i'd want to do that to a browser though.</p>
| 7,142 |
<p>I am trying to make my window manager conform to the ICCCM specifications. I fully understand the reason for the _NET_SUPPORTING_WM_CHECK atom - this ensures that no invalid information stays whenever the window manager isn't running anymore.</p>
<p>What I don't understand is why are no other atoms like _NET_NUMBER... | <p>Well the atoms that you are talking about are not the ICCCM.
They belong to the newer set of <a href="http://en.wikipedia.org/wiki/Extended_Window_Manager_Hints" rel="nofollow noreferrer">EWMH</a></p>
<p>So basically it goes like this.</p>
<p>First we had the ICCCM.
They are </p>
<ul>
<li>old</li>
<li>mature</li>... | <p>I think the idea is you have to check whether a property is supported, and only use it from the root window if it's supported.</p>
<p>The _NET_SUPPORTING_WM_CHECK window was added later after a lot of the other properties already existed, if I remember right.</p>
| 26,333 |
<p>I am working on an application that has a navigation tree which is a session bean.
Every time I invoke the page that contain this bean, my memory usage will increase. However, after few hours of inactivity, the memory still isn't freed. Are there any ideas why this happens, or workarounds?</p>
| <p>(I hope I'm understanding the problem, here...)</p>
<p>This part seemed significant:</p>
<blockquote>
<p>This report view utilizes complex
logic from controller</p>
</blockquote>
<p>As a general rule, controllers should be simple. Really simple. The rule of thumb is "thin controller, fat model" (Rails Envy ma... | <p>I had a similar problem a while ago, when they deprecated render_controller. The only solution I found then was to use ajax, passing a parameter to the page you want to load that bypasses the layout.</p>
| 46,411 |
<p>For a typical business application, should the focus be on client processing via AJAX i.e. pull the data from the server and process it on the client or would you suggest a more classic ASP.Net approach with the server being responsible for handling most of the UI events? I find it hard to come up with a good 'defau... | <p>It really depends on the application and the situation, but just keep in mind that every hit to the server is costly, both in adding load (perhaps minimally), but also in terms of UI responsiveness. I am of the mind that doing things in JavaScript when possible is a good idea, if it can make your UI feel snappier.<... | <p>Do you need to trust the data? If so, be aware that it's trivial to tamper with client-processed data in nasty and malicious ways. If that's the case, you'll want to process info on the server.</p>
<p>Also, be aware that it can be a lot harder to code javascript apps so they are stable, reliable, and bug free. Can ... | 6,198 |
<p>I am still very much a novice and learning so here is the situation:</p>
<ol>
<li>Filament was not extruding from nozzle. Checked the filament feeder (worked fine, filament was being squeezed through) and tried to push filament through hot nozzle to see if anything came out. Nothing did.</li>
<li>Did a cold pull, go... | <p>I have encountered this many times. This is how I solved it:</p>
<p>Sadly you have to disassemble the entire hotend. Remove the nozzle, remove the heatbreak and heatsink leaving the heater block in place, it does not need to be cleaned (unless I am mistaken). If there are any plastic pieces in those parts, remove th... | <p>I fixed this by using a q-tip to wipe out the threads!</p>
| 1,735 |
<p>Please tell me how do I print a bit, like <code>printf("%d",bit);</code>.</p>
| <p>If bit is just an int that contains the value you want in the least significant bit, then:</p>
<pre><code>printf("%d", bit & 0x1);
</code></pre>
<p>should do it. The & is doing a binary-AND with a number with only the first significant bit set, so you're removing all the rest of the bits in the integer.</... | <p>The C++ answer is easier than the C89 one, with the native bool type:</p>
<pre><code>bool b = true;
std::cout << b;
</code></pre>
<p>C99 is quite similar:</p>
<pre><code>_Bool b = 1;
printf("%d", b);
</code></pre>
| 45,539 |
<p>When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program reacts to incorrect values entered into a config file?</p>
<p>It would be ridiculous to have to modify the config file for the NUnit app, but I c... | <p>I usually isolate external dependencies like reading a config file in their own facade-class with very little functionality. In tests I can create a mock version of this class that implements and use that instead of the real config file. You can create your own mockup's or use a framework like moq or rhino mocks for... | <p>Actually, thinking on it further, I suppose what I should do is create a ConfigFileReader class for use in my project and then fake it out in the unit test harness?</p>
<p>Is that the usual thing to do?</p>
| 20,390 |
<p>I'd like to automate the FTP download of a database backup file using PowerShell. The file name includes the date so I can't just run the same FTP script every day. Is there a clean way to do this built into PowerShell or using the .NET framework?</p>
<p>I want to use a secure FTP session.</p>
| <p>After some experimentation I came up with this way to automate a secure FTP download in PowerShell. This script runs off the <a href="http://www.secureftp-test.com/" rel="noreferrer">public test FTP server</a> administered by Chilkat Software. So you can copy and paste this code and it will run without modificatio... | <p>I have successfully used the Indy Project .NET library to do FTP. And...ugh, looks like the hosted .NET build is no longer available.</p>
| 33,253 |
<p>Our company is considering using the <a href="http://msdn.microsoft.com/en-us/vsx2008/products/bb933751.aspx" rel="nofollow noreferrer">Visual Studio Shell</a> for one of our products.</p>
<p>Does anyone have any experience using it? Was it easy to work with? Did it save time? Are there any things that you weren... | <p><strong>A couple of points regarding the Isolated shell.</strong></p>
<p>As you might know, there are two considerations when you use shell - Isolated Mode and Integrated Mode. (<a href="http://msdn.microsoft.com/en-us/vsx2008/products/bb933751.aspx" rel="nofollow noreferrer">Read more from MSDN</a>)</p>
<p>Isolat... | <p>I typically use <code>Visual Studio Community</code> on my PC for developing business intelligence solutions (databases, SSIS, SSAS, SSRS), then deploying to the server. A few weeks ago my managers requested we put Visual Studio on a server so that other developers and consultants could connect to the server and ac... | 47,549 |
<p>I have been able to copy the raw data from an otherwise inaccessible USB drive into a monolithic file of about 250MB. Somewhere in that blob of bytes are about 40 Word documents. </p>
<ol>
<li><p>Where do I find documentation about the internal structure of Word documents such that I can parse the byte-stream, reco... | <p>Two approaches:</p>
<p>You can mount files as volumes in linux. Provided your binary blob isn't too corrupted, you'll probably be able to break down the filesystem to find out where you files are located. Is (was) it a FAT partition or NTFS?</p>
<p>If that doesn't work, I'd look for <a href="http://www.garykessl... | <p>The <a href="http://poi.apache.org/" rel="nofollow noreferrer">Apache POI</a> project has a library for reading and writing all kinds of MS Office docs. If the files are in the new XML base <a href="http://en.wikipedia.org/wiki/OOXML" rel="nofollow noreferrer">OOXML</a> format, you'll be looking for the start of a z... | 46,281 |
<p>I left my printer to print a circular object and when I came back I saw it didn't print anything but left this layer of white on the surface. I can't get it off, I've tried washing it and scraping it off with the chisel, nothing works.</p>
<p><a href="https://i.stack.imgur.com/7zuyK.jpg" rel="nofollow noreferrer" ti... | <p>My guess is it's damaged print surface from the hot extruder mashing against the print surface. Your description seems to indicate that it isn't a layer.</p>
| <p>If it actually is residue from the material you were trying to print, pressed against the surface so tightly and so thin that you can't separate it, the best way to remove it is printing a new object on top of it, using the same material, with the bed properly leveled (i.e. not smashing the nozzle into it again) and... | 2,016 |
<p>This is a generic way to select data from a table and show the results in an HTML table using JSP taglibs. What is the generic way to do this in Grails? That is, take a few lines of SQL and generate an HTML table from scratch in Grails, including the column names as headers.</p>
<pre>
<sql:query var="results" ... | <p>This question could be rephrased as, how do I write code like a naive ASP.NET developer?
(Not all ASP.NET developers are naive, some can be quite good)</p>
<ol>
<li>Any static method is available to you in a gsp page. You can use any MyDomain.findBy, list(), count you want from page scope.</li>
<li><p>You could a... | <p>You could use the taglib as described. You just need to make Grails aware of it.</p>
| 33,268 |
<p>I just finished a test as part of a job interview, and one question stumped me, even using Google for reference. I'd like to see what the StackOverflow crew can do with it:</p>
<blockquote>
<p>The <code>memset_16aligned</code> function requires a 16-byte aligned pointer passed to it, or it will crash.</p>
<p>a) How ... | <h3>Original answer</h3>
<pre><code>{
void *mem = malloc(1024+16);
void *ptr = ((char *)mem+16) & ~ 0x0F;
memset_16aligned(ptr, 0, 1024);
free(mem);
}
</code></pre>
<h3>Fixed answer</h3>
<pre><code>{
void *mem = malloc(1024+15);
void *ptr = ((uintptr_t)mem+15) & ~ (uintptr_t)0x0F;
... | <pre><code>long add;
mem = (void*)malloc(1024 +15);
add = (long)mem;
add = add - (add % 16);//align to 16 byte boundary
ptr = (whatever*)(add);
</code></pre>
| 28,202 |
<p>I think this must be simple but I can't get it right...</p>
<p>I have an MxM triangular matrix, the coefficients of which are stored in a vector, row by row.
For example:</p>
<pre><code>M = [ m00 m01 m02 m03 ]
[ m11 m12 m13 ]
[ m22 m23 ]
[ m33 ]
</code></pre>
<p>is st... | <p>Here's an algebraic (mostly) solution:</p>
<pre><code>unsigned int row_index( unsigned int i, unsigned int M ){
double m = M;
double row = (-2*m - 1 + sqrt( (4*m*(m+1) - 8*(double)i - 7) )) / -2;
if( row == (double)(int) row ) row -= 1;
return (unsigned int) row;
}
unsigned int column_index( unsig... | <p>Took me some time to understand what you needed! :)</p>
<pre><code>unsigned int row_index(int i, int m)
{
int iCurrentRow = 0;
int iTotalItems = 0;
for(int j = m; j > 0; j--)
{
iTotalItems += j;
if( (i+1) <= iTotalItems)
return iCurrentRow;
iCurrentRow ++;... | 30,055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.