instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm embedding the Google Maps Flash API in Flex and it runs fine locally with the watermark on it, etc. When I upload it to the server (flex.mydomain.com) I get a sandbox security error listed below: </p> <pre><code>SecurityError: Error #2121: Security sandbox violation: Loader.content: http://mydomain.com/main....
<p>This sounds like a <code>crossdomain.xml</code> related problem. I did a quick search and there seems to be many people with the same issue. Some proxy requests through XMLHttpRequest etc..</p> <p><a href="http://code.google.com/p/gdata-issues/issues/detail?id=406" rel="nofollow noreferrer">Issue 406: Add crossdoma...
<p>Thanks for the help. Apparently this has something to do with including the Flex app on an ASP.NET page. When I moved it over to a flat HTML file, it worked fine. I don't have time to fully investigate right now, but that seems to have fixed it.</p>
8,485
<p>I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception:</p> <blockquote> <p>UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied."</p> </blockquote> <p>I have given write access to the iis_iusrs, iis_wpg, and aspnet users, b...
<p>You need to grant permission to one of the following accounts</p> <pre><code>ASPNET - Win XP and Win 2000 NETWORK SERVICE - Win Vista and 2003 </code></pre> <p>These are the defaults, if the application pool has been configured for a different process account then you would need to work with that specific account....
<p>I think Mitchel's got it, but I'll add that troubleshooting these kinds of things is infinitely easier using SysInternals' <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow noreferrer">Process Monitor</a> (<a href="http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx" rel...
22,796
<p>At work we use Sandcastle for creation of help files. I have been using SandCastleGUI for some time and I'm looking for a way to create additional pages in the help file. These pages are written in XML format called MAML. The only problem is that I couldn't find any decent editor for these file format.</p> <p>I'm...
<p>Finally I found a solution the good people of <a href="http://shfb.codeplex.com/" rel="nofollow">SandCastle Help File Builder</a> have included an HTML to MAML converter.<br> There are many good HTML editorsout there - and now I can use one of them and then convert the result to MAML</p>
<p>Don't know if you are still looking for a solution to this, but I've been looking at help editors and ran across a codeproject article that might be useful. The article can be found at <a href="http://www.codeproject.com/KB/dotnet/DocMounter_2_Sandcastle.aspx" rel="nofollow">http://www.codeproject.com/KB/dotnet/Doc...
13,379
<p>I'm writing a simple C++ class in which I would like cache picture thumbnails versions of images downloaded from the web. As such, I would like to use a hash function which takes in URL strings and outputs a unique string suitable as a filename.</p> <p>Is there a simple way to do this without re-writing the functi...
<p>A simpler approach is to replace everything which is not a character or a number with an underscore.</p> <p>EDIT: Here's a naive implementation in C:</p> <pre><code>#include &lt;cctype&gt; char *safe_url(const char *str) { char *safe = strdup(str); for (int i = 0; i &lt; strlen(str); i++) { if (is...
<p>What about <a href="http://www.boost.org/doc/libs/1_37_0/doc/html/hash.html" rel="nofollow noreferrer"><code>boost::hash</code></a>?</p>
32,526
<p>I'me looking for a function that would receive a time and would round it to the next/previous hour / half-hour / quarter / minute.</p>
<p>Try this function</p> <pre><code>CREATE FUNCTION [dbo].[RoundTime] (@Time datetime, @RoundTo float) RETURNS datetime AS BEGIN DECLARE @RoundedTime smalldatetime DECLARE @Multiplier float SET @Multiplier= 24.0/@RoundTo SET @RoundedTime= ROUND(CAST(CAST(CONVERT(varchar,@Time,121) AS datetime) AS float) ...
<p>Very nice thanks. I used it in-line to round to 15 minutes</p> <pre><code>convert(smalldatetime,ROUND(cast(TDatalog.Time as float) * (24/.25),0)/(24/.25)) AS RoundedTime </code></pre>
31,068
<p>I want my validation.xml to only check for a null if certain options are selected from a dropdown. So far I have</p> <pre><code>&lt;field property="empFDServiceStartDate" depends="requiredif, date"&gt; &lt;arg0 key="Service Start date" resource="false"/&gt; &lt;var&gt; &lt;var-name&g...
<p>You can do this multiple test in the same test, like this:</p> <pre><code>&lt;field property="empFDServiceStartDate" depends="requiredif, date"&gt; &lt;arg0 key="Service Start date" resource="false"/&gt; &lt;var&gt; &lt;var-name&gt;test&lt;/var-name&gt; &lt;var-value&gt;((moverChangeType == "Con...
<p>If you want to check the field if moverChangeType equals "Conversion" try this...</p> <pre><code>&lt;field property="empFDServiceStartDate" depends="requiredif, date"&gt; &lt;arg0 key="Service Start date" resource="false"/&gt; &lt;var&gt; &lt;var-name&gt;test&lt;/var-name&gt; &lt;var-value&g...
34,289
<p>Have you used the Perl 5.10 backtracking control verbs in your regexes yet? And what problems did they help you accomplish? </p> <hr> <p>Just as background: I have done some fiddling, but I can't get any really useful results.</p> <p>As a comparison, when I started getting what the <code>(?&gt;</code> grouping di...
<p>Yes, I have, although not too much. I use them to control backtracking, usually to force it to make more permutations. Here’s an <a href="https://stackoverflow.com/questions/4092348/how-to-generate-an-array-with-random-values-without-using-a-loop/4092746#4092746">amusing solution</a> and here’s a <a href="https://...
<p>Honestly, I haven't even used 5.10 much yet. As great as some of the new features are I only use them in personal scripts. For production I target compatibility with 5.8. For CPAN I target 5.6. This has stopped me from playing with most of the new toys.</p> <p>The backtracking control features are interesting but I...
31,637
<p>From what I understand, the crystals on PC's are notorious for clock skew. If clocks are always skewing, what is the best way to synchronize clocks between machines with millisecond accuracy and precision? From what I've found, NTP and PTP are possible solutions, but I was wondering if anybody had any experience on ...
<p>Just run the standard NTP daemon.</p> <p>It does have options to take input from several GPS devices as well as talking to network servers.</p> <p>Edit: I was referring to <a href="http://www.ntp.org/" rel="noreferrer">http://www.ntp.org/</a>, not the one that comes with Windows.</p> <p>I don't have any suggestio...
<p>NTP is definitely the way to go. Basically fire-and-forget, as long as you let it out the firewall on your local master (which is typically the firewall or router machine.)</p>
12,332
<p>I have a library A, that I develop. When I deploy it on a machine, the corresponding <em>libA.so</em> and <em>libA-X.Y.Z.so</em> are put in /usr/lib (X.Y.Z being the version number). </p> <p>Now I develop a library B, which uses A. When I link B, I use the flag -lA. Then "<em>ldd libB.so</em>" gives me : </p> <pre...
<p>When you create libA.so, pass the -soname option to the linker (if you linking through gcc, use -Wl,-soname). Then, when B gets linked, the linker refers to A through its soname, not through its filename. On the target system, make sure you have a link from the soname to the real file. See</p> <p><a href="http://ww...
<p>This also works in Windows as "DLL hell" :).</p> <p>If B needs a specific version of A and you would link to libA not libA-X.Y.Z then only substituting libA with newer version might cause B not to load or crash.</p> <p>But of course you can do a symlink from libA-X.Y.Z to libA-X1.Y1.Z1. If no APIs changed and only...
31,499
<p>I've been trying to implement a C#-like event system in C++ with the tr1 function templates used to store a function that handles the event. </p> <p>I created a vector so that multiple listeners can be attached to this event, i.e.:</p> <pre><code>vector&lt; function&lt;void (int)&gt; &gt; listenerList; </code></p...
<p>I don't know if you're locked into std C++ and tr1, but if you aren't, it seems like your problem could be completely avoided if you just used something like boost::signal and boost::bind to solve your original problem - creating an event system - instead of trying to roll your own.</p>
<p>If you are storing function pointers only (and not other functors that match the signature required), this is easy (see code below). But in general, the answer, like other posters have said, is no. In that case, you probably want to store your functors in a hash, as values, with keys being something the user supplie...
11,500
<p>I am getting a web host and i have projects with teammats. I thought it be a nice idea to have my own paste site that has no expiry date on paste (i know <a href="http://pastie.org/" rel="nofollow noreferrer">http://pastie.org/</a> exist) and other things. i wanted to know. Whats a simple highlight lib i can use on...
<p>The question is tagged "php" but you "would be only using C/C++"?</p> <p>A PHP solution is <a href="http://qbnz.com/highlighter/" rel="nofollow noreferrer">GeSHi</a>.</p>
<p>Building a highlighter for only one language (context free, with regular lexemes such as C++) is actually pretty easy because you basically can wrap all your lexemes into one big regular expression:</p> <pre><code>$cpplex = '/ (?&lt;string&gt;"(?:\\\\"|.)*?")| (?&lt;char&gt;\'(?:\\\\\'|.)*?\')| (?&lt;co...
38,636
<p>I'd like to yank a line in a register: <code>"{register}y</code> but without overwriting what was previously in the register. I often need to copy non-contiguous lines in a register, and I'd like to use sometimes the registers like a stack.</p> <p>Example:</p> <pre><code>line1 line2 line3 </code></pre> <p>I want ...
<p>If you want to append to a named register use it's corresponding upper case character. i.e. In your example:</p> <pre> "ayy "Ayy "ap </pre>
<p>Just to expand on MarkB's response, did you know you can also use markers to select a block of text for your yank?</p> <p>Go to the first line of the block you want to yank and enter the mark command after selecting a letter as the marker, e.g.</p> <pre><code>ma (entered in command mode, i.e. no colon) </code></pre...
49,844
<p>Plone is very complex. <a href="http://en.wikipedia.org/wiki/Zope" rel="nofollow noreferrer">Zope</a>2, <a href="http://en.wikipedia.org/wiki/Zope_3" rel="nofollow noreferrer">Zope3</a>, <a href="http://codespeak.net/z3/five/" rel="nofollow noreferrer">Five</a>, <a href="http://wiki.zope.org/zope3/ZCML" rel="nofollo...
<p>If you want to see the complexity of Plone, you have to ask for it. For most people, it's just not there. It installs in a couple of minutes through a one-click installer. Then it's one click to log in, one click to create a page, use a WYSYWIG editor, and one click to save. Everything is through an intuitive web GU...
<p>Accretion.</p>
45,290
<p>We are planning to use the jQuery library to augment our client side JavaScript needs. </p> <p>Are there any major issues in trying to use both ASP.Net AJAX and jQuery? Both libraries seem to use $ for special purposes. Are there any conflicts that we need to be aware of? </p> <p>We also use Telerik controls that ...
<p>We have used ASP.NET Ajax, jQuery and Telerik components on a large project for quite a while and haven't had any issues</p> <p>I would definitely recommend using jQuery</p>
<p>I have been using ext which is another javascript framework with .net. It is far easier to use than old fashioned HTML form controls</p> <pre><code>&lt;input type="text" id="whatever" /&gt; </code></pre> <p>Than using ASP.net form controls. You probably want to use the cool javascript framework form validation as ...
9,089
<p>Here's the Question: What is the best way to make sure that your requirement for Flash Version "x" on a site will properly detect presence of later-version Adobe Flash Player Version "10" (or "1y" for that matter)?</p> <p>Now here's the mystery: Why are so many sites that require Flash Player versions 8 and 9 or be...
<p>My guess is the javascript is doing string comparison, and in string land, "10" &lt; "9".</p> <p>Also, Flash10 changed their security model somewhat (breaking a tool I use called SWFUpload) so it may be related to that (see: <a href="http://benr75.com/articles/2008/11/25/swfupload-with-flash-10-fix" rel="nofollow n...
<p>My guess would be detection from string which is something like "Flash Player version X.Y" by doing something like "get the character before '.' and convert it to number." I've done this a few times myself, it's just stupid.</p>
45,124
<p>We have some COBOL programs in our financial applications which need to interact with some of our backend systems. One of the available interfaces is through a web service. Can a program written in Cobol make requests to a web service?</p>
<p><a href="http://www.microfocus.com/" rel="nofollow noreferrer">Microfocus</a> provide a tool called Enterprise Server which allows COBOL to interact with web services.</p> <p>If you have a COBOL program A and another COBOL program B and A calls B via the interface section, the tool allows you to expose B's interfac...
<p>ibm is now trying to implement a technology called embedded websphere with java. ibm belives this is the only way to give the life to mainframes.</p>
19,704
<p><a href="http://en.wikipedia.org/wiki/ICalendar" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/ICalendar</a></p> <p>I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft...
<p>I have to say that I don't use the hourly recurrence feature as really how many people have events that repeat in the same day? I could see if someone however was to schedule when they needed to take a particular medicine at recurring times throughout the day.</p> <p>I would say support full features in the applica...
<p>I use iCal in <a href="http://www.mozilla.org/projects/calendar/" rel="nofollow noreferrer">Lightning</a> (Thunderbird) and <a href="http://www.rainlendar.net/cms/index.php" rel="nofollow noreferrer">Rainlendar</a>.</p> <p>I have used Calendaring software for years (decades) and have never had a need for repeating ...
2,813
<p>When and how should table stats gathering be performed for Oracle, version 9 and up? How would you go about gathering stats for a large database, where stats gathering would collide with "business hours".</p>
<p>I don't agree that you should always rebuild your statistics after there have been lots of deletes or inserts. As ever, it depends. In a data warehouse situation, when re-building your materialized views you will be doing lots of deletes and inserts but the base structure of the data will not change.</p> <p>You onl...
<p>Make sure when using the estimate (sample_percent) that you gather at least 10 percent. Below that can yield very questionable results.</p>
5,741
<p>I am building the diagram component in JavaScript. It has two layers rendered separately: foreground and background.</p> <p>To determine the required size of the background:</p> <ol> <li>render the foreground </li> <li>measure the height of the result</li> <li>render the foreground and the background together</li...
<p>You should never, ever rely on something you just inserted into the DOM being rendered by the next line of code. All browsers will group these changes together to some degree, and it can be tricky to work out when and why.</p> <p>The best way to deal with it is to execute the second part in response to some kind of...
<p>I don't think you want parentDiv.children[0] (children is not a valid property in FF3 anyway), instead you want parentDiv.childNodes[0], but note that this includes text nodes that may have no height. You could try looping waiting for parentDiv's descendants to be rendered like so:</p> <pre> function getRenderedHei...
20,374
<p>The following code fails at runtime&hellip;</p> <pre> Dim Id As Guid = CType(e.CommandArgument, Guid) </pre> <p>It throws this exception&hellip;</p> <pre> System.InvalidCastException was unhandled by user code Specified cast is not valid </pre> <p>Why can't I cast <strong><em>e.CommandArgument</em></strong> as a...
<p>Try:</p> <pre><code>Dim DeleteId As Guid = New Guid(Convert.ToString(e.CommandArgument)) </code></pre> <p>This works...</p> <pre> Dim DeleteId As Guid = New Guid(DirectCast(e.CommandArgument, String)) </pre>
<p>The message "cast is not valid" suggests that the datatype for one of the values does not match what's in the database. Can you put a breakpoint on the line where the value of DeleteId is set and see what the Guid looks like? Then, you can compare it with what you see in the database for DogId. I suspect that you wi...
31,788
<p>In .NET (VB), how can I take all of the items in one collection, and add them to a second collection (without losing pre-existing items in the second collection)? I'm looking for something a little more efficient than this:</p> <pre><code>For Each item As Host In hostCollection1 hostCollection2.Add(item) Next <...
<p>You can use AddRange: <code>hostCollection2.AddRange(hostCollection1)</code>.</p>
<p><code>Array.Copy</code> may solve your problem.</p>
17,746
<p>I have not had to mess with mailto links much. However I now need to add a link in the body of a mailto if it is possible. </p> <p>Is there a way to add a link or to change the email opened to an html email vs a text email?</p> <p>Something like:</p> <pre><code>&lt;a href="mailto:test@test.test?body=The message...
<p>Section 2 of <a href="https://www.rfc-editor.org/rfc/rfc2368" rel="noreferrer" title="RFC 2368">RFC 2368</a> says that the <code>body</code> field is supposed to be in <code>text/plain</code> format, so you can't do HTML.</p> <p>However even if you use plain text it's possible that some modern mail clients would ren...
<p>Here's what I put together. It works on the select mobile device I needed it for, but I'm not sure how universal the solution is </p> <pre><code>&lt;a href="mailto:me@me.com?subject=Me&amp;body=%3Chtml%20xmlns%3D%22http:%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%3C%2Fhead%3E%3Cbody%3EPlease%20%3Ca%20href%3D%22http:%2F%2...
30,709
<p>I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?</p>
<p>This registry key should tell you:</p> <pre><code>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System </code></pre> <p>Value <code>EnableLUA (DWORD)</code></p> <p><code>1</code> enabled / <code>0</code> or missing disabled</p> <p>But that assumes you have the rights to read it. </p> <p>Programmatic...
<p>AFAIK, UAC is apolicy setting on the local user or group. So you can read this property from within .Net. Sorry for not having more details but I hope this helps</p>
12,107
<p>I have long since forgotten the password for the root user on one of my boxes. Is there a way I can change it without having to log in to the instance, or will I have to reinstall?</p>
<p><strong>Step 1</strong></p> <p>Stop database:</p> <pre><code>shell&gt; /etc/init.d/mysql stop </code></pre> <p><strong>Step 2</strong></p> <p>Restart database</p> <ul> <li>without password autentification</li> <li>without connection to the network</li> </ul> <p>Access to database is only possible through it's ...
<p>If you are running an Ubuntu server (possibly also Debian?) you can easily reset. </p> <p>If you are on 12.04:</p> <pre><code>sudo dpkg-reconfigure mysql-server-5.5 </code></pre> <p>If you are on 10.04:</p> <pre><code>sudo dpkg-reconfigure mysql-server-5.1 </code></pre> <p>If you are not sure which mysql-server...
7,696
<p>I'm using a PropertyGrid in a tool app to show a window to monitor an object in a remote app. Every second or so I get an update from the app with the state of any members that have changed, and I update the grid. I call Refresh() to make the changes take. This all works pretty well except one thing.</p> <p>Say the...
<p>This is not possible in the MS PropertyGrid. This component has too many unaccessible internals to give you the flexibility you are requesting and as you realized yourself it is not consistent (you have the issue for a property below the grid but not when it is above). That's why I created <a href="http://www.visual...
<p>For me the following made the difference:</p> <p>dont assign a new object.</p> <p>Simply update the fields of the old object with the new data.</p> <p>Now, on refresh, my PropertyGrid does not scroll any more, and also shows updated content.</p>
36,781
<p>I have a CIFS share mounted on a Linux machine. The CIFS server is down, or the internet connection is down, and anything that touches the CIFS mount now takes several minutes to timeout, and is unkillable while you wait. I can't even run ls in my home directory because there is a symlink pointing inside the CIFS...
<p>I use lazy unmount: <code>umount -l</code> (that's a lowercase <code>L</code>)</p> <blockquote> <p>Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)</p> </blockquote>
<p>On RHEL 6 this worked for me also:</p> <p>umount -f -a -t cifs -l FOLDER_NAME</p>
10,029
<p>How can we print using print document so that we can control the printer paper size?</p> <ul> <li>It must be controlled after web hosting is done without the print dialog popup or javascript popup. </li> <li>It should print on the client's printer after webhosting without the print dialog option and setting the pap...
<p>As a user I don't want that when I enter a site someone to change my printer's settings or to take control over my printer.</p> <p>For security reasons I hope this is not possible.</p>
<p>I have looked into this before, and the only way to force things like portrait/landscape etc, is to get the user to install an ActiveX control (or similar).</p> <p>Javascript or CSS alone cannot do it.</p>
40,974
<p>I'm writing an application that will need to open up browser windows (probably can stick to IE) to websites that use Forms Authentication. The trick is that they need to be authenticated already, in order to save time due to the sheer number of sites we need to get into. (Eventually I'll be screen scraping them an...
<p>I don't think you're going to be able to do this. The browser is going to ignore any "Add-Cookie" headers from a web server that does not belong to the domain associated with the cookies. This is part of the built-in security for cookies - it would be catastrophic (from a security and privacy perspective) if other...
<p>I think the browser may be ignoring the cookies in the response header because of the impending Response.Redirect. We ran into that issue recently, and discovered that FF accepted the cookies, but IE6&amp;7 did not.</p> <p>I'm not sure I understand exactly what you're trying to do, though. Are you attempting to s...
43,557
<p>When I hit /// in Visual Studio, is it possible to change the resulting snippet from this:</p> <pre><code>/// &lt;summary&gt; /// /// &lt;/summary&gt; </code></pre> <p>to this?:</p> <pre><code>/// &lt;summary&gt;&lt;/summary&gt; </code></pre>
<p>Here is the solution working in at least VS2010.</p> <p>Save the bottom code as a file summ.snippet.<br> Visual Studio 2010 / Tools / Code Snippet Manager<br> Click import, browse to file. Save with default options.</p> <p>Now goto your code window and type summ + tab + tab</p> <p>Result</p> <pre><code>/// &lt;s...
<p>I know that it was possible for VB in VS 2005 and VS 2008. Last I had checked, though, there was not a way to do it for C#, sadly. That has been a pet peeve of mine for some time, now.</p>
48,202
<p>The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? The SqlConnection class has a 'Open' member which tries to open the database you'd set in the Databa...
<p>Connect to temp db. Everybody has accecss to tempdb so you will be able to authenticate yourself for access. Later when you know the actual database , you can change this property to connect to the db you want.</p>
<p>I don't know whether you got your answers but as we all look here for answers I hope this is what you were looking for</p> <pre><code>dim con as new sqlconnection con.connectionstring="&lt;&lt;put your conn string here&gt;&gt;" 'try...catch block fires exception if the con is not successfully opened try con.open() ...
18,671
<p>Now that .NET v3.5 SP1 has been released (along with VS2008 SP1), we now have access to the .NET entity framework.</p> <p>My question is this. When trying to decide between using the Entity Framework and LINQ to SQL as an ORM, what's the difference?</p> <p>The way I understand it, the Entity Framework (when used ...
<p>LINQ to SQL only supports 1 to 1 mapping of database tables, views, sprocs and functions available in Microsoft SQL Server. It's a great API to use for quick data access construction to relatively well designed SQL Server databases. LINQ2SQL was first released with C# 3.0 and .Net Framework 3.5.</p> <p>LINQ to En...
<blockquote> <p>Linq-to-SQL</p> </blockquote> <p><em>It is provider it supports SQL Server only. It's a mapping technology to map SQL Server database tables to .NET objects. Is Microsoft's first attempt at an ORM - Object-Relational Mapper.</em></p> <blockquote> <p>Linq-to-Entities</p> </blockquote> <p><em>Is th...
3,013
<p>Is Software Testing really given its importance at the academic level?</p> <p>I believe there is a need in universities offering Software Engineering (and probably even Computer Science) to treat <strong>Software Testing</strong> as a separate course and topic in itself, rather than as part of a general topic of So...
<p>Yes, it probably should be given more consideration, and at some places it is. As a part of the new curriculum at the university I attended all programming projects are required to include test cases. There's no way to enforce a particular methodology, like TDD, but I think this is a step in the right direction.</...
<p>Yes, absolutely.</p>
32,418
<p>Is there any reason to use a varchar field instead of a date field in MySQL? I'm looking at an existing site and I see the developer has done this. Is there any reason to?</p>
<p>Unless it really <em>is</em> acting primarily as a string — say, it wants to preserve date formatting style, locale-named months, named timezones etc. and doesn't care about being computable — no, varchar would not be a good choice.</p> <p>Handling real date datatypes can be problematic/non-portable across differen...
<p>I've seen lots of "Developer turned DBA" type people completely misuse database types, just chock it up to inexperience.</p>
35,805
<p>Let's say I have a simple stored procedure that looks like this (note: this is just an example, not a practical procedure):</p> <pre><code>CREATE PROCEDURE incrementCounter AS DECLARE @current int SET @current = (select CounterColumn from MyTable) + 1 UPDATE MyTable SET CounterColumn = current GO </code><...
<p>This is for SQL Server.</p> <p>Each statement is atomic, but if you want the stored procedure to be atomic (or any sequence of statements in general), you need to explicitly surround the statements with </p> <p>BEGIN TRANSACTION<br> Statement ...<br> Statement ...<br> COMMIT TRANSACTION</p> <p>(It's common to us...
<p>Maybe I'm reading too much into your example (and your real situation may be significantly more complicated), but why wouldn't you just do this in a single statement?</p> <pre><code>CREATE PROCEDURE incrementCounter AS UPDATE MyTable SET CounterColumn = CounterColumn + 1 GO </code></pre> <p>That way, it'...
32,465
<p>We're in the process of replacing a legacy system. There is going to be a period of time with both the applications running in tandem. Users will be able to use either system and the challenge is to be able to keep their databases in sync with each other.</p> <p>The new system is ASP.NET and the legacy is VB6. B...
<p>2 seconds, that is a really tight timeline, and I'm guessing that your windows app solution just might not cut it, not if there are hundreds of changes or anything at one time, and the poll time has to be almost every second to hope to make it within 2.</p> <p>Are the databases using the same structure? If so, I'd...
<p>Personally I would reject the idea of users using either system simulataneously. How are you going to resolve the issue if user 1 changed record 1 on system 1 and user 2 changed record 1 in a different way on system 2?</p> <p>Further, if you don't require people to use the new system, they won't. Resistance to cha...
34,304
<p>I have a Publishing Portal site and I need to add some announcements to some of the pages. I've read an article which says that i have to create an announcement list to be able add an announcement web part but i can't seem to find any resources on how i can add an announcement list.</p> <p>Any help will be greatly...
<p>From the home page of your site (or from any page really) you should see a "View All Site Content" link on the top of the navigation menu.</p> <p><a href="http://friendfeed.s3.amazonaws.com/86fed07f0809beefaeeaee0013ee2b952079bc09" rel="nofollow noreferrer">View All Site Content http://friendfeed.s3.amazonaws.com/8...
<p>Giving you direct instructions on how to create the list would most likely leave you more lost than ever. If this is a publishing portal, there's a lot more to learn beyond just creating a list. Content must be approved, and is versioned. I'd strongy advise you not to start poking around in there as you run a large ...
15,563
<p>If a customer sends me a non-commercial 3D model to print, am I allowed to charge money for the 3D printing process? I understand I cannot charge anything for the model nor offer it as a part of my business.</p> <p>I cannot download the model myself, print and sell it, but if the customer downloads it and sends it ...
<p><em>I would have liked to answer linking to credible official sources, but I cannot add references either on direct B-spline printing. So I'm writing down my thoughts. I've familiarized myself in B-splines to understand what they are and read into the 2 references given by the OP.</em></p> <hr /> <p>Basically, the p...
<p>In more practical terms, you could design the part so that the corners are rounded (also known as fillets). This will help keep the print head moving and would prevent the sudden stop and start effect that causes "jerking". Further 8 bit controllers tend to get saturated when reading large amounts of g-code from the...
1,402
<p>I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer?</p> <p>PS - before you downmod this for not being a programming question, I'm looking for the program to...
<p><code>netstat -b -a</code> lists the ports in use and gives you the executable that's using each one. I believe you need to be in the administrator group to do this, and I don't know what security implications there are on Vista.</p> <p>I usually add <code>-n</code> as well to make it a little faster, but adding <c...
<p>most decent firewall programs should allow you to access this information. I know that Agnitum OutpostPro Firewall does.</p>
13,091
<p>I just figured out that I can actually <strong>store objects in the $_SESSION</strong> and I find it quite cool because when I jump to another page I still have my object. Now before I start using this approach I would like to find out if it is really such a good idea or if there are <strong>potential pitfalls</stro...
<p>I know this topic is old, but this issue keeps coming up and has not been addressed to my satisfaction:</p> <p>Whether you save objects in $_SESSION, or reconstruct them whole cloth based on data stashed in hidden form fields, or re-query them from the DB each time, you are using state. HTTP is stateless (more or ...
<p>I would also bring up when upgrading software libraries - we upgraded our software and the old version had objects in session with the V1 software's class names, the new software was crashing when it tried to build the objects that were in the session - as the V2 software didn't use those same classes anymore, it co...
16,027
<p>When using JDBC, I often come across constructs like </p> <pre><code>ResultSet rs = ps.executeQuery(); while (rs.next()) { int id = rs.getInt(1); // Some other actions } </code></pre> <p>I asked myself (and authors of code too) why not to use labels for retrieving column values: </p> <pre><code>int id =...
<p>You should use <strong>string labels by default.</strong></p> <p><strong>Pros:</strong></p> <ul> <li>Independence of column order</li> <li>Better readability/maintainability</li> </ul> <p><strong>Cons:</strong></p> <ul> <li>You have no control over the column names (access via stored procedures)</li> </ul> <p><...
<p>I agree with previous answers that performance is not something that can force us to select either of the approaches. It would be good to consider the following things instead:</p> <ul> <li>Code readability: for every developer reading your code labels have much more sense than indexes.</li> <li>Maintenance: think ...
22,608
<p>I am using the jQuery Datepicker widget with two input boxes, one for the <strong>"From"</strong> date and the second with the <strong>"To"</strong> date. I am using the <a href="http://jqueryui.com/datepicker/" rel="noreferrer">jQuery Datepicker functional demo</a> as a basis for getting the two input boxes to work...
<p>Many thanks for your help Ben, I have built upon your posts and have come up with this. It is now complete and works brilliantly!</p> <p>Here's a <strong><a href="http://jsbin.com/evudo" rel="noreferrer">Working Demo</a></strong>. Add <strong>/edit</strong> to the URL to see the code</p> <p>Complete Code below-</p...
<p>This is how I have done it. I have taken the source from the Jquery UI website and modified it to add your constraints.</p> <pre><code>$(document).ready(function () { var dates = $('#StartDate, #EndDate').datepicker({ minDate: new Date(2008, 11, 1), maxDate: "+0D", dateFormat: "dd M...
42,846
<p>A program that I work on assumes that the UUID generated by the Windows RPC API call UuidCreateSequential() contains the MAC address of the primary ethernet adapter. Is this assumption correct or should I use a different method to get the MAC address?</p>
<p>I wouldn't rely on this - the only reason that UuidCreateSequential has the MAC address is it's trying to guarantee that the UUID is unique across the network. Plus, why would you use such a weird way to get a MAC address? Use WMI and <em>actually</em> ask for the MAC address instead of a side-effect of a UUID creat...
<p>Only a version 1 UUID contains a MAC address, and only if the original generator had access to the MAC address to begin with. If the original generator didn't have access to a MAC address, it would have used 6 random bytes sourced from a cryptographically secure random number generator, as per section 4.5 of RFC 41...
42,740
<p>We recently switched some of our sites from deflate to gzip and noticed a significant increase in cpu load on our servers.</p>
<p>Is it possible that you are experiencing cache miss? That is, compressed content is sometimes cached compressed but switching compression schemes would (or at least should) invalidate that cache causing dramatically increased cpu utilization. Did you try switching it back?</p>
<p>gzip is, basically, deflate with some additional headers. So there should not be a significant performance hit. Now, maybe your deflate tool is just more efficient than your gzip tool. Are you using the same tool for both compressions or two different ones?</p>
25,956
<p>How can I drop all tables whose names begin with a given string? </p> <p>I think this can be done with some dynamic SQL and the <code>INFORMATION_SCHEMA</code> tables.</p>
<p>You may need to modify the query to include the owner if there's more than one in the database.</p> <pre class="lang-sql prettyprint-override"><code>DECLARE @cmd varchar(4000) DECLARE cmds CURSOR FOR SELECT 'drop table [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'prefix%' OPEN cmds...
<p>Try following code:</p> <pre><code>declare @TableLst table(TblNames nvarchar(500)) insert into @TableLst (TblNames) SELECT 'DROP TABLE [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'yourFilter%' WHILE ((select COUNT(*) as CntTables from @TableLst) &gt; 0) BEGIN declare @ForExecCms nv...
2,640
<p>The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). </p> <p>Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens...
<p>I use this function adapted from codesta. [Edit: the very same one, I see, that scares you! Oops. Can't help you then.]</p> <p><a href="http://blog.codesta.com/codesta_weblog/2007/12/net-gotchas---p.html" rel="nofollow noreferrer">http://blog.codesta.com/codesta_weblog/2007/12/net-gotchas---p.html</a>.</p> <p>Y...
<p>For this particular issue, the reason is because javascript generated by ASP.NET 2.0 has some IE only notation: event.srcElement is not availabe in FireFox (use event.target instead):</p> <pre><code>function WebForm_FireDefaultButton(event, target) { if (!__defaultFired &amp;&amp; event.keyCode == 13 &amp;&amp; !...
7,264
<p>The error I'm getting:</p> <pre><code>in /Users/robert/Documents/funWithFrameworks/build/Debug-iphonesimulator/funWithFrameworks.framework/funWithFrameworks, can't link with a main executable </code></pre> <p>Cliff notes:</p> <ul> <li>trying to include framework</li> <li>doesn't want to link</li> </ul> <p>More d...
<p>Apple clearly said that you can <strong>not</strong> use dynamic libraries on their mobiles. And a private framework is just this.</p> <p>You can, however, use static libraries.</p>
<p>I haven't tried it for so called <em>mobile device</em>, but I would guess its very similar to the method for a regular Cocoa application. Check out this tutorial:</p> <p><a href="http://rentzsch.com/cocoa/embeddedFrameworks" rel="nofollow noreferrer">Embedded Cocoa Frameworks</a></p>
10,385
<p>Any one has any idea how to map an infopath field to a sharepoint column of type choice? The infopath field is a repeating field, so the user can select multiple options, I want to be able to map those to the choice field in sharepoint. Any ideas?</p> <p>update: What I'm trying to do is the following. I have a choi...
<p>SharePoint list is a flat structure, and because of that Infopath does not allow you map repeating sections to list columns. </p> <p>You might wanna consider the following workaround:</p> <ul> <li>Store Infopath form to one library (along with non-repeating fields)</li> <li>Use one of <a href="http://www.codeplex....
<p>Is it not similar to Create a Repeating Cascading List from:</p> <ul> <li><a href="http://www.infopathdev.com/blogs/greg/archive/2005/07/14/Create-a-Repeating-Cascading-List-from-a-Flat-Data-Source.aspx" rel="nofollow noreferrer">a Flat Data Source</a> or</li> <li><a href="http://www.infopathdev.com/blogs/greg/arch...
46,765
<p>I want to assign the decimal variable &quot;trans&quot; to the double variable &quot;this.Opacity&quot;.</p> <pre class="lang-cs prettyprint-override"><code>decimal trans = trackBar1.Value / 5000; this.Opacity = trans; </code></pre> <p>When I build the app it gives the following error:</p> <blockquote> <p>Cannot imp...
<p>An explicit cast to <code>double</code> like this isn't necessary:</p> <pre><code>double trans = (double) trackBar1.Value / 5000.0; </code></pre> <p>Identifying the constant as <code>5000.0</code> (or as <code>5000d</code>) is sufficient:</p> <pre><code>double trans = trackBar1.Value / 5000.0; double trans = trac...
<p><strong>Try the following code:</strong></p> <h3>Decimal values</h3> <pre><code>decimal d1 = 3234.3434m; </code></pre> <h3>Convert to double</h3> <pre><code>double r1 = Decimal.ToDouble(d1); </code></pre>
2,230
<p>How to wait for multiple child processes in Python on Windows, without active wait (polling)? Something like this <em>almost</em> works for me:</p> <pre><code>proc1 = subprocess.Popen(['python','mytest.py']) proc2 = subprocess.Popen(['python','mytest.py']) proc1.wait() print "1 finished" proc2.wait() print "2 f...
<p>It might seem overkill, but, here it goes:</p> <pre><code>import Queue, thread, subprocess results= Queue.Queue() def process_waiter(popen, description, que): try: popen.wait() finally: que.put( (description, popen.returncode) ) process_count= 0 proc1= subprocess.Popen( ['python', 'mytest.py'] ) thread.st...
<p>you can use <a href="https://psutil.readthedocs.io/en/latest/" rel="nofollow noreferrer">psutil</a></p> <pre><code>import psutil with psutil.Popen([&quot;python&quot;, &quot;mytest.py&quot;]) as proc1, psutil.Popen( [&quot;python&quot;, &quot;mytest.py&quot;] ) as proc2: gone, alive = psutil.wait_procs([pro...
12,589
<p>We're building a text templating engine out of a custom HttpModule that replaces tags in our HTML with whole sections of text from an XML file.</p> <p>Currently the XML file is loaded into memory as a string/string Dictionary so that the lookup/replace done by the HttpModule can be performed very quickly using a re...
<p>The amount of memory you are using is going to be roughly the same as the size of the file. The XML will have some overhead in the tags that the Dictionary will not, so it's a safe estimate of the memory requirements. So are you talking about 10-50 MB or 100-500 MB? I wouldn't necessarily worry about 10 to 50 MB....
<p>A couple ideas:</p> <p>Compress your dictionary values. Check out Scott Hanselman's <a href="http://www.hanselman.com/blog/TheWeeklySourceCode35ZipCompressingASPNETSessionAndCacheState.aspx" rel="nofollow noreferrer">cache compressing article</a> to get the spirit of the exercise. If your dictionary keys are large,...
35,067
<p>I'm developing an MFC application and I've recently been searching for a good method to remove the icon from a Windows title bar, but retain the close button. The two obvious candidate solutions are turning off the system menu style or using the tool window style, but I would prefer not to disable the system menu or...
<p>You can use <code>WM_NCRBUTTONDOWN</code> to detect if the user has right-clicked on your caption and then bring up the system menu.</p>
<p>what about getting rid of the system menu and then putting it back in another place yourseld (say next to the close button etc.)?</p>
3,132
<p>I have spent ages debugging this problem but I can't figure out what I am doing wrong.</p> <p>I have a Wanhao duplicator i3 (Prusa i3 clone) and until recently I used Wanhao's adapted version of the Cura slicer. But it's quite an old Cura version and I wanted to make use of the improved supports in the new Cura.</p...
<p>This problem is most commonly caused by infill speeds which are too high.</p> <p>Instead of printing lines, the filament is caught on one of the lines of the previous layer, leaves a blob there and only restarts extrusion when it hits the next line. Instead of extruding continuously the filament comes out in blobs ...
<p>I am using the same printer (v1.2) with some upgrades and have been using the latest Ultimaker Cura (4.1) ever since they came out. For the first few prints I used an imported Ultimaker Cura profile, but after 3-4 bad prints I created a new profile from scratch, using a percentage for infill, with no problems at all...
637
<p>I have come across a lot of optimization tips which say that you should mark your classes as sealed to get extra performance benefits.</p> <p>I ran some tests to check the performance differential and found none. Am I doing something wrong? Am I missing the case where sealed classes will give better results?</p> <...
<p>The JITter will sometimes use non-virtual calls to methods in sealed classes since there is no way they can be extended further.</p> <p>There are complex rules regarding calling type, virtual/nonvirtual, and I don't know them all so I can't really outline them for you, but if you google for sealed classes and virtu...
<p>Run this code and you'll see that sealed classes are 2 times faster:</p> <pre><code>class Program { static void Main(string[] args) { Console.ReadLine(); var watch = new Stopwatch(); watch.Start(); for (int i = 0; i &lt; 10000000; i++) { new SealedClass()...
2,432
<p>What are the advantages and disadvantages of the Session Façade Core J2EE Pattern? </p> <p>What are the assumptions behind it? </p> <p>Are these assumptions valid in a particular environment? </p>
<p>Session Facade is a fantastic pattern - it is really a specific version of the Business Facade pattern. The idea is to tie up business functionality into discrete bundles - such as TransferMoney(), Withdraw(), Deposit()... So that your UI code is accessing things in terms of business operations instead of low leve...
<p>The main advantage of the Session Facade pattern is that you can divide up a J2EE application into logical groups by business functionality. A Session Facade will be called by a POJO from the UI (i.e. a Business Delegate), and have references to appropriate Data Access Objects. E.g. a PersonSessionFacade would be ca...
11,449
<p>I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed a JDBC SQLite driver from <a href="http://www.zentus.com/sqlitejdbc/" rel="nofollow noreferrer">zentus.com</a> and added a new driver in Nebeans services panel. Then tried to connect to my database file from Services > Databases using this URL fo...
<p>The current version of Zentus SQLiteJDBC is v053, based on SQLite 3.6.1. It will not open a 2.x SQLite database. Perhaps you can use SQLite 2.x command line tool to .dump your database, and the Sqlite3 command line tool to .load it. The use Zentus SQLiteJDBC to access the new SQLite 3.x database.</p> <p>Alternative...
<p>It's againg me...</p> <p>I have made two mistakes during my first attempt. After setting <code>CLASSPATH</code> as a system variable (hope I didn’t broke smth else :)), putting <code>sqlite_jni.dll</code> to the <code>system32</code> folder and correcting <code>JDBC url</code> I have got a success :)</p> <p>I also...
42,587
<p>I am wondering if it would it be feasible (at an affordable price) to 3D print a boat hull (small dimensions, maybe something like 60x40x20 cm). </p> <p>I am mostly concerned about: </p> <ul> <li><strong>durability</strong> (against salty water, UV rays, extreme temperatures (under the sun or in a cold ocean)</l...
<p>You will really need to specify your constraints better because the short answer is <strong>yes, what you describe <em>is</em> entirely possible</strong>, but without knowing whether you are limited to a particular budget, process, or aesthetic, it's not a particularly useful answer.</p> <p>Some machines (ex. Strat...
<p>Probably feasible, Affordable or simple probably not. To start from an affordability perspective, kayaks normally weigh around 20 kg, they <a href="http://www.grassrootsengineering.com/blog/2014/03/" rel="nofollow noreferrer">kayak in the video mentioned in the other answer</a> weighs in at 30kgs. Assuming you print...
508
<p>I'm looking for a basic software for statistical analysis. Most important is simple and intuitive use, getting started "right out of the box". At least basic operations should be interactive. Free would be a bonus :) </p> <p>The purpose is analysis of data dumps and logs of various processes. </p> <ul> <li>Importi...
<p>Specifically for Log file analysis I would recommend <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en" rel="nofollow noreferrer">Microsoft's Log Parser</a>(free), which will allow you to run queries with basic aggregation against all types of t...
<p>I used <a href="http://www.tableausoftware.com/" rel="nofollow noreferrer">Tableau Software</a> at a previous gig, and it's pretty amazing - extremely intuitive and easy to use.</p> <p>Unfortunately it's also pricey.</p>
36,939
<p>When I run <code>get-user|get-member</code> in powershell with the exchange add-in I noticed there is no description property.</p> <p>Does anyone know if it has been renamed to something else or another way of accessing it? </p>
<p>If you aren't looking to change the description this should work:</p> <pre><code>[PS] C:\&gt;$ANR = "testuser@example.com" [PS] C:\&gt;$foo = [adsi]("LDAP://" + (get-user $ANR).DistinguishedName) [PS] C:\&gt;$foo.description My Description </code></pre> <p>If you are wanting to edit, you will need to get further i...
<p>get-user? do you mean get-qaduser from the quest cmdlet suite?</p> <p>if so, I believe not all properties are retrieved by default. There's an -Include parameter that lets you specify additional properties to retrieve from AD, IIRC.</p>
43,360
<p>I would like to provide the raw text referring to an environment variable to a command instead of evaluating the environment variable.</p> <p>I need this to configure BizTalk from the command line, for example:</p> <p>BTSTask.exe AddResource -ApplicationName:App1 -Type:System.BizTalk:BizTalkAssembly -Overwrite -...
<p>Did you try:</p> <pre><code>%%BTAD_InstallDir%% </code></pre> <p>in your script ?</p> <p>That should prevent the script to interpret the variable, and it would pass <code>%BTAD_InstallDir%</code> to the program.</p>
<p>Not sure if it's the same as my case, but i was troubling to use a batch file to create a script which has %temp% variable inside. The workaround i found: set test=%temp; echo {command} %test%%>>path_to_my_batch_file; Hope this helps someone:)</p>
41,867
<p>I'm looking for a groovy equivalent on .NET <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">http://boo.codehaus.org/</a></p> <p>So far Boo looks interesting, but it is statically typed, yet does include some of the metaprogramming features I'd be looking for.</p> <p>Can anyone comment on the experienc...
<p>Information on this topic is now available on Wikipedia at: <a href="http://en.wikipedia.org/wiki/Search_data_structure" rel="noreferrer">Search data structure</a></p> <pre><code>+----------------------+----------+------------+----------+--------------+ | | Insert | Delete | Search | Sp...
<p>Amortized Big-O for hashtables:</p> <ul> <li>Insert - O(1)</li> <li>Retrieve - O(1)</li> <li>Delete - O(1)</li> </ul> <p>Note that there is a constant factor for the hashing algorithm, and the amortization means that actual measured performance may vary dramatically.</p>
14,942
<p>I've been thinking about alternatives to support materials for FDM printers, such as multi axis printers, dual head with soluble support material or printing in a gel/liquid which traps the material in place. Then it occurred to me that it might be possible to use the surface tension of a liquid to act as support ma...
<h1>It's not feasible as described with normal FDM technology.</h1> <p>FDM bases on depositing material in a single path. This needs the deposited material to stay at the same XY coordinates for subsequent paths. And exactly here is where a floating piece fails: a free-floating piece is by its very definition unrestric...
<p>I just had the same idea and googled it. My idea was to submerge the whole print platform in the water and lower it down so that the water level and the current layer line are always at the same height. Maybe a pump would be required to counteract the plastic displacing water. Completely floating parts of the print ...
1,536
<p>Here are the errors:</p> <pre> $ perl ftper.pl Use of uninitialized value $id in hash element at /usr/lib/perl5/vendor_perl/5.1 /i686-cygwin/Tk/After.pm line 39. se of uninitialized value $id in hash element at /usr/lib/perl5/vendor_perl/5.1 /i686-cygwin/Tk/After.pm line 39. se of uninitialized value $id in hash el...
<p>The error messages themselves are straightforward enough:</p> <blockquote> <p>Use of uninitialized value $id in hash element at ...Tk/After.pm line 39.</p> <p>Use of uninitialized value $id in delete at ...Tk/After.pm line 87.</p> </blockquote> <ul> <li>&quot;Use of uninitialized value&quot; means that you used a va...
<p>I'm seeing the same issue with v5.10.0 and 804.028-1 on x86 Cygwin. Interestingly, the problem does not appear if the code is executed in the debugger, suggesting a difference in the way code is compiled/executed/??? inside and outside of the debugger.</p> <p>I suspect the underlying PerlTk code to be correct and t...
41,211
<p>I've been looking around for a good MVC framework for Python using PyGTK. I've looked at <a href="http://www.async.com.br/projects/kiwi/" rel="nofollow noreferrer">Kiwi</a> but found it a bit lacking, especially with using the Gazpacho Glade-replacement.</p> <p>Are there any other nice desktop Python MVC frameworks...
<p>In defense of Kiwi:</p> <ul> <li>Kiwi works fine with Glade3 instead of Gazpacho. (who forced you to use Gazpacho?)</li> <li>Kiwi is my first dependency for <em>any</em> PyGTK application commercial or open source.</li> <li>Kiwi is very actively maintained.</li> </ul> <p>I have generally got to a stage where I thi...
<p>PureMVC</p> <p><a href="http://trac.puremvc.org/PureMVC_Python" rel="nofollow noreferrer">http://trac.puremvc.org/PureMVC_Python</a></p>
40,060
<p>So I've got a <code>JPanel</code> implementing <code>MouseListener</code> and <code>MouseMotionListener</code>:</p> <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DisplayArea extends JPanel implements MouseListener, MouseMotionListener { public DisplayArea(Rectangle ...
<p>The <em>implements mouselistener, mousemotionlistener</em> just allows the displayArea class to listen to some, to be defined, Swing component's mouse events. You have to explicitly define what it should be listening at. So I suppose you could add something like this to the constructor:</p> <pre><code>this.addMouse...
<p>I don't see anywhere in the code where you call addMouseListener(this) or addMouseMotionListener(this) for the DisplayArea in order for it to subscribe to those events. </p>
5,377
<p>I want to get other process' argv like ps.</p> <p>I'm using Mac OS X 10.4.11 running on Intel or PowerPC.</p> <p>First, I read code of ps and man kvm, then I wrote some C code.</p> <pre><code>#include &lt;kvm.h&gt; #include &lt;fcntl.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;sys/sysctl...
<p>Have you <a href="http://hubpages.com/hub/Interop_Forms_Toolkit_10" rel="nofollow noreferrer">looked at this?</a> Direct Link to <a href="http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx" rel="nofollow noreferrer">Product here</a></p>
<p>You do not need any third party tools out anything outside of what comes with Visual Studio if you mainly just want your VB6 program to cause a .NET Winform to be displayed.</p> <p>The approach we have taken here is to expose a C# wrapper class to VB6 by giving it a COM interface. This class has a few methods which...
25,824
<p>In a nutshell: I want to do the same thing "Dependency Walker" does.</p> <p>Is there any Win32 API function which can enumerate the dependencies of a EXE and/or DLL file?</p> <p>And is there any safe way to detect dependencies on ActiveX classes? (I doubt it is possible, but who knows ...)</p> <p><strong>EDIT:</s...
<p>It seems that Dependency Walker source code itself was given by Microsoft via MSJ. Please look at <em><a href="http://www.mail-archive.com/delphi@delphi.org.nz/msg11397.html" rel="nofollow noreferrer">Re: [DUG]: Dependency Walker</a></em>.</p> <p>You need to refer some other site to download since the link given i...
<p>You can write a console app to wrap this up, create a PowerShell script with it or, like I usually end up doing since I only have to do it once in a blue moon, add the following to your code for a quick check:</p> <pre><code> private static HashSet&lt;string&gt; ReferencedAssemblies = new HashSet&lt;string&gt;()...
47,325
<p>I have an actionscript 2 application that I'd like to write automated UI testing for. For example I'd like to simulate a mouse click on a button and validate that a movie-clip is displayed at the right position and in the right color... Basically, UI testing. What are the best tools available or what is the desired ...
<p>I know this is an old question, but this could be useful for future reference. There is a relatively new project</p> <p><a href="https://sourceforge.net/adobe/genie/wiki/Home/" rel="nofollow">Automated UI tester for ActionScript</a></p> <p>Its installation is pretty simple, and is described in the user guide step ...
<p>This may be of use</p> <p><a href="http://osflash.org/autotestflash" rel="nofollow noreferrer">Flash UI testing</a></p>
15,396
<p>It seems that nginx is used with php, ruby and python. </p> <p>Anyone has an example of how to setup nginx to work with jetty/tomcat in backend? </p> <p>Thanks.</p>
<p>nginx can forward via HTTP protocol, so just point it to the correct port and you're set:</p> <pre><code>server { location /anything { proxy_pass http://localhost:8080/whatever; } } </code></pre>
<p>nginx can forward via HTTP protocol, so just point it to the correct port and you're set:</p> <pre><code>server { location /anything { proxy_pass http://localhost:8080/whatever; } } </code></pre>
33,472
<p>I'm trying to run a c++ 2d array (pretty simple file) and it works but an error (at least I think it's an error) appears on the end.</p> <p>The code for the array is;</p> <pre><code>int myArray[10][10]; for (int i = 0; i &lt;= 9; ++i){ for (int t = 0; t &lt;=9; ++t){ myArray[i][t] = i+t; //This will ...
<p>The error is not in the code you posted. do you have another cout afterwards?</p> <p>the 0x22.... looks like a memory address, so specifically you might have a line that reads</p> <p>cout &lt;&lt; myArray;</p> <p>somewhere.</p>
<p>The code you showed is fine so far. The address printed does not seem to be printed from that part of your code. I can imagine two situations for that.</p> <ul> <li>You accidentally print myArray[i] or myArray and forgot to apply the other index. As an array value converts to the address of its first element, it ca...
47,006
<p>Even though <a href="http://twistedmatrix.com/pipermail/twisted-python/2004-May/007896.html" rel="noreferrer">Python</a> and <a href="http://www.reddit.com/comments/6wmum/thread_safe_ruby_on_rails_in_22_release/" rel="noreferrer">Ruby</a> have one kernel thread per interpreter thread, they have a global interpreter ...
<p>I'm not totally sure which problem you want so solve, but if you deploy your python/django application via an apache prefork MPM using mod_python apache will start several worker processes for handling different requests.</p> <p>If one request needs so much resources, that you want to use multiple cores have a look...
<p>For Python, the <a href="http://pyprocessing.berlios.de/" rel="nofollow noreferrer">PyProcessing</a> project allows you to program with processes much like you would use threads. It is included in the standard library of the recently released 2.6 version as <a href="http://docs.python.org/library/multiprocessing.htm...
5,783
<p>I use VS6 and ATL with CServiceModule to implement a custom windows service. In case of a fatal error service should shut itself down. Since CServiceModule is available via _Module variable in all files I thought of something like this to cause CServiceModule::Run to stop pumping messages and shut itself down</p> <...
<p>What you describe is called writing a COM addin. You need to create an automation DLL and implement the <a href="http://msdn.microsoft.com/en-us/library/aa155640(office.10).aspx#comaddins_idtextens2" rel="noreferrer"><code>IDTExtensibility2</code></a> interface. You will then receive the Excel <code>Application</cod...
<p>I do not know much about Office, but I guess you should use COM/ActiveX. Then you also get your IDispatch. See <a href="http://delphi.about.com/od/comoleactivex/OLE_COM_DCOM_Automation_ActiveX_Delphi_knowledge_base.htm" rel="nofollow noreferrer">http://delphi.about.com/od/comoleactivex/OLE_COM_DCOM_Automation_Active...
44,737
<p>I have a connection to a Microsoft SQL Server and want the change the connection authenticated user. Is it possible to do it without closing and reopening the connection?</p> <p>The ideal is something like Oracle <a href="http://www.techonthenet.com/oracle/roles.php" rel="nofollow noreferrer">set role</a> feature. ...
<p>You might want to take a look at app roles (sp_setapprole), but you must be aware of consequences being that once the context is changed (e.g. the role is set), it can't be reverted with SQL Server 2000 (it's possible with 2005). The result of this is that the connection is effectively useless when closed in your co...
<p>Depending on what you are doing, EXECUTE AS may help you out here. This allows you to execute SQL in the context of another user in a similar fashion to the RUN AS available from the Windows shell. The profiler and audit tracing in SQL Server allows you to see both the original user and which context a statement is ...
44,847
<p>I'm using the Lengauer and Tarjan algorithm with path compression to calculate the dominator tree for a graph where there are millions of nodes. The algorithm is quite complex and I have to admit I haven't taken the time to fully understand it, I'm just using it. Now I have a need to calculate the dominator trees of...
<p><a href="http://www.boost.org/doc/libs/1_36_0/libs/graph/doc/lengauer_tarjan_dominator.htm" rel="noreferrer"><code>boost::lengauer_tarjan_dominator_tree_without_dfs</code></a> might help.</p>
<p>I do not fully understand your question, but it seems to me you want to have some incremental update feature. I researched a while ago what algorithms are their but it seemed to me that there's no known way for large graphs to do this quickly (at least from a theoretical standpoint). </p> <p>You may just search for...
31,054
<p>I recently learned about the basic structure of the .docx file (it's a specially structured zip archive). However, docx is not formated like a doc.</p> <p>How does a doc file work? What is the file format, structure, etc?</p>
<p>The full format for binary .doc files is documented in <a href="http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Word97-2007BinaryFileFormat(doc)Specification.pdf" rel="noreferrer">this pdf</a> from (<a href="http://en.wikipedia.org/wiki/DOC_(computing)" rel="noreferrer">the Wikipedi...
<p>There's Microsoft Word's .doc and then there's plain text .doc. It sounds like you're wondering about the proprietary Microsoft format.</p> <p>From <a href="http://en.wikipedia.org/wiki/DOC_(computing)" rel="nofollow noreferrer">Wikipedia</a>:</p> <blockquote> <p>The DOC format varies among Microsoft Office Word...
15,182
<p>I've an image that is wrapped in an anchor tag that, through jQuery, triggers an action somewhere else on the page. When I click on the image, two tiny 1px by 1px boxes show up in the upper and lower left corners of the image.</p> <p>My CSS styles explicitly state no borders for images: <code>a,img { border: 0; }<...
<p>Browsers (and Dashcode) provide an XMLHttpRequest object which can be used to make HTTP requests from JavaScript:</p> <pre><code>function httpGet(theUrl) { var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", theUrl, false ); // false for synchronous request xmlHttp.send( null ); return xmlHttp....
<p>You can do it with pure JS too:</p> <pre><code>// Create the XHR object. function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { // XHR for Chrome/Firefox/Opera/Safari. xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { // XDomainReque...
30,745
<p>I'm using subversion (TortoiseSVN) and I want to remove the .svn folders from my project for deployment, is there an automated way of doing this using subversion or do I have to create a custom script for this?</p>
<p>TortoiseSVN has an export function. This will create the entire SVN tree elsewhere without the <code>.svn</code> folders.</p> <p>Also, a lot of FTP clients have filtering, which you can add <code>.svn</code> to just in case you forget one day.</p>
<p>Do <code>svn export &lt;url&gt;</code> to export a clean copy without .svn folders.</p>
19,404
<p>I have a <code>POCO</code> object that goes 4 levels deep contained objects (like <code>Invoice</code> has line items that have taxes that have gl entries), and I want to turn the entire thing into a <code>DataSet</code>. So there would be 4 tables, each with constraints being applied to the parent table.</p> <p>Do...
<p>How do you populate this object? If it's from the database, there are two methods to structure your query such that the dataset is populated with separate, automatically related DataTable-s. Old and probably not supported anymore is the <a href="http://support.microsoft.com/kb/189657" rel="nofollow">SHAPE command</a...
<p>Better JSON serialize your POCO object and then deserialize it to Dataset. Hope this will do.</p>
27,072
<p>Actually my question is all in the title.<br> Anyway:<br> I have a class and I use explicit constructor: <br>.h<br></p> <pre><code>class MyClass { public: explicit MyClass(const string&amp; s): query(s) {} private: string query; } </code></pre> <p>Is it obligatory or not to put <b>explicit</b> keyword i...
<p>No, it is not. The <code>explicit</code> keyword is only permitted in the header. My gcc says:</p> <pre><code>test.cpp:6: error: only declarations of constructors can be 'explicit' </code></pre> <p>for the following code:</p> <pre><code>class foo { public: explicit foo(int); }; explicit foo::foo(int) {} </co...
<p>Re the followup question (which you really should have submitted as a separate question), the initialization list goes with the constructor's implementation (its function body), which might be in either the header or the cpp file.</p>
34,475
<p>For the moment the best way that I have found to be able to manipulate DOM from a string that contain HTML is:</p> <pre><code>WebBrowser webControl = new WebBrowser(); webControl.DocumentText = html; HtmlDocument doc = webControl.Document; </code></pre> <p>There are two problems:</p> <ol> <li>Requires the <code>W...
<p>I did a search to GooglePlex for HTML and I found <a href="https://html-agility-pack.net/" rel="noreferrer">Html Agility Pack</a> I do not know if it's for that or not, I am downloading it right now to give a try.</p>
<p>This is an old question. Now there are:</p> <ul> <li><a href="https://github.com/zzzprojects/html-agility-pack" rel="nofollow noreferrer">The HTML Agility Pack</a> (You have already found this)</li> <li><a href="https://github.com/jamietre/CsQuery" rel="nofollow noreferrer">CsQuery</a>, a .Net jQuery port, which wi...
28,717
<p>I'm using an identical call to "CryptUnprotectData" (exposed from Crypt32.dll) between XP and Vista. Works fine in XP. I get the following exception when I run in Vista:</p> <pre><code>"Decryption failed. Key not valid for use in specified state." </code></pre> <p>As expected, the versions of crypt32.dll are diffe...
<p>The <a href="http://msdn.microsoft.com/en-us/library/aa380882.aspx" rel="nofollow noreferrer">CryptUnprotectData function</a> documentation states that it usually only works when the user has the same logon credentials as the encrypter.</p> <p>This suggests to me that maybe the key is tied to the user's current tok...
<p>Nice. Hopefully this is my bone-head move of the week! ;-)</p> <blockquote> <p>This suggests to me that maybe the key is tied to the user's current token.</p> </blockquote> <p>That was it. Turns out I was using encrypted data from another machine (the XP one) and trying to decrypt on the Vista machine.</p> <p...
8,977
<p>I'm an absolute n00b into the java platform I would like to know whether I need to change anything in my code to get the benefits of 64bit JRE ? </p> <p>or is it something like when I initiate it with "java -d64" its gonna run in some turbo mode?</p> <p>Your help is highly appreciated</p>
<p>My previous version, while not false, was a quickly written oversimplification.</p> <p>Changing from 32 to 64 bits will not automatically make your application run faster, it may in some cases lead to the opposite. On the "negative" side Doing de-referencing of memory pointers in the JVM can take a longer time with...
<p>I have found that 64-bit JVMs have been slower than 32-bit versions. However with the latest version Java 6 update 14 I have seen many of my tests are marginally faster with the 64-bit version vs the 32-bit. Either way there is only 5% to 10% difference.</p> <p>Whether your program uses a 32-bit or 64-bit version...
24,405
<p>I have some code like this in a winforms app I was writing to query a user's mail box Storage Quota.</p> <pre><code>DirectoryEntry mbstore = new DirectoryEntry( @"LDAP://" + strhome, m_serviceaccount, [m_pwd], AuthenticationTypes.Secure); </code></pre> <p>No matter what approach I tried ...
<p>The sanctified method is to use CryptoAPI and the Data Protection APIs.</p> <p>To encrypt, use something like this (C++):</p> <pre><code>DATA_BLOB blobIn, blobOut; blobIn.pbData=(BYTE*)data; blobIn.cbData=wcslen(data)*sizeof(WCHAR); CryptProtectData(&amp;blobIn, description, NULL, NULL, NULL, CRYPTPROTECT_LOCAL_M...
<p>If you store it as a secure string and save the secure string to a file (possibly using <a href="http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.aspx" rel="nofollow noreferrer">Isolated Storage</a>, the only time you will have a plain text password is when you decrypt it to create your mbstore. Un...
6,212
<p>I've just built a VS C++ 6.0 program using VS 2008. When I attempt to run or debug the application, Vista asks for permission. What is it about how the program is built that causes this? The program is being built and run from a subfolder of C:\Dev</p> <p><a href="http://www.vistax64.com/vista-installation-setup...
<p>Possibility 1:</p> <p>Your program is marked as needing admin rights in its manifest</p> <p>Possibility 2:</p> <p>Your program is called setup.exe or install.exe - such program names always cause administrator rights to be required</p> <p>For detailed explanation of those and other possibilities why you see this...
<p>If you're not an admin, then you probably don't have permission to execute programs in C:\Dev.</p>
12,108
<p>I have three TextBox controls on the page</p> <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox_TextChanged" TabIndex="1"&gt; &lt;asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" OnTextChanged="TextBox_TextChanged" TabIndex="2"&gt; &lt;asp...
<p><a href="http://msdn.microsoft.com/en-us/library/bb360913.aspx" rel="noreferrer">OfType</a></p> <pre><code>from control in changed_control .Parent .Controls .OfType&lt;WebControl&gt;() </code></pre>
<p>The problem is that LiteralControl does not inherit from WebControl. It can't have the focus though, so it's OK to not select them. In your LINQ statement, add another condition checking for a WebControl. So your where line should be <code>where control.TabIndex &gt; changed_control.TabIndex &amp;&amp; control is We...
21,510
<p>I'm finding a couple for Java in general but no plugins for netbeans that I can see.</p> <p>Thanks</p>
<p>I've used the <a href="http://sourceforge.net/project/showfiles.php?group_id=56262&amp;package_id=63621" rel="nofollow noreferrer">PMD NetBeans plugin</a>, and <a href="http://pmd.sourceforge.net/integrations.html#netbeans" rel="nofollow noreferrer">here</a> are the installation instructions (may be a little outdate...
<p>I found the <a href="https://sqe.dev.java.net/" rel="nofollow noreferrer">SQE Plugin</a>, it integrates FindBugs, CheckStyle and PMD into one convenient Plugin. </p> <p>CheckStyle configuration was not complete yet, but the functionality is there in full.</p>
34,295
<p>I want to get my Ender 5 plus to print at 300 °C. As such, I've edited the firmware and increased the <code>HEATER_0_MAXTEMP</code> to 315 °C.</p> <p>In my slicer, I can slice and print at 300 °C, however, I cannot manually adjust the temperature on the LCD screen past the stock setting of 260 °C.</p> <p>Any help in...
<p>Your formula doesn't seem to take into account two important factors: layer height and average speed.</p> <p>Do the math differently:</p> <p>voumetric flow rate [mm^3/s] = layer height [mm] * line width [mm] * speed [mm/s]</p> <p>For example, 0.2 * 0.45 * 70 = 6.3 mm^3/s</p> <p>which is realistic, the extruder on th...
<p>Your math looks correct, and is also a good approximation for what I've seen in the first few weeks with my own Ender 3.</p> <p>Another way to calculate (to check yourself) is to calculate the volume extruded (nozzle area times extrusion percentage times print speed -- be sure you convert everything to the same unit...
1,951
<h1>The Problem</h1> <p>I use a tool at work that lets me do queries and get back HTML tables of info. I do not have any kind of back-end access to it.</p> <p>A lot of this info would be much more useful if I could put it into a spreadsheet for sorting, averaging, etc. <strong>How can I screen-scrape this data to a CSV...
<ul> <li>Select the HTML table in your tools's UI and copy it into the clipboard (if that's possible</li> <li>Paste it into Excel.</li> <li>Save as CSV file</li> </ul> <p>However, this is a manual solution not an automated one.</p>
<p>Have you tried opening it with excel? If you save a spreadsheet in excel as html you'll see the format excel uses. From a web app I wrote I spit out this html format so the user can export to excel.</p>
32,360
<p>I have this in some WSDL:</p> <pre><code>&lt;element name=&quot;startDate&quot; type=&quot;xsd:dateTime&quot;/&gt; &lt;element name=&quot;endDate&quot; type=&quot;xsd:dateTime&quot;/&gt; </code></pre> <p>Which results in the following text in the SOAP envelope:</p> <pre><code>&lt;startDate&gt;2008-10-29T12:01:05&lt;...
<p>I suspect your endDate value has the Kind property set to DateTimeKind.Local.</p> <p>You can change this to DateTimeKind.Unspecified as follows:</p> <pre><code>endDate = DateTime.SpecifyKind(endDate, DateTimeKind.Unspecified) </code></pre> <p>after which I believe it will be serialized without the timezone offset...
<p>What are you using to generate the date? If you are building this XML in your code rather than using some serializer (WCF or XmlSerializer) you could use System.Xml.XmlConvert to generate and interpret the date as follows:</p> <p>To create the string to put in the XML:</p> <pre><code>DateTime startDate = DateTime...
30,811
<p>I am using an api which interacts with a db. This api has methods for querying, loading and saving elements to the db. I have written integration tests which do things like create a new instance, then check that when I do a query for that instance, the correct instance is found. This is all fine. </p> <p>I woul...
<p>Look at what the tests are like. If you're only testing if stuff that comes in ends up in the database etc. Your probably doing the right thing by only doing automated integration tests. If there's logic you want to test then you might want to look if you can factor out your logic into separate classes that you can ...
<p>It is a good idea to mock out m_api in my code for the following reasons (not all of which apply to your psuedo-code example):</p> <ul> <li>As you mentioned, you can verify that your class performs error handling properly</li> <li>In cases where you have more complex code in your class (e.g., cacheing), you can use...
43,222
<p>I have a jQuery datepicker that I want to restrict non work days - weekends, public holidays etc. I have seen examples on how to do this from the client side (javascript), but is there a way to restrict the dates from server side ASP.NET code?</p> <p>I figure you could do using Page.RegisterClientScriptBlock, but w...
<p>The JQuery stuff is all client side, so there is no server side to speak of. My recommendation would be to create some thin server-side wrappers that automagically do the equivalent of writing RegisterClientScriptBlock. That way you only have to fiddle around with the Javascript once, and it always just works.</p>
<p>You just do it when you validate the data being posted, using the same logic you use client-side. You should always be validating data at server-side, NOTHING from the client side can EVER be trusted, even if you have "validation code" there and think you're requiring javascript to be on for it to work. </p> <p>Doi...
27,705
<p>I'm trying to serve dynamically generated xml pages from a web server, and provide a custom, static, xslt from the same web server, that will offload the processing into the client web browser.</p> <p>Until recently, I had this working fine in Firefox 2, 3, IE5, 6 and Chrome. Recently, though, something has changed...
<p>Displaying just the text elements is the behavior you would get out of an empty XSL stylesheet.</p> <p>To me, that suggests that something fishy is going on with your xpath expressions, and that the xsl:template/@match attributes do not match the source document.</p> <p>You do not provide enough information to dia...
<p>try serving it as application/xml instead of text/xml</p>
27,293
<p>I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there. </p> <p>Note: Its only in windows that it is like this. Mainly in Opera...
<p>There is nothing you can do to force the user to change the way that their operating system renders fonts. If it is that big a deal to you then you can replace the large headings with images, this allows you to control exactly how the font is rendered (and ensures that the heading looks exactly as you wish, even if ...
<p>Enabling anti-aliasing should solve the display problem. </p>
5,400
<p>I have a page that uses </p> <pre><code>$(id).show("highlight", {}, 2000); </code></pre> <p>to highlight an element when I start a ajax request, that might fail so that I want to use something like</p> <pre><code>$(id).show("highlight", {color: "#FF0000"}, 2000); </code></pre> <p>in the error handler. The proble...
<p>From the jQuery docs: </p> <p><a href="http://docs.jquery.com/Effects/stop" rel="nofollow noreferrer">http://docs.jquery.com/Effects/stop</a></p> <blockquote> <p><em>Stop the currently-running animation on the matched elements.</em>...</p> <p>When <code>.stop()</code> is called on an element, the currently-...
<p>In my case, using below code does not work and keep your opacity value remain: </p> <pre><code>$('#identifier').stop(true, true).effect("pulsate", { times: 1 }, 1); </code></pre> <p>For me just remove opacity are working:</p> <pre><code>$('#identifier').stop(true, true).css('opacity',''); </code></pre>
8,467
<p>I'm a contract programmer with lots of experience. I'm used to being hired by a client to go in and do a software project of one form or another on my own, usually from nothing. That means a clean slate, almost every time. I can bring in libraries I've developed to get a quick start, but they're always optional. ...
<blockquote> <p>I'm not about to blindly follow anything.</p> </blockquote> <p>That's the right attitude. I use TDD all the time, but I don't adhere to it as strictly as some.</p> <p>The best argument (in my mind) in favor of TDD is that you get a set of tests you can run when you finally get to the refactoring an...
<p>We are all developers with a good track record. After all, we are all reading Stackoverflow. And many of us use TDD and perhaps those people have a great track record. I get hired because people want someone who writes great test automation and can teach that to others. When working alone, I do TDD on my coding pro...
19,071
<p>Is it possible to determine the MAC address of the originator of a remote connection under Windows NT 4? The remote PC opens a socket connection into my application and I can get the IP address. However I need to determine the MAC address from the information available from the socket such as the IP address of the r...
<p>Try GetIpNetTable. This function is documented as supported as of NT 4.0 SP4.</p>
<p>Hope the machine isn't <em>too</em> remote. MAC addresses will only be known for the local network (subnet).</p>
8,836
<p>A colleague of mine and I have been discussing how to declare variables in a function.</p> <p>Let's say you have a class called TStrings (using Delphi for the sake of explanation) that has at least one abstract method and a descendant class called TStringList which obviously implements the abstract method, but it i...
<p>It is a TStringList, so you should also declare it as TStringList (first example). Everything else could confuse you or others that read the code later.</p>
<p>My vote is the second form - the idea being that TStrings defines a contract/interface and its better to code to them.</p>
45,885
<p>I <em>think</em> I know how to create custom encrypted RSA keys, but how can I read one encrypted like ssh-keygen does?</p> <p>I know I can do this:</p> <pre><code>OpenSSL::PKey::RSA.new(File.read('private_key')) </code></pre> <p>But then OpenSSL asks me for the passphrase... How can I pass it to OpenSSL as a par...
<p>According to the blog post here:</p> <p><a href="http://stuff-things.net/2008/02/05/encrypting-lots-of-sensitive-data-with-ruby-on-rails/" rel="noreferrer">http://stuff-things.net/2008/02/05/encrypting-lots-of-sensitive-data-with-ruby-on-rails/</a></p> <p>You can simply do:</p> <p>OpenSSL::PKey::RSA.new(File.read...
<p>I've made some progress on this. If I use the Net::SSH library, I can do this:</p> <pre><code>Net::SSH::KeyFactory.load_private_key 'keyfile', 'passphrase' </code></pre> <p>By reading the source code I have yet to figure out what the library does to OpenSSL's PKey::RSA.new to accomplish this... And then I go and t...
29,179
<p>I don’t have advanced knowledge in JavaScript, and I am trying to learn how to use Ext&nbsp;JS framework in ASP.NET (C# or VB.NET) environment. I’ve got couple of samples, but was unable get the project working. Is there such as website or book so I can go a read up about Ext&nbsp;JS in more details and how can I in...
<p>Mike,</p> <p>The best example site out there is <a href="http://examples.extjs.eu/" rel="noreferrer">http://examples.extjs.eu/</a>. Each example has a link for viewing HTML, javascript and CSS separately.</p> <p>We are successfully integrating ExtJS with the ASP.NET MVC framework. A separate post detailing how t...
<p>i wrote a <a href="http://thekindofme.wordpress.com/2009/02/05/a-grid-with-ajax-pagination-sorting-filtering-on-aspnet-mvc-with-extjs-and-ef/" rel="nofollow noreferrer">post</a> on using extjs grid with asp.net mvc. although you are not planning to use ext on mvc fm. i think other details like how to render it usin...
25,204
<p>Do you use any of these technologies? Which ones are current and hence sensible to include in a site?</p> <p>Documentation on any seems to be relatively sparse, and usage of any of them limited, as search engines get better, are they even relevant any more?</p>
<p>I use microformats whenever I can. Usually it just makes sense anyway, as frequently when I have an address block, I may want to style some elements differently then other elements, and that makes it super easy. It's not like microformats are that hard to figure out.</p> <p>There has been a couple of instances wh...
<p>I've used all three, but of the lot I'd have to say microformats have the most momentum these days. It has the advantage of being very easy to implement, even as an afterthought, on existing sites. And while there don't seem to be a lot of microformat consumers in the wild at this point, that situation is starting...
18,164
<p>I have a project where there are multiple applications that have some common configuration values. I would like to have a shared .config file that is available to all of the applications using the .Net configuration object model. Each application would also have its own app.config file</p> <p>How can this best be d...
<p>Some sections in the app.config allow for a reference to an external file.</p> <pre><code>&lt;appSetting configSource="somefile.config"/&gt; </code></pre>
<p><a href="https://stackoverflow.com/questions/239687/easiest-way-to-read-a-config-file-belonging-to-another-application#239715">Here's</a> a discussion that addresses OpenExeConfiguration which may be helpful.</p>
36,056