instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm working on building a development tool that is written in JavaScript.</p>
<p>This will not be an open source project and will be sold (hopefully) as a commercial product.</p>
<p>I'm looking for the best way to protect my investment. Is using an obfuscator (code mangler) enough to reasonably secure the code?</p... | <p>I'm going to tell you a secret. Once you understand it, you'll feel a lot better about the fact that Javascript obfuscation is only really useful for saving bandwidth when sending scripts over the wire.</p>
<p>Your source-code is not worth stealing.</p>
<p>I know this comes as a shock to the ego, but I can say thi... | <p>That's probably about the best you can do. Just be aware that anybody with enough dedication, can probably de-obfuscate your program. Just make sure you're comfortable with that before embarking on your project. I think the biggest problem with this would be to control who's using it on their site. If somebod... | 4,904 |
<p>I have the original Prusa i3m3 printer. Prusa recommends cleaning the bed before each print with isopropanol (isopropyl alcohol), with only occasional cleaning with acetone. The textured bed prohibits using acetone.</p>
<p>Given the SARS-COV-2 situation and COVID-19, isopropanol is impossible to find, and will no... | <p><strong>Ethanol</strong> (Ethyl Alcohol) should work just fine as long as it's around 80% or more. It's very similar to isopropanol as a cleaning solvent. What you're basically doing is removing any stray grease from the bed with a solvent that evaporates quickly. </p>
<p><strong>Methanol</strong> would also probab... | <p>Dish soap will remove grease very well. Once you rinse it with a moist sponge and dry with a clean cloth most residues will be gone.</p>
| 1,618 |
<p>another issue in IE 6... <a href="http://plwd.co.uk/rangers" rel="nofollow noreferrer">link</a></p>
<p>The navbar link list has a border applied to the left side of each element. </p>
<p>In fireforx/safari this matches up with the navbar background but in IE the border/element spills out below the navbar ( the bor... | <p>Try getting rid of the height rule on the anchor tags, and using top/bottom margins/paddings to ensure they fill the space. I find CSS using floats a lot easier when you don't try to enforce heights on elements.</p>
| <p>It's not the borders doing it - it's the line-height. Your nav anchors are inheriting "line-height: 2em" from #header. Try setting the line height on the anchors (or their parent LI's or the UL) to something smaller - maybe 1.5em or so - and then make up the difference with some top padding on the anchors</p>
| 28,738 |
<p>So our SQL Server 2000 is giving me the error, "The log file for database is full. Back up the transaction log for the database to free up some log space."</p>
<p>How do I go about fixing this without deleting the log like some other sites have mentioned?</p>
<p>Additional Info: Enable AutoGrowth is enabled growi... | <p>To just empty it:</p>
<pre><code>backup log <dbname> with truncate_only
</code></pre>
<p>To save it somewhere:</p>
<pre><code>backup log <dbname> to disk='c:\somefile.bak'
</code></pre>
<p>If you dont really need transactional history, try setting the database recovery mode to simple.</p>
| <p>Rename it it. eg:<br>
old-log-16-09-08.log</p>
<p>Then the SQL server can use a new empty one.</p>
| 9,858 |
<p>So I'm doing this in PHP but it is a logic issue so I'll try to write it as generically as possible.</p>
<p>To start here's how this pagination script works:</p>
<ol>
<li>for (<em>draw first three pages links</em>)</li>
<li>if (<em>draw ellipsis (...) if there are pages between #1's pages and #3's pages</em>)</li>... | <pre><code><?php
/**
* windowsize must be odd
*
* @param int $totalItems
* @param int $currentPage
* @param int $windowSize
* @param int $anchorSize
* @param int $itemsPerPage
* @return void
*/
function paginate($totalItems, $currentPage=1, $windowSize=3, $anchorSize=3, $itemsPerPage=10) {
$halfWi... | <p>This is probably an overcomplicated solution, but it works. </p>
<p>I've used an array here instead of just printing, which lets me "do-over" the logic. </p>
<p>Part of the problem occurs when "left and right of page" happens to coincide with left-and-right shoulders. </p>
<pre><code>function cdotinator ( $curr... | 39,664 |
<p>I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page.</p>
<p>I'm not really sure where to start dealing with the problem. I don't mind resetting the... | <p>That is odd as the ViewState is stored as a string in the webpage itself. So I do not see how an extended period of time would cause that error. Perhaps one or more objects on the page have been garbage collected or the application reset, so the viewstate is referencing old controls instead of the controls created... | <p>Alternatively if you know the time-out length then you could add a bit of javascript to the page which redirects the user to an alternative page if there has been no activity on the page after a preset period of time. You can then extend this to warn the customer that their session / page is about to expire and prov... | 9,905 |
<p>Using vim 7.1, I recently heard you can debug php in VI.
But how?</p>
| <p><a href="http://computing.vt.edu/infrastructure_services/vtaix/learning.html#4" rel="noreferrer">Message of the day</a>, /etc/motd</p>
<p>i.e. edit the /etc/motd text file</p>
| <p>Put some content in the file /etc/issue</p>
<p>Some more details in <a href="http://www.linuxfromscratch.org/blfs/view/svn/postlfs/logon.html" rel="nofollow noreferrer">http://www.linuxfromscratch.org/blfs/view/svn/postlfs/logon.html</a></p>
<hr>
<p>crap /etc/motd was the file i was trying to remember. Upvoting h... | 30,530 |
<p>I am making a program in C# to connect to a webcam and do some image manipulation with it.</p>
<p>I have a working application that uses win32 api (avicap32.dll) to connect to the webcam and send messages to it that sends it to the clipboard. The problem is that, while accessible from paint, reading it from the prog... | <p>I've recently started doing some hobby work in this area.</p>
<p>We settled on using the <a href="http://sourceforge.net/projects/opencv/" rel="noreferrer">OpenCV</a> library with the <a href="http://code.google.com/p/opencvdotnet/" rel="noreferrer">opencvdotnet</a> wrapper. It supports capturing frames from a web... | <p>Have you tried Clipboard.GetImage()? You could also try the various Clipboard.Contains*() methods to see what format the data is stored in the clipboard.</p>
| 28,897 |
<p>I'm looking for a library to read a SWF file and let me parse through its actionscript and header information. Is there anything out there that will work?</p>
| <p>I ended up finding one at:</p>
<p><a href="http://sourceforge.net/projects/swfdotnet/" rel="nofollow noreferrer">http://sourceforge.net/projects/swfdotnet/</a></p>
| <p>I do not know of any libraries (including .NET) that let you read and parse (or reverse engineer) the contents of SWF's files. The ActionScript you are referring to is compiled down to byte code during compilation so you will not find the actual ActionScript source code in the SWF file.</p>
<p>For more information ... | 36,150 |
<blockquote>
<p>This question exists because it has
historical significance, but it is not
considered a good, on-topic question
for this site, so please do not use it
as evidence that you can ask similar
questions here.</p>
<p>More info: <a href="https://stackoverflow.com/faq">https://stackoverflow.com... | <p>Like others have said, what you want is a so called zone-transfer. If it is your own domain you can configure the DNS server to give it to you. If it is for some other domain you probably don't get it, since most DNS-admins consider it a security threat.</p>
<p>Even if an individual record isn't a problem (thats wh... | <p>If name servers allow zone transfers you can use this page <a href="http://www.magic-net.info/dns-lookup.dnslookup" rel="nofollow noreferrer">http://www.magic-net.info/dns-lookup.dnslookup</a> to find all subdomains in given zone.</p>
<p>15 oct. I`m have modified my tool. Now it checks first 6 name servers for zone... | 39,294 |
<p>Quite simple really:</p>
<pre><code>var req:URLRequest=new URLRequest();
req.url="http://somesite.com";
var header:URLRequestHeader=new URLRequestHeader("my-bespoke-header","1");
req.requestHeaders.push(header);
req.method=URLRequestMethod.GET;
stream.load(req);
</code></pre>
<p>Yet, if I inspect the traffic with ... | <p>In your PagesMethods call, remove the parentheses from the callback and error functions:</p>
<pre><code>PageMethods.getAdCodeInfo(value, onSuccess, onError)
</code></pre>
<p><code>onSuccess</code> and <code>onError</code> are basically variables that point to the functions. So you don't need parentheses for varia... | <p>OK, stupid me. Here is some code. </p>
<pre><code> function getName()
{
var ddlAdCodes=$get('<%=ddlAdCodes.ClientID %>');
var value=ddlAdCodes.options[ddlAdCodes.selectedIndex].value;
//alert(value);
PageMethods.getAdCodeInfo(value,onSuccess(),onError());
}
function onSuccess(result)
{
... | 27,565 |
<p>In the NodeMouseClick event I'm trying to load some objects from the Node.Tag. Before I do so I check e.Node.IsSelected. When run regularly IsSelected is false....if I stick a break point around there and check e.node.Isselected, the value changes on me and becomes true. Why? </p>
| <p>The NodeMouseClick event is raised before the selection actually changes. (When you click on the same node twice, the second time e.Node.IsSelected will certainly have been true.)</p>
<p>You could try handling the AfterSelect event, although that will also be raised when using the keyboard to navigate the treeview,... | <p>I tried to recreate your problem but could not. When I click on a node for the first time this value is always false, whether I set a break point or not. If I click a node the second time the value is true. </p>
<p>If the node is selected by default the value will be true, but otherwise it will always return false ... | 32,493 |
<p>For testing purposes I'm planning to put together a little app that will listen for a particular event coming from an application and interact with it at that point. </p>
<p>Given that we're at a point in the testing process where changing the application code is out of the question, the ideal from my point of view... | <p>The way I found to do it used the <a href="http://blogs.msdn.com/jmstall/archive/2005/11/08/mdbg_linkfest.aspx" rel="noreferrer">Mdbg tools</a> from Microsoft to give me access from the runtime to the core debugging information. The basic shape of the code I'm using looks like this:</p>
<pre><code> MDbgEngine mg;
... | <p>Is the application that you want to trace using standard <code>System.Diagnostics</code>-based tracing? In that case you could build your own <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelistener(VS.80).aspx" rel="nofollow noreferrer">TraceListener</a>.</p>
| 48,032 |
<p>Say I have my sources in my src/ tree (and possibly in my test/ tree). Say I would like to compile only <em>part</em> of that tree. The reasons why I might want to do that are various. Just as an example, I might want to create the smallest possible jar (without including certain classes), or I might want the fastes... | <p>Why are you excluding as well as including? If you have at least one include, then files are only compiled if they're explicitly included. So this should work:</p>
<pre><code><javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath"
includes="src/path/to/MyClass.java" />
</code></pre>... | <p>Actually, ant only <em>checks</em> everything, if you run a compile twice in a row you will notice the second is much quicker. Actually, it can be easily persuaded to miss things.</p>
<p>If you don't even want it to consider everything, you're going to have to break it down into smaller modules/projects/source tree... | 24,854 |
<p>I've incorporated <a href="http://www.libpng.org/pub/png/pngcode.html" rel="nofollow noreferrer">LIBPNG and ZLIB</a> into my C software for a microcontroller project due to their nicely liberal license which permits such use without requiring me to disclose any of my code (it's very similar to BSD/MIT/APACHE, but wi... | <p>libjpeg ILJ at is C source and liberally licensed. </p>
<p><a href="http://www.ijg.org/" rel="nofollow noreferrer">http://www.ijg.org/</a></p>
<p>"We are releasing this software for both noncommercial and commercial use.
Companies are welcome to use it as the basis for JPEG-related products.
We do not ask a royalt... | <p>+1 on the <a href="http://www.ijg.org/" rel="nofollow noreferrer">Independent JPEG Group</a> library. </p>
<ul>
<li>It's in C</li>
<li>Highly portable</li>
<li>Small footprint</li>
<li>Liberally licensed</li>
<li>Highly regarded</li>
<li>Widely used</li>
<li>Stable (the last release was <em>over <strong>10 years</s... | 33,930 |
<p>Apparently ;-) the standard containers provide some form of guarantees.</p>
<p>What type of guarantees and what exactly are the differences between the different types of container?</p>
<p>Working from <a href="http://www.sgi.com/tech/stl/" rel="noreferrer">the SGI page</a> (about <a href="http://en.wikipedia.org/wi... | <p>I found the nice resource <em><a href="http://www.cs.northwestern.edu/~riesbeck/programming/c++/stl-summary.html" rel="noreferrer">Standard C++ Containers</a></em>. Probably this is what you all looking for.</p>
<p><strong>VECTOR</strong></p>
<p><strong>Constructors</strong></p>
<pre><code>vector<T> v; ... | <p>Another quick lookup table is available at this <a href="https://alyssaq.github.io/stl-complexities/" rel="nofollow noreferrer">github page</a></p>
<p>Note : This does not consider all the containers such as, unordered_map etc. but is still great to look at. It is just a cleaner version of <a href="http://cs.northw... | 21,936 |
<p>Hi I'm looking into iPhone development, and Objective-C is not be my preferred language. As far as I can see at this moment Ruby cannot be used to talk to Cocoa Touch at the moment on the iPhone.</p>
<p>So my question is, am I wrong? Can I use Ruby on the iPhone to develop Cocoa Touch applications. And what is the ... | <p>No, you are correct. Currently, and most likely for the foreseeable future, Ruby will not be an option, at least for AppStore applications. There's no reason you couldn't do this on a Jailbroken phone, but Apple is pretty wed to Objective C for official development.</p>
| <p>One possible solution would be to create an application wrapping for example the rice library (google it) which includes a ruby-vm. I reckon you would be able to create c++ wrappers that you could expose to ruby, thus making an environment for iphone development with ruby. This probably requires a lot of work though... | 27,043 |
<p>How can I combine the followings to fight spam and at the same time minimize annoyance imposed to the user?</p>
<ol>
<li>In registration page, sending an email to verify the email address</li>
<li>In registration page, use CAPTCHA</li>
<li>In every post page, use CAPTCHA</li>
</ol>
<p>Feel free to add new items to... | <p>Try using javascript to submit forms with a time limited variable in a hidden field. This will mean that bots won't currently be able to sumbit anything.</p>
| <p>Comment spam is often done with botnets, so anything relying on IP blacklisting is just going to end up blocking legitimate users.</p>
<p>Focus on analyzing the message content with <a href="http://akismet.com/" rel="nofollow noreferrer">Akismet</a> or using a proven accessible CAPTCHA solution like <a href="http:/... | 23,951 |
<p>We get sometimes the following error from our partner's database:</p>
<pre><code><i>ORA-01438: value larger than specified precision allows for this column</i>
</code></pre>
<p>The full response looks like the following:</p>
<pre><code><?xml version="1.0" encoding="windows-1251"?>
<response&g... | <p>The number you are trying to store is too big for the field. Look at the SCALE and PRECISION. The difference between the two is the number of digits ahead of the decimal place that you can store.</p>
<pre><code>select cast (10 as number(1,2)) from dual
*
ERROR at line 1:
ORA-01438: value larger than sp... | <p>It is also possible to get this error code, if you are using PHP and bound integer variables (oci_bind_by_name with SQLT_INT).
If you try to insert NULL via the bound variable, then you get this error or sometimes the value 2 is inserted (which is even more worse).</p>
<p>To solve this issue, you must bind the varia... | 21,887 |
<p>I saw something about needing to have the assembly available for the type of the first argument passed to the function. I think it is, I can't figure out what am I missing.</p>
<p>This code is in a service. I was running the service under the 'NETWORK SERVICES' user account, when I changed the account to that of th... | <p>copy your binary to the bin folder of your web app will also fix this.</p>
| <p>I finally found an answer: it appears that the type given to ApplicationHost.CreateApplicationHost() must be in an assembly located in the GAC.
Simple, and stupid :)</p>
| 41,964 |
<p>We have an error that we can't seem to find and don't have the need/resources to try and track it down. What we do need to do is just keep the freaking "Please tell Microsoft about this problem" dialog boxes from cluttering up the server.</p>
<p>It is from an MS-Access error (we think) but I can't find where Acces... | <p>From <a href="http://www.codeproject.com/KB/exception/UnhandledExceptionClass.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/exception/UnhandledExceptionClass.aspx</a>:</p>
<blockquote>
<p>If you also want to disable the Windows “Send Error Report” dialog on your computer, right-click on the “My Co... | <p>When working in .net, you can catch all unhandled exceptions (which is what causes this message). But I'm not aware of a way to do the same in Access.</p>
<p><a href="http://devcity.net/Articles/60/1/unhandled_exceptions.aspx" rel="nofollow noreferrer">http://devcity.net/Articles/60/1/unhandled_exceptions.aspx</a>... | 7,866 |
<p>Are there compilers for high-level languages (such as C) which can be targeted to various architectures by specifying the hardware resources of the target?</p>
<p>I'm wondering if there are compilers which can target an architecture by specifying features such as the available registers and instruction set of the p... | <p>AFAIK, gcc does work just like that. check <a href="http://gcc.gnu.org/onlinedocs/gccint/Machine-Desc.html" rel="nofollow noreferrer">"Machine Descriptions"</a> in the gcc docs. Of course, creating those <code>.md</code> files is a major programming effort.</p>
| <p>I was listening to a podcast a while ago which talked about a Java virtual machine written (mostly) in Java, which targets multiple different platforms with some kind of platform definition file. I <em>think</em> I was listening to <a href="http://javaposse.com" rel="nofollow noreferrer">Java Posse</a> and I <em>thi... | 32,006 |
<p>I have been working on standardizing the source control structure for our Team Foundation Server rollout for the new year. I have started by using the <a href="http://www.codeplex.com/BranchingGuidance" rel="noreferrer">Microsoft Team Foundation Server Branching Guidance</a> documentation available on CodePlex.</p>... | <p>I like your idea of putting the Sandcastle files as a peer to Source and Tests, I would add a documentation folder, that would then contain the sandcastle files, and optionally the actual documentation.</p>
<p>There are definetly differences of opinions and I'm sure I will be downvoted for this (since I have been b... | <p>Great layout and explanation. I've struggled with the exact same issues. I've wound up with a very similar structure. Mine varies slightly.</p>
<pre><code>Development/
Trunk/
Binaries/ -- Shared libraries
Source/
Test/
Docs/ -- Documentation
TeamBuildTypes/ -- Build definitions
</c... | 49,934 |
<p>My website makes a lot of requests. I often need to cancel all current requests, so that the browser is not blocking relevant new requests.</p>
<p>I have 3 kinds of requests:</p>
<ul>
<li>Ajax</li>
<li>inserted script-tags (which do JSONP-Communication)</li>
<li>inserted image-tags (which cause the browser to requ... | <p><code>window.stop()</code> should cancel any pending image or script requests.</p>
| <p>I think <code>document.close()</code> stops all requests, but I'm not so sure about it.</p>
| 14,319 |
<p>Well behaved windows programs need to allow users to save their work when they are shutting the PC down.</p>
<p>How can I make my app detect the shutdown event? Any solution should allow the user to abort the shutdown if user selects, say "Cancel".</p>
<p>The normal Swing window closing hook doesn't work, nor does... | <p>Write some JNI code to WM_QUERYENDSESSION message. You can get details for this from the MSDN documentation or by googling it.</p>
<p>If you don't want to write too much C++ code to do this I can recommend the JNA library <a href="https://jna.dev.java.net/" rel="nofollow noreferrer">click here</a>. Which gives you ... | <p>The above seems to be the better answer.</p>
<p>I can't find any good information on detecting window shutdown events. I guess the best possible method would be to detect weather your application is trying to close, using a window closing event or the like then ask the question.</p>
<p><a href="http://www.javalobb... | 9,740 |
<p>I'm looking at buying a code-signing certificate from Comodo (they seem to be the cheapest).</p>
<p>Can someone who has done this tell me how long it takes to issue the certificate once you submit your business documents?</p>
| <p>took us about 1 business day, once we faxed all the necessary docs</p>
| <p>It took us 8 business days (10 total days) to receive ours, but Comodo had a hard time verifying our company. I recommend submitting your DUNS # as well as your yellowbook.com listing to them to aid in speeding up the request. We did not do so originally, and they were trying to verify us through a list of 3rd par... | 47,648 |
<p>Is it possible to modify/write data to an XML file without any server-side proxy(e.g. a php or asp script)? Can this be done via javascript? XSLT?</p>
| <p>You can load and modify xml in browser, but writing the file back is a different thing. </p>
<p>I don't know of any feasible way of writing data back to a server without some kind of server side mechanism to write the data to disk. </p>
| <p>Yes it is possible. You can do it with pure javascript or using a library like <a href="http://jquery.com/" rel="nofollow noreferrer">jquery</a></p>
| 29,966 |
<p>Similar questions have been asked, but nothing exactly like mine, so here goes.</p>
<p>We have a collection of Microsoft Word documents on an ASP.NET web server with merge fields whose values are filled in as a result of user form submissions. After the field merge, the server must convert the document to PDF and s... | <p>It's not exactly Open Source, but Aspose has a couple products which can do that,</p>
<p><a href="http://www.aspose.com/categories/file-format-components/aspose.pdf.kit-for-.net-and-java/default.aspx" rel="noreferrer">Aspose.Pdf.Kit</a></p>
<blockquote>
<p>Aspose.Pdf.Kit is a non-graphical PDF® document manipula... | <p>Microsoft PDF add-in for word seems to be the best solution for now but you should take into consideration that it does not convert all word documents correctly to pdf and in some cases you will see huge difference between the word and the output pdf. Unfortunately I couldn't find any api that would convert all word... | 19,319 |
<p>I need to have some information about the Scoping issue in Javascript. I know that it spports lexical(static) scoping, but, does not it support dynamic scoping as well?
If you know anything about the scoping in Javascript, would you please share them with me ?</p>
<p>Thanks</p>
| <p>I think you're confused because Javascript uses static scoping but at function-level, not at block level like usual structured languages.</p>
<pre><code>var foo = "old";
if (true) {var foo = "new";}
alert (foo == "new")
</code></pre>
<p>So be careful, blocks don't make scope!
That's why you sometimes see loops wit... | <p>As far as I understood; Javascript has two kinds of variables which are global and local variables. But, suppose we have a variable called x, which is defined as global, and defined in the static parent of the scope of place where x is referenced. In this case, x takes the value of the global variable. Thus, global ... | 42,432 |
<p>I am using VSTO with Excel 2007 to generate PivotTables and PivotCharts dynamically.
I am having a problem when I need to have a PivotField in more than one column. </p>
<p>To accomplish this I create a PivotTable in Excel and serialize its properties into an XML document, which I then use to rebuild the PivotTable... | <p>If you add a calculated field to a Piviot Table and make the formula simply be the name of the field you need a duplicate of that allows you to use the same field twice, the Calculated Field does have to be a Value field. </p>
<p>Prehaps you can do this programaticly.</p>
| <p>Once you have your Dataset you can convert it to an object[,] and insert it into an Excel document. Then you can save the document to disk and stream it to the user.</p>
<pre><code>for (int cIndex = 1; cIndex < 1 + columns; cIndex++)
sheet.Cells.set_Item(4, cIndex, data.Columns[cIndex - 1].Caption);
if (rows... | 13,110 |
<p>I have a shared library that I wish to link an executable against using GCC. The shared library has a nonstandard name not of the form libNAME.so, so I can not use the usual -l option. (It happens to also be a Python extension, and so has no 'lib' prefix.)</p>
<p>I am able to pass the path to the library file direc... | <p>There is the ":" prefix that allows you to give different names to your libraries.
If you use </p>
<pre><code>g++ -o build/bin/myapp -l:_mylib.so other_source_files
</code></pre>
<p>should search your path for the _mylib.so.</p>
| <p>If you are on Unix or Linux I think you can create a symbolic link to the library in the directory you want the library.<br>
<br>
For example:<br>
<code>ln -s build/bin/_mylib.so build/bin/lib_mylib.so</code><br>
<br>
You could then use <code>-l_mylib</code>
<br>
<br>
<a href="http://en.wikipedia.org/wiki/Symbolic_l... | 25,379 |
<p>Writing something like this using the <a href="http://loki-lib.sourceforge.net/" rel="nofollow noreferrer">loki library</a>,</p>
<pre><code>typedef Functor<void> BitButtonPushHandler;
</code></pre>
<p>throws a compiler error, but this works</p>
<pre><code>typedef Functor<void,TYPELIST_1(Matrix3D*)> Pe... | <p>Looking at the source code, the Functor template definition is as follows:</p>
<pre><code>template <typename R = void, class TList = NullType,
template<class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>
class Functor{...};
</code></pre>
<p>As commented below, there ar... | <p>What I originally wrote worked... it was late, and I forgot about... </p>
<pre><code>using namespace Loki;
</code></pre>
<p>...so sorry</p>
| 32,068 |
<p>I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way... | <p>I believe this is one of the real limitations of the Visual Studio installation project. You need to be able to modify the last page of the installation UI but VS.NET does not give you a way to do this. You could modify the tables in the .MSI after it has been built but VS.NET would probably overwrite these changes ... | <p>I managed it by doing invoking the Main method the assembly using the following line:</p>
<pre><code>(typeof(ClassWithinAssemblyToExecute)).Assembly.EntryPoint.Invoke(null, new Object[] {} )
</code></pre>
| 8,546 |
<p>I need to compare 2 strings as equal such as these:</p>
<blockquote>
<p>Lubeck == Lübeck</p>
</blockquote>
<p>In JavaScript.</p>
<p>Why? Well, I have an auto-completion field that's going out to a Java service using Lucene, where place names are stored naturally (as Lübeck), but also indexed as normalized text,... | <pre><code>/**
* Creates a RegExp that matches the words in the search string.
* Case and accent insensitive.
*/
function make_pattern(search_string) {
// escape meta characters
search_string = search_string.replace(/([|()[{.+*?^$\\])/g,"\\$1");
// split into words
var words = search_string.split(/\... | <p>A more complete version with case sensitive support, ligatures and whatnot.
Original source at: <a href="http://web.archive.org/web/20120918093154/http://lehelk.com/2011/05/06/script-to-remove-diacritics/" rel="noreferrer">http://lehelk.com/2011/05/06/script-to-remove-diacritics/</a></p>
<pre><code>var defaultDiacr... | 28,210 |
<p>I have a file upload form that is being posted back to a servlet (using multipart/form-data encoding). In the servlet, I am trying to use Apache Commons to handle the upload. However, I also have some other fields in the form that are just plain fields. How can I read those parameters from the request?</p>
<p>F... | <p>You could try something like this:</p>
<pre><code>while (items.hasNext()) {
FileItem thisItem = (FileItem) items.next();
if (thisItem.isFormField()) {
if (thisItem.getFieldName().equals("somefieldname") {
String value = thisItem.getString();
// Do somethin... | <p>Did you try request.getParam() yet?</p>
| 45,663 |
<p>We have concurrent edits happening on Word documents and I want to make sure that Subversion can handle merging .doc files. Do you know if Subversion handles merges of Word documents well?</p>
| <p>Use <a href="http://tortoisesvn.tigris.org/" rel="noreferrer">TortoiseSVN</a> merge utility with the <a href="http://freemind.s57.xrea.com/xdocdiff/e/index.html" rel="noreferrer">xdocdiff</a> plugin to compare and merge Office documents</p>
| <p>You might also consider using a non binary format like Html</p>
| 11,561 |
<p>I was wondering if there was somewhere I could get some starter kit / theme sample for ASP.NET.</p>
<p>I am not a designer, but I need to build a prototype for a project, and if I do it myself it'll certainly be awful</p>
<p>Do you know where I could find that (ASP.NET specific)?</p>
| <p>Check <a href="http://asp.net" rel="nofollow noreferrer">http://asp.net</a>. There are quite a few starter kits and sample projects there. (<a href="http://www.asp.net/community/projects/" rel="nofollow noreferrer">http://www.asp.net/community/projects/</a>)</p>
| <p>I advice to check ASP.NET Iteration Zero: <a href="http://aspnetzero.com/" rel="nofollow">http://aspnetzero.com/</a></p>
<p>It's a professional starter kit based on a strong framework and UI. It includes role and membership management and much more. You can create a demo to see it in action easily.</p>
| 16,874 |
<p>If I want to provide OpenID as the only registration method available AND want to do something meaningful with the nick name, how can I handle 2 users with the same Jon Smith nickname?</p>
<p>Actually, when I looked at StackOverflow's URL schema I was surprised that the internal user ID was being used in the URL. F... | <p>You can use the nick from Open ID and default the nick choice in your system to that, but do not allow duplicates in your system, so they will be forced to choose a different nick for your system.</p>
<p>You could still store their Open ID nick and use it, so if you want them to be able to display their preferred n... | <p>There isn't such a thing as a fake OpenID, basically OpenID is mapping a URL space to a user, with a bit of hand off rules on how to pass data around. </p>
<p>Since there isn't a standard on how to form a URL for OpenID it would be a bit ugly to just slap up their full OpenID URL next to their name. Which you've ... | 38,027 |
<p>I've been playing with ADO.NET Entity Framework lately, and I find that it suits my needs for a project I'm developing. I also find cool its non-invasive nature.</p>
<p>After generating a data model from an existing database you are faced with the task of integrating the generated model and your business logic. Mor... | <p>One of the big critiques against the Entity Framework has been that it is inherently hard to test, for example in the ALT.Net <a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/" rel="nofollow noreferrer">Vote of No Confidence</a> that gef quoted.</p>
<p><a href="http://blogs.msdn... | <p>This answer has changed to "Yes, you can".</p>
<p>You can generate POCO and interfaces using customized T4 templates such as <a href="https://entityinterfacegenerator.codeplex.com/" rel="nofollow">https://entityinterfacegenerator.codeplex.com/</a>, then create mocking objects to test EF in and out without hitting t... | 40,923 |
<p>In the Windows applications I work on, we have a custom framework that sits directly above Win32 (don't ask). When we create a window, our normal practice is to put <code>this</code> in the window's user data area via <code>SetWindowLong(hwnd, GWL_USERDATA, this)</code>, which allows us to have an MFC-like callback... | <p><a href="http://msdn.microsoft.com/en-us/library/ms644898%28VS.85%29.aspx" rel="noreferrer">SetWindowLongPtr</a> was created to replace <a href="http://msdn.microsoft.com/en-us/library/ms633591%28VS.85%29.aspx" rel="noreferrer">SetWindowLong</a> in these instances. It's LONG_PTR parameter allows you to store a poin... | <p>The other alternative is SetProp/RemoveProp (When you are subclassing a window that already uses GWLP_USERDATA)</p>
<p>Another good alternative is ATL style thunking of the WNDPROC, for more info on that, see</p>
<ul>
<li><a href="http://www.ragestorm.net/blogs/?cat=20" rel="noreferrer">http://www.ragestorm.net/bl... | 4,307 |
<p>I have a stored procedure that looks like:</p>
<pre><code>CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND CASE WHEN @AdditionalFilter = 1 THEN
T.Column2 IS NOT NULL
</code></pre>
<p>Needless to say, this doesn't wo... | <pre><code>CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND (@AdditionalFilter = 0 OR
T.Column2 IS NOT NULL)
</code></pre>
<p>If @AdditionalFilter is 0, the column won't be evaluated since it can't affect the outcome of... | <pre><code>select *
from SomeTable t
where t.Column1 is null
and (@AdditionalFilter = 0 or t.Column2 is not null)
</code></pre>
| 18,406 |
<p>Given a <code>datetime.time</code> value in Python, is there a standard way to add an integer number of seconds to it, so that <code>11:34:59</code> + 3 = <code>11:35:02</code>, for example?</p>
<p>These obvious ideas don't work:</p>
<pre><code>>>> datetime.time(11, 34, 59) + 3
TypeError: unsupported oper... | <p>You can use full <code>datetime</code> variables with <code>timedelta</code>, and by providing a dummy date then using <code>time</code> to just get the time value.</p>
<p>For example:</p>
<pre><code>import datetime
a = datetime.datetime(100,1,1,11,34,59)
b = a + datetime.timedelta(0,3) # days, seconds, then other... | <p>Try adding a <code>datetime.datetime</code> to a <code>datetime.timedelta</code>. If you only want the time portion, you can call the <code>time()</code> method on the resultant <code>datetime.datetime</code> object to get it.</p>
| 12,542 |
<p>I'm working through some homework and a question on a previous exam paper asks to name all of the abstract classes in a given UML diagram. Fairly straightforward, I suppose. There are one abstract class and three interfaces. Do these interfaces qualify as abstract classes, in general?</p>
| <p>Thing is, while technically interfaces may be represented as classes in languages like Java, I wouldn't consider them classes.</p>
<p>Abstract? Hell yes. Class? No.</p>
<p>Interfaces cannot have constructors, neither properties, fields, function bodies, etc. Interfaces cannot be inherited, they are implemented (ag... | <p>An interface contains prototype of methods (i.e Declaration ) not defination but Abstract class can contain defination of method & atleast one Abstract method (method with only prototype) </p>
| 32,240 |
<p>In your practice, how do you effectively track and manage technical debt? </p>
<p>Is there a specific metric, like <a href="http://jamesshore.com/Blog/An-Approximate-Measure-of-Technical-Debt.html" rel="nofollow noreferrer">SLOC</a>, that you use?</p>
<p>How do you visually display your results to stakeholders a... | <p>We write story cards for technical debt. They are BLACK, with big yellow warning signs on them. Get too many on the wall, and it's REAL obvious.</p>
<p>Anyone who walks past can see them :)</p>
| <p>There is a <a href="http://www.sonarsource.org/evaluate-your-technical-debt-with-sonar/" rel="nofollow">plug-in for Sonar</a> that translates technical debt into $.</p>
<p>I haven't used it myself yet, but it looks promising.</p>
| 39,311 |
<p>If you have something like:</p>
<pre><code>val myStuff = Array(Person("joe",40), Person("mary", 35))
</code></pre>
<p>How do you create an XML value with that data as nodes? I know how to use { braces } in an XML expression to put a value, but this is a collection of values. Do I need to iterate explicitly or is t... | <p>As it's a functional programming language Array.map is probably what you're looking for:</p>
<pre><code>class Person(name : String, age : Int){
def toXml() = <person><name>{ name }</name><age>{ age }</age></person>
}
object xml {
val people = List(
new Person("Al... | <p>Actually, the line yield person.toXml() does not compile for me, but yield person.toXml (without the parentheses) does. The original version complains of 'overloaded method value apply' even if I change the def of 'ToXml' to explicitly return a scala.xml.Elem</p>
| 26,526 |
<p>I've been looking into different web statistics programs for my site, and one promising one is <a href="http://www.hping.org/visitors/" rel="nofollow noreferrer">Visitors</a>. Unfortunately, it's a C program and I don't know how to call it from the web server. I've tried using PHP's <a href="http://us.php.net/manual... | <p>Visitors looks like a log analyzer and report generator. Its probably best setup as a chron job to create static HTML pages once a day or so.</p>
<p>If you don't have shell access to your hosting account, or some sort of control panel that lets you setup up chron jobs, you'll be out of luck.</p>
| <p>Is there any reason not to just use <a href="http://www.google.com/analytics/" rel="nofollow noreferrer">Google Analytics</a>? It's free, and you don't have to write it yourself. I use it, and it gives you a lot of information.</p>
<p>Sorry, I know it's not a "programming" answer ;)</p>
| 7,100 |
<p>I need to know if I can create a file in a specific folder, but there are too many things to check such as permissions, duplicate files, etc.
I'm looking for something like <code>File.CanCreate(@"C:\myfolder\myfile.aaa"</code>), but haven't found such a method.
The only thing I thought is to try to create a dummy f... | <p>In reality, creating a dummy file isn't going to have a huge performance impact in most applications. Of course, if you have advanced permissions with create but not destroy it might get a bit hairy...</p>
<p>Guids are always handy for random names (to avoid conflicts) - something like:</p>
<pre><code>string file ... | <p>You can use <a href="http://msdn.microsoft.com/en-us/library/930b76w0.aspx" rel="nofollow noreferrer">CAS</a> to verify that there are no <strong>.NET policies (caspol)</strong> restricting the creating and writing of a file on that location.</p>
<p>But this will not cover the windows policies. You'll have to manua... | 40,926 |
<p>I have a really big database (running on PostgreSQL) containing a lot of tables with sophisticated relations between them (foreign keys, on delete cascade and so on).
I need remove some data from a number of tables, but I'm not sure what amount of data will be really deleted from database due to cascade removals.</p... | <p>You can query the information_schema to draw yourself a picture on how the constraints are defined in the database. Then you'll know what is going to happen when you delete. This will be useful not only for this case, but always. </p>
<p>Something like (for constraints)</p>
<pre><code>select table_catalog,table_sc... | <p>If the worry is keys left dangling (i.e.: pointing to a deleted record) then run the deletion on your test database, then use queries to find any keys that now point to invalid targets. (while you're doing this you can also make sure the part that should be unaffected did not change)</p>
<p>A better solution would... | 16,014 |
<p>A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo (<kbd>ctrl</kbd>+<kbd>space</kbd>) fill in all method parameters. As long as my variables were named similarly to the method parameters, I never had a... | <p><a href="http://blogs.jetbrains.com/idea/2009/09/super-method-completion/" rel="noreferrer">IntelliJ IDEA 9 now supports</a> what they call "super completion" which matches the behavior you are looking for and is available through their early access program.</p>
<p><a href="https://i.stack.imgur.com/V0vwl.png" rel=... | <p>from this post: <a href="https://stackoverflow.com/a/55160515/405749">https://stackoverflow.com/a/55160515/405749</a>:</p>
<p>The plugin <a href="https://plugins.jetbrains.com/plugin/8638-auto-filling-java-call-arguments" rel="nofollow noreferrer">https://plugins.jetbrains.com/plugin/8638-auto-filling-java-call-argu... | 11,914 |
<p>I'm working on a project that's been accepted as a proof of concept and is now on the schedule as an actual production project. I'm curious how others approach this transition.</p>
<p>I've heard from various sources that when a project starts as a proof of concept it's often a good idea to trash all of the code wr... | <p>As you already kind of hinted at, the answer is, "It Depends"</p>
<p>Starting over is good because you can help trim out the stuff that was added while you were initially working out the kinks but isn't really needed.</p>
<p>It also gives you a chance to give more consideration to how you want the architecture to ... | <p>If the code works, use it. Spend a little bit of time refactoring the messiest parts in order to ease future maintenance. But don't fall into the trap of building a new system from scratch.</p>
| 12,864 |
<p>I am using ANTLRWorks to create ANTLR grammars. I have a valid grammar and the parser and lexer source files are generated as well. I have also tried debugging the generated code and the output is as expected in the debugger output. </p>
<p>But when I try to invoke the __Test__ class generated by the debugger noth... | <p>You could as easily have asked about implementing a first-class backend getting the server side right, while avoiding the latest trendy client-side fad. And I think it would be a legitimate goal in either case. You don't mention whether this is an existing application, but if it is, then I'd say, first memeorize the... | <p>Or don't even bother with the REST / Json part and use something like DWR to talk directly from your client side code to your server POJOs.</p>
| 39,792 |
<p>As someone who is just starting to learn the intricacies of computer debugging, for the life of me, I can't understand how to read the Stack Text of a dump in Windbg. I've no idea of where to start on how to interpret them or how to go about it. Can anyone offer direction to this poor soul?</p>
<p>ie (the only dump... | <p>First, you need to have the proper symbols configured. The symbols will allow you to match memory addresses to function names. In order to do this you have to create a local folder in your machine in which you will store a local cache of symbols (for example: C:\symbols). Then you need to specify the symbols server ... | <p>It might help to include an example of the stack you are trying to read. A good tip is to ensure you have correct debug symbols for all modules shown in the stack. This includes symbols for modules in the OS, Microsoft has made their symbol server publicly available.</p>
| 10,330 |
<p>When you create a Microsoft Access 2003 link to an Oracle table using Oracle's ODBC driver, you are sometimes asked to state which columns are the primary key(s).</p>
<p>I would like to know how to change that initial assignment, or even how to get Access/ODBC to forget the assignment. In my limited testing I wonde... | <p>You must delete the link to the table and create a new one. When a table is linked all the connection info about the table's path, structure (including primary key), permissions, passwords and statistics are stored in the Access db. If any of those items change in the linked table, refreshing links won't automatic... | <p>It is not possible to delete the link and then relink?</p>
| 11,348 |
<p>At the moment we use <a href="http://www.hsqldb.org/" rel="noreferrer">HSQLDB</a> as an embedded database, but we search for a database with less memory footprint as the data volume grows.</p>
<p><a href="http://developers.sun.com/javadb/" rel="noreferrer">Derby / JavaDB</a> is not an option at the moment because i... | <p>From the download, I see that the file tutorial.html has this </p>
<pre><code>import org.h2.tools.Server;
...
// start the TCP Server
Server server = Server.createTcpServer(args).start();
...
// stop the TCP Server
server.stop();
</code></pre>
| <p>If for some reason you need an embedded H2 database in server mode you can do it either manually using the API
at <a href="http://www.h2database.com/javadoc/org/h2/tools/Server.html" rel="noreferrer">http://www.h2database.com/javadoc/org/h2/tools/Server.html</a> - or by
appending ;AUTO_SERVER=TRUE to the database UR... | 18,695 |
<p>I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and "copy").</p>
<p>For clarity, <strong>I would lik... | <p>The <code>alt</code> attribute is to be used as an alternative to the image, in the case of the image missing, or in a text only browser.</p>
<p>IE got it wrong, when they made <code>alt</code> appear as a tooltip. It was never meant to be that.</p>
<p>The correct attribute for this is <code>title</code>, which of... | <p>As Prestaul pointed out, the alt tag should work for images and title for links. However, this is also browser dependent...most browsers <strong>should</strong> implement functionality that displays this metadata as tooltips but they aren't required to do so.</p>
| 8,378 |
<p>I need any tool or IDE environment to debug and test the vb scripts code. Please suggest any free ones. My vb scripts are standalone (vbs extenstion).</p>
| <p>Sadly not free....<a href="http://support.microsoft.com/kb/308364" rel="nofollow noreferrer">How to debug Windows Script Host, VBScript, and JScript files</a></p>
| <p>I think you'll have a hard time finding a free tool that supports real VBS debugging. But I've used this "poor man's technique" in the past. Create a variable at the beginning of your script</p>
<p>blnDebug=False</p>
<p>Then throughout your script add lines to echo what the script is doing or the value of differe... | 21,837 |
<p>I need help to replace all \n (new line) caracters for <br /> in a String, but not those \n inside [code][/code] tags.
My brain is burning, I can't solve this by my own :(</p>
<p>Example:</p>
<pre><code>test test test
test test test
test
test
[code]some
test
code
[/code]
more text
</code></pre>
<p>Should be:</p... | <p>I would suggest a (simple) parser, and not a regular expression. Something like this (bad pseudocode):</p>
<pre><code>stack elementStack;
foreach(char in string) {
if(string-from-char == "[code]") {
elementStack.push("code");
string-from-char = "";
}
if(string-from-char == "[/code]") ... | <p>To get it right, you really need to make three passes:</p>
<ol>
<li>Find [code] blocks and replace them with a unique token + index (saving the original block), e.g., "foo [code]abc[/code] bar[code]efg[/code]" becomes "foo TOKEN-1 barTOKEN-2"</li>
<li>Do your newline replacement.</li>
<li>Scan for escape tokens and... | 42,552 |
<p>We work extensively in the .Net Compact Framework and Windows Mobile. I've seen plenty of questions come up regarding specifics to development of ASP.Net apps or other .Net based desktop apps but nothing CF specific.</p>
<p>Anyone else a mobile developer out there that can share some things to start doing, stop doi... | <p>Sure:</p>
<ul>
<li>Use a physical device whenever possible (not the emulator)</li>
<li>Test with multiple devices (different vendors, different models)</li>
<li>Concentrate testing around sleep/wakeup behaviors</li>
<li>When using MSTEST unit tests, never use private accessors</li>
<li>Avoid ActiveSync like the pla... | <p>When doing anything with OutlookSession, always</p>
<ul>
<li>instantiate it on the main (application) thread</li>
<li>execute against it on the main thread
(I use a Control object to Invoke
against)</li>
<li>and dispose of it within a decent
timeframe (if you don't you'll have
strange behavior in Pocket Outlook)</l... | 47,407 |
<p>My cygwin xterm is not responding to the keyboard.</p>
<p>I am able to run rxvt, but when I start other X applications I have the same problem.</p>
<p>From the rxvt command prompt, I get the following:</p>
<pre><code>$ xterm
xterm Xt error: Can't open display: :0
</code></pre>
<p>The contents of my XWin.0.log ar... | <p>See <a href="http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-i-cant-type-anything" rel="nofollow noreferrer">this</a>.</p>
<ol>
<li><p>First stop the server by right-clicking on the X icon in the system tray and choosing exit.</p></li>
<li><p>Run the startxwin.bat file that is located in /usr/bin.</p></li>
</ol>
| <p>Something in the back of my mind is saying "turn off Num Lock".</p>
<p>I'm not sure why.</p>
| 43,905 |
<p>I need some resources for implementing a simple virtual machine and interpreted language. Something that is pratical is most useful. I have read the Virtual Machine Implementation book and found that it is quite old and doesn't represent the vms I see today. Also if someone know of a fairly simplistic language th... | <p>check <a href="http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/jucs05.pdf" rel="nofollow noreferrer">The implementation of Lua 5.0</a></p>
| <p>You don't say if this is for a new project, to work with an existing project, for learning, or what target environment, language, and OS you're using.</p>
<p>If you want to learn about implementing your own VM and scripting language, get the book <a href="https://rads.stackoverflow.com/amzn/click/com/1931841578" re... | 48,318 |
<p>I started to write an application that calculates the estimated total print time from the G-code file for an already sliced model.</p>
<p>The program works and it's pretty accurate.</p>
<p>It works as follows: </p>
<ol>
<li>It scans the entire G-code file to identify all of the movements</li>
<li>It calculates th... | <p>I have tried looking into the printer firmware to see how the <em>Acceleration</em> setting affects the machine movement. From what I could tell, <em>Acceleration</em> seemed to be implemented differently depending on what firmware I looked at and was also affected by what the settings used on the printer were. I d... | <p>I have tried looking into the printer firmware to see how the <em>Acceleration</em> setting affects the machine movement. From what I could tell, <em>Acceleration</em> seemed to be implemented differently depending on what firmware I looked at and was also affected by what the settings used on the printer were. I d... | 459 |
<p>Assuming some background in mathematics, how would you give a general overview of computational complexity theory to the naive?</p>
<p>I am looking for an explanation of the P = NP question. What is P? What is NP? What is a NP-Hard?</p>
<p>Sometimes Wikipedia is written as if the reader already understands all ... | <p>Hoooo, doctoral comp flashback. Okay, here goes.</p>
<p>We start with the idea of a decision problem, a problem for which an algorithm can always answer "yes" or "no." We also need the idea of two models of computer (Turing machine, really): deterministic and non-deterministic. A deterministic computer is the re... | <p>My simplified answer would be: "Computational complexity is the analysis of how much harder a problem becomes when you add more elements."</p>
<p>In that sentence, the word "harder" is deliberately vague because it could refer either to processing time or to memory usage.</p>
| 39,692 |
<p>My build environment is configured to compile, run and create coverage file at the command line (using Ned Batchelder coverage.py tool). </p>
<p>I'm using Eclipse with PyDev as my editor, but for practical reasons, it's not possible/convenient for me to convert my whole build environment to Eclipse (and thus genera... | <p>Here's what I've used successfully in the past:</p>
<p>MsgQueue table schema</p>
<pre><code>MsgId identity -- NOT NULL
MsgTypeCode varchar(20) -- NOT NULL
SourceCode varchar(20) -- process inserting the message -- NULLable
State char(1) -- 'N'ew if queued, 'A'(ctive) if processing, 'C'ompleted, default 'N' --... | <p>You are trying to implement de "Database as IPC" antipattern. Look it up to understand why you should consider redesigning your software properly.</p>
| 38,032 |
<p>I'm using Eclipse 3.4 (Ganymede) with CDT 5 on Windows.</p>
<p>When the integrated spell checker doesn't know some word, it proposes (among others) the option to add the word to a user dictionary.</p>
<p>If the user dictionary doesn't exist yet, the spell checker offers then to help configuring it and shows the "G... | <p>The CDT version of Ganymede apparently shipped improperly configured. After playing around for a while, I have come up with the following steps that fix the problem.</p>
<ol>
<li>Export your Eclipse preferences (File > Export > General > Preferences).</li>
<li>Open the exported file in a text editor.</li>
<li><p>F... | <p>Just a word of warning: If you follow the advice to replace the preference as above, it will affect spell checking if you also use Java. I think all I needed to do was change the "Select spelling engine to use" to the C++ engine (near the top of the preference setting on the preference page General->Editors->Text Ed... | 7,081 |
<p>All right, say I have this:</p>
<pre><code><select id='list'>
<option value='1'>Option A</option>
<option value='2'>Option B</option>
<option value='3'>Option C</option>
</select>
</code></pre>
<p>What would the selector look like if I wanted to get "Opti... | <p>It's looking for an element with id <code>list</code> which has a property <code>value</code> equal to <code>2</code>.<br>
What you want is the <code>option</code> child of the <code>list</code>:</p>
<pre><code>$("#list option[value='2']").text()
</code></pre>
| <p>Try</p>
<pre><code>[...list.options].find(o=> o.value=='2').text
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let text = [...list.o... | 23,896 |
<p>This may appear a newbie question but forgive me I am new to the world of dot Net.</p>
<p>I have to make a desktop application that connects to a local SQL Server database. However in some cases the same database will be running on a server which can be accessed via the internet.</p>
<p>What is the best way to des... | <p>I would personally build that sort of logic into your DAL (Data Access Layer). Be it using ADO.Net or otherwise, the concept remains the same in that you build a flexible way of connecting to both remote databases as well as local databases based on the fact that it's a requirement for your application.</p>
<p>The ... | <p>You could just go the normal route of using ADO.NET connecting to the database server with a connection string through a SqlConnection object. Just make sure the "connecting over the internet" permits that kind of connection (it probably will unless you got some nasty firewall blocking it).</p>
| 38,369 |
<p>Should I create two <code>CFile</code> objects and copy one into the other character by character? Or is there something in the library that will do this for me?</p>
| <p>I would just use the <a href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-copyfile" rel="nofollow noreferrer"><code>CopyFile</code></a> Win32 API function, but the example code in the <a href="https://learn.microsoft.com/en-us/cpp/mfc/reference/cfile-class?view=msvc-160#open" rel="nofollow... | <p>While I appreciate the previous answers, I have found that this <code>FileOperations</code> is a nice wrapper that mimics the way copy operations are performed in Windows Explorer, which also includes Copy, Move and Delete files and rename directories:</p>
<p><a href="http://www.ucancode.net/Visual_C_Source_Code/Cop... | 23,325 |
<p>How do you get a pointer to the .text section of memory for a program from within that program? I also need the length of the section to do a "Flash to Memory" compare as part of a continuous selftest that runs in the background.</p>
<p>The toolset automatically generates the linker .cmd file for the tools I'm usi... | <p>You need to put "variables" in the linker script.</p>
<p>In one of my projects I have this in one of my sections:</p>
<pre><code> __FlashStart = .;
</code></pre>
<p>In the C program I have this:</p>
<pre><code>extern unsigned long int _FlashStart;
unsigned long int address = (unsigned long int)&_FlashStart;... | <p>Could you clarify which tool chain and architecture you are interested in.</p>
<p>On the compiler I am using right now (IAR ARM C/C++) there are operators built into the compiler which return the segment begin address <code>__sfb(...)</code>, segment end address <code>__sfe(...)</code>, and segment size <code>__sfs... | 24,771 |
<p>How do I make one? I am kind of a newbie in Windows API. Is there some sort of manual for this sort of thing? I am specifically interested in a Core API. Thank you for any help.</p>
| <p>There are three ways of doing scroll bars: A window's scroll bar; a scroll bar control; or a custom control.</p>
<p>Windows have scroll bars in the non-client (NC) area. These are part of the window frame, and as such they do not have their own window handle or anything.</p>
<p>Scroll bar controls are child windo... | <p>What do you mean with "infinite"?</p>
<p>If you mean a scroll bar where the user can never scroll to the ends, you have to handle the scroll bar's position change notifications and reset the position to the middle.</p>
| 9,735 |
<p>Several months ago my work deployed an in-house function that wraps the standard, php, mysql_query() function with additional options and abilities. A sample feature would be some handy debugging tools we can turn on/off. </p>
<p>I was wondering how popular query handlers are and what features people like to build ... | <p>I use a DBAL like <a href="http://pear.php.net/package/MDB2" rel="nofollow noreferrer">MDB2</a>, <a href="http://framework.zend.com/manual/en/zend.db.html" rel="nofollow noreferrer">Zend_Db</a> or <a href="http://www.doctrine-project.org/" rel="nofollow noreferrer">Doctrine</a> for similar reason. Primarily to be ab... | <p>We implemented something similar at my office too. It's proven to be an invaluable to tool for the associated handling features it offers. Error tracking, pre-formatted output and it also works as an 'AL' between MsSQL and MySQL.</p>
<p>Aside from the above features I think it'd be cool to have some low-resource ... | 15,672 |
<p>I want to search for <code>$maximumTotalAllowedAfterFinish</code> and replace it with <code>$minimumTotalAllowedAfterFinish</code>. Instead of typing the long text:</p>
<pre><code>:%s/$maximumTotalAllowedAfterFinish/$minimumTotalAllowedAfterFinish/g
</code></pre>
<p>Is there a way to COPY these long variable names... | <p>You can insert the contents of a numbered or named register by typing <kbd>CTRL</kbd><kbd>R</kbd> <kbd><code>{0-9a-z"%#:-=.}</code></kbd>. By typing <kbd>CTRL-R</kbd> <kbd>CTRL-W</kbd> you can paste the current word under the cursor. See:</p>
<pre><code>:he cmdline-editing
</code></pre>
<p>for more information.</p... | <p>Typically, you would do that with mouse selecting (perhaps <kbd>Ctrl</kbd><kbd>Ins</kbd> or <kbd>Ctrl</kbd><kbd>C</kbd> after selecting) and then, when in the command/search line, middle-clicking (or <kbd>Shift</kbd><kbd>Ins</kbd> or <kbd>Ctrl</kbd><kbd>V</kbd>).</p>
<p>Another way, is to write your command/search ... | 12,667 |
<p>If you are writing a <em>simple</em> little loop, what <em>should</em> you name the counter?</p>
<p><em>Provide example loops!</em></p>
| <p>I always use a <strong>meaningful name</strong> unless it's a single-level loop and the variable has no meaning other than "the number of times I've been through this loop", in which case I use <code>i</code>.</p>
<p>When using meaningful names:</p>
<ul>
<li>the code is more understandable to colleagues reading yo... | <p>I've started using perlisms in php. </p>
<p>if its a singular iteration, <code>$_</code> is a good name for those who know its use.</p>
| 12,643 |
<p>I'm using SharpZipLib version 0.85.5 to unzip files. My code has been working nicely for a couple of months until I found a ZIP file that it doesn't like.</p>
<pre><code>ICSharpCode.SharpZipLib.Zip.ZipException: End of extra data
at ICSharpCode.SharpZipLib.Zip.ZipExtraData.ReadCheck(Int32 length) in C:\C#\... | <p>It's possible that the other zip tools are ignoring extra data which is corrupt - or it's equally possible that there's a bug in #ZipLib. (I found one a while ago - a certain file that wouldn't compress and then decompress cleanly with certain options.)</p>
<p>In this particular case, I suggest you post on the #Zip... | <p>I agree with Jon. Couldn't fit following in the comment:</p>
<p>(Though this doesn't answer your question)
Isn't it easier to use something like this:</p>
<pre><code>public static void UnzipFile(string sourcePath, string targetDirectory)
{
try
{
FastZip fastZip = new FastZip();
fastZip.Crea... | 18,668 |
<p>I want do something like this:</p>
<pre><code>Button btn1 = new Button();
btn1.Click += new EventHandler(btn1_Click);
Button btn2 = new Button();
// Take whatever event got assigned to btn1 and assign it to btn2.
btn2.Click += btn1.Click; // The compiler says no...
</code></pre>
<p>Where btn1_Click is already defi... | <p>Yeah, it's technically possible. Reflection is required because many of the members are private and internal. Start a new <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> project and add two buttons. Then:</p>
<pre><code>using System;
using System.ComponentModel;
using System.... | <p>You could use a common event handler for your buttons and your picture boxes (as per the comments on an earlier answer) and then use the 'sender' object to determine how to handle the event at runtime.</p>
| 37,394 |
<p>Some of the most efficient engineers, developers and IT professionals I know usually carry around a common "toolkit" of useful programs, add-ins or utilities which help them for day-to-day debugging, developing or designing.</p>
<p>The question is:<br>
<i>What is in your utility toolkit.. What tools couldn't you li... | <p><a href="http://unxutils.sourceforge.net" rel="noreferrer">Unix Utilities for Windows</a></p>
| <p>Here's <a href="https://web.archive.org/web/20080914042228/http://rabdullin.com/development-software-requirements-for-the-xlim-2-solutions/" rel="nofollow noreferrer">list of tools, utils and progs</a> I use for my .NET software development projects.</p>
| 20,884 |
<p>Good morning,</p>
<p>I work in a small shop (only two of us) and we currently manage more .vbs scripts that we would like to (we would like to manage zero). One of the nice things about these scripts is that it's quick to make changes (as necessary) and go back to our day jobs. </p>
<p>That's all nice and good u... | <p><a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" rel="noreferrer">PowerShell</a> is the "next generation, .NET-based scripting platform" from Microsoft. I haven't looked at it in detail, but from what I've heard it's trying to combine the simplicity of Unix-style p... | <p>Trying to get a fix on the future of VBScript is problematic. Microsoft have said that they're <a href="https://web.archive.org/web/20060511012208/http://www.visualbasicscript.com/m_26652/mpage_1/key_/tm.htm#26652" rel="nofollow noreferrer">committed to keeping it going</a> (second entry). However, whilst there is a... | 41,504 |
<p>Does anyone know of a freeware shipping calculator for PHP? I do not want anything too fancy, and it can be compatible with any of the major US domestic shipping services.</p>
<p>If anyone knows of one that is a plugin for CodeIgniter that would be nice.</p>
<p>Travis</p>
| <p>Usually services like this are based on web services offered from the various couriers. You would send the weight and dimensions of the box you want to ship to their web service, and they would return a corresponding shipping price. Each couriers API would be different. I'm not sure if there are any libraries that... | <p>There is a service that allows you access to their API that intergrates with the APIs of Fedex, USPS, UPS, and DHL. It costs $25/month to be allowed to make requests but its a complete solution. The OP stated "freeware" but I figured others will come across this and appreciate a solution even if you have to pay.</p>... | 41,320 |
<p>I've got a pretty basic question about how to start using Castle Windsor. I've read up on IOC/DI and would like to try Castle Windsor in an existing solution. I typically like to put any external assemblies in a Lib folder within the solution's folder tree so that the references are relative (I believe this is bes... | <p>I reckon this should be enough to get you started.</p>
<ul>
<li>Castle.Core</li>
<li>Castle.MicroKernel</li>
<li>Castle.Windsor</li>
</ul>
<p>and if you want to use log4net for logging then....</p>
<ul>
<li>log4net </li>
<li>Castle.Facilities.Logging </li>
<li>Castle.Services.Logging.Log4netIntegration</li>
</ul>... | <p>Only Castle.Core, Castle.MicroKernel and Castle.Windsor are required to be able to use Windsor.</p>
| 49,237 |
<p>I've managed to mostly ignore all this multi-byte character stuff, but now I need to do some UI work and I know my ignorance in this area is going to catch up with me! Can anyone explain in a few paragraphs or less just what I need to know so that I can localize my applications? What types should I be using (I use b... | <p>Check out Joel Spolsky's <strong><a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="noreferrer">The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)</a></strong></p>
<p><strong>EDIT 20140523</strong>: Also, watch <strong><a hre... | <p>There is also the issue with fonts. There are two ways to handle fonts. Either you use a gigantic font with glyphs for all the Unicode characters you need (I think recent versions of Windows comes with one or two such fonts). Or you use som library capable of combining glyphs from various fonts dedicated to subsets ... | 20,745 |
<p>Ideally, something cross-platform.</p>
| <p>The CPAN is probably the best way to go. Take a look at <a href="http://search.cpan.org/~tpaba/Term-Screen-Uni-0.04/lib/Term/Screen/Uni.pm" rel="noreferrer">Term::Screen:Uni</a>:</p>
<pre><code>require Term::Screen::Uni;
my $scr = new Term::Screen::Uni;
$scr->clrscr()
</code></pre>
| <p><strong>I disagree with the above</strong></p>
<ol>
<li>Connecting additional modules = Increase the attack surface.</li>
<li>Reduce the Amount of Running Code.</li>
<li>Code refactoring.</li>
</ol>
<hr />
<pre><code>#!/usr/bin/perl -w
use strict;
my
( $over, $cleaning );
( $cleaning ) = qq([J\033[H\033[J);
( $over... | 24,093 |
<p><strong>Problem:</strong></p>
<p>Given a list of strings, find the substring which, if subtracted from the beginning of all strings where it matches and replaced by an escape byte, gives the shortest total length.</p>
<p><strong>Example:</strong></p>
<p><code>"foo"</code>, <code>"fool"</code>, <code>"bar"</code><... | <p>Use a forest of prefix trees (trie)...</p>
<pre><code> f_2 b_1
/ |
o_2 a_1
| |
o_2 r_1
|
l_1
</code></pre>
<p>then, we can find the best result, and guarantee it, by maximizing <code>(depth * frequency)</code> which will be replaced with your escape character. You can optimize the sea... | <p>I would try starting by sorting the list. Then you simply go from string to string comparing the first character to the next string's first char. Once you have a match you would look at the next char. You would need to devise a way to track the best result so far.</p>
| 18,166 |
<p>How do you access the response from the Request
object in MooTools? I've been looking at the documentation and the MooTorial, but
I can't seem to make any headway. Other Ajax stuff I've done with
MooTools I haven't had to manipulate the response at all, so I've just
been able to inject it straight into the document,... | <p>The response content is returned to the anonymous function defined in onComplete.</p>
<p>It can be accessed from there.</p>
<pre><code>var req = new Request({
method: 'get',
url: ...,
data: ...,
onRequest: function() { alert('Request made. Please wait...'); },
// the response is passed to the ... | <p>I was able to find my answer on the <a href="http://groups.google.com/group/mootools-users/browse_thread/thread/7ade43ef51c91922" rel="nofollow noreferrer">MooTools Group at Google</a>.</p>
| 12,208 |
<p><strong>Question</strong></p>
<p>How would you go adding automated testing to a game?</p>
<p>I believe you can unit test a lot of the game engine's functionality (networking, object creation, memory management, etc), but is it possible to automate test the actual game itself?</p>
<p>I'm not talking about gameplay... | <p><a href="http://gamesfromwithin.com/?p=97" rel="noreferrer">This post</a> at <a href="http://gamesfromwithin.com" rel="noreferrer">Games From Within</a> might be relevant/interesting. </p>
| <p>This doesn't really answer your question but I was listening to a podcast on <a href="http://research.microsoft.com/pex/" rel="nofollow noreferrer">Pex from microsoft</a> which does a similar thing to the solution you're proposing and when I was listening to it I remember thinking that it would be really interesting... | 3,493 |
<p>I've automated my Ubuntu installation - I've got Python code that runs automatically (after a clean install, but before the first user login - it's in a temporary /etc/init.d/ script) that sets up everything from Apache & its configuration to my personal Gnome preferences. It's the latter that's giving me troubl... | <p>I can reproduce this by installing GConf 2.24 on my machine. GConf 2.22 works fine, but 2.24 breaks it.</p>
<p>GConf is failing to launch because D-Bus is not running. Manually spawning D-Bus and the GConf daemon makes this work again.</p>
<p>I tried to spawn the D-Bus session bus by doing the following:</p>
<pre... | <p>Well, I think I understand the question. Looks like your script just needs to start the dbus daemon, or make sure its started. I believe "session" here refers to a dbus session. <a href="http://mail.gnome.org/archives/svn-commits-list/2008-May/msg01997.html" rel="nofollow noreferrer">(here is some evidence)</a>, not... | 32,153 |
<p>I have a Prusa i3 3D printer and am using Slic3r for slicing.</p>
<p>I've noticed that my extruder is underextruding. I've correctly set the nozzle diameter and the filament diameter and I've already tried to increment the extrusion multiplier (which is currently set to 1.1). As Slic3r suggests this is a maximum val... | <p>I have a Prusa i3 pro b, and was having a similar issues. Turns out the spring for the plastic extruder feeder can be too slack. I printed <a href="https://www.thingiverse.com/thing:1936289" rel="nofollow noreferrer">these</a> at 2 mm and put it under the spring and it solved my issue.</p>
| <p>It looks like the nozzle is too far from the bed, try leveling the bed again - that should solve the problem.</p>
| 1,710 |
<p>The print is a collapsible sword I'm using as a test. Everything seems fine on the outside, but inside it seems the segment parts of the sword inside the hilt are fusing together at the seam lines causing them to stick together.</p>
<p><strong>Model</strong>: <a href="https://thangs.com/designer/3dprintingworld/3d-m... | <p>After some trial and error I found that the issue was stringing due to excess moisture in the filament from being stored outside of a sealed low-humidity container for long periods.</p>
<p>After placing it in a heated dehydrator for 2 days, my next print had low stringing and did not bond interlaced parts together s... | <p>You did well to decrease the temperature. You could go even lower to 200°C
As you noticed, You really have a little bit of stringing between the elements. That's what binds the parts together. Many times when you print only a single part this will be no problem. With many nested parts, you retraction really has to b... | 2,178 |
<p>Are there any conflicts with having any combination of Visual Studio 2003, 2005 and/or 2008 installed? I noticed a related question <a href="https://stackoverflow.com/questions/9693/visual-studio-2005-macros-stop-working-when-visual-studio-2008-is-installed">here</a> but wanted a more general answer.</p>
| <p>6, 2000/2001 (I can't remember which is .net 1.0), 2003, 2005, 2008... of course within .NET you may have issues with getting the right solution with the right version. I haven't really seen any conflicts in particular.</p>
| <p>I've got 2005 and 2008 installed concurrently.</p>
<p>2008 is a superset of 2005, so I have no reason whatsoever to have them both, I just haven't gotten around to un-installing it yet</p>
| 4,892 |
<p>I would like to intercept the event in a .NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it).</p>
<p>Do you have any idea of how I can do that?</p>
| <p>The MouseDoubleClick event of the TabControl seems to respond just fine to double-clicking. The only additional step I would do is set a short timer after the TabIndexChanged event to track that a new tab has been selected and ignore any double-clicks that happen outside the timer. This will prevent double-clickin... | <p>How about subclassing the TabControl class and adding your own DoubleClick event? </p>
| 5,273 |
<p>I apologize in advance if this question seems remedial.</p>
<p>Which would be considered more efficient in Python:</p>
<p><strong>Standard import</strong></p>
<pre><code>import logging
try:
...some code...
exception Exception, e:
logging.error(e)
</code></pre>
<p>...or...</p>
<p><strong>Contextual import</... | <p>Contextual imports are technically more efficient, but I think they can create other problems.</p>
<p>Later, if you want to add a similar except clause, you now have two places to maintain the same block of code. You also now have the problem of testing the exception, to make sure that the first import doesn't caus... | <p>The performance differences between these two approaches will be very small in practice. I have never seen a case where this has made a difference that was noticeable. </p>
<p>It is worth remembering that the python interpreter will only ever do the work of parsing the module once when it is 1st imported.</p>
<p>... | 37,888 |
<p>I print a lot of stuff, and I was thinking I could get several magnetic bed-plates and when 1 print is done simply have my wife pull the plate off and stick on clean plate and start the print again.
But a friend of mine says that won't work. Because even if the plates are made by the same manufacturer you can't guar... | <p>It is a question of quality:</p>
<p>You better make sure that your plates are the same thickness evenly, and level very similarly. If that can be assured, they can be swapped easily.</p>
<p>In case you have a bed leveling sensor of some sort, you might include a whole bed-leveling cycle in front of every print and e... | <p>Yes ,I was also facing the same problem couples of month ago and to solution I had buyed extra plates and <strong>It works perfectly</strong> . Go for the extra beds and buy only from the same manufacturer.</p>
<p>Hope your get your answer</p>
| 2,104 |
<p>SVN externals allow you to make an SVN folder appear as if it's at another location. A good use for this is having a common folder shared across all of your projects in SVN.</p>
<p>I have a /trunk/common folder in SVN that I share via several different project.</p>
<p>Example:</p>
<ul>
<li>Project1 : /trunk/proj... | <p>This is not possible with the current release of Subversion, other than explicitly calling svn log on the target of the externals directory</p>
<p>You can try issueing a feature request at <a href="http://subversion.apache.org/" rel="nofollow noreferrer">the Apache Subversion website</a></p>
| <p>When you display the log for a local versioned folder, it will show the changes that are relative to this particular folder. Externals are only <strong>a link</strong> to a different folder on the repository. The only thing you can track about external references, from a folder which depends on this external project... | 8,822 |
<p>If I notice that a hash table (or any other data structure built on a hash table) is filling up, at what point should you build a new table with more buckets. And given n items in the table so far, how do you figure out how many buckets to use in the new one?</p>
<p>So let's say I have 100 buckets. Should I reorgan... | <p>A good rule of the thumb (not always ideal, well, just a rule of the thumb) is to re-hash if the hashtable is filled up to 80%. That means if you have 100 buckets and 80 items inside, regardless how many collision you had before, it's getting time to increase capacity.</p>
<p>How much should you increase it? Well, ... | <p>Depends on the type of hash table you are building. If you are using a fixed array based hash table (as opposed to linked lists for buckets), you should resize the array either when the table is full or when you have hit a max probe count (depending on whether you care more about speed or memory). If you are using l... | 27,890 |
<p>In general 3D printers are compact and smaller than RP machines. That's ok. But, what's the difference? 3D printers can be used as RP machine too.</p>
| <p>All rapid prototyping means is automatically producing a physical part from a cad model. 3D printing is a way to achieve rapid prototyping. There are 2 main methods of rapid prototyping: additive, and subtractive.</p>
<p>A 3D printer is additive- you add materials to an object layer by layer.</p>
<p>Usually, when ... | <p>A sintered metal printer is a version of a 3D printer that is rapid, but expensive. Seen 1 for 800,000$aud
Uses laser to melt metal particles like titanium.</p>
| 176 |
<p>C++ just sucks too much of my time by making me micro-manage my own memory, making me type far too much (hello <code>std::vector<Thingy>::const_iterator it = lotsOfThingys.begin()</code>), and boring me with long compile times. What's the single best alternative for serious real-time graphics programming? Ga... | <p>C# is a nice language that fits your requirements, and it is definitely suited for graphics, thanks to the efforts of Microsoft to provide it with great tools and libraries like Visual Studio and XNA.</p>
| <p>If your target is a PC, I think you can try C#, or embed <strong>Lua</strong> in your C++ app and run scripts for 'high-level' stuff. However if your target is a console, you <strong>must</strong> manage your own memory!</p>
| 9,853 |
<p>I am implementing a "locking" system in my app which protects my app against being copied and used illegally. The system checks the signature of a hardware-based code and expects it to be signed with a Private Key that only my company owns. (The app has got the Public Key to validate the signature.)</p>
<p>I want t... | <p>Assembly signing is designed to allow applications/assemblies to reference an assembly and be sure that they get the assembly they originally referenced. If someone wanted to, they could in theory decompile your entire app and recompile with no signing. (ie: they could recompile the <em>referencing assembly</em> so ... | <p>One technique you can use is to prevent tampering is to use the public key of your assembly to encrypt essential parts of your software such as application/algorithm parameters. If the public key has been changed, the decryption will not work and your app will crash.</p>
<p>Some obfuscators such as <a href="http://... | 49,448 |
<p>I'm new to ruby and I'm playing around with the IRB.</p>
<p>I found that I can list methods of an object using the ".methods" method, and that self.methods sort of give me what I want (similar to Python's dir(<strong>builtins</strong>)?), but how can I find the methods of a library/module I've loaded via include an... | <p><a href="http://www.ruby-doc.org/core-1.8.7/classes/ObjectSpace.html#M000928" rel="noreferrer">ObjectSpace.each_object</a> could be what you are looking for.</p>
<p>To get a list of included modules you could use <a href="http://www.ruby-doc.org/core/classes/Module.html#M001697" rel="noreferrer">Module.included_mod... | <p>You can pass the .methods messages to the library/module even before loading it, to see all the available methods. Doing <code>self.methods</code> just returns all the methods that the Object object contains. You can see this by doing <code>self.class</code>. So let's say you want to see all the methods in the File ... | 28,295 |
<p>I want to get the full path of the running process (executable) without having root permission using C++ code. Can someone suggest a way to achieve this.</p>
<p>on Linux platforms i can do it by using following way.</p>
<pre><code>char exepath[1024] = {0};
char procid[1024] = {0};
char exelink[1024] = {0};
sprint... | <p>First, I'd like to comment on your Linux solution: it is about 5 times as long as it needs to be, and performs a lot of completely unnecessary operations, as well as using 1024 magic number which is just plain wrong:</p>
<pre><code>$ grep PATH_MAX /usr/include/linux/limits.h
#define PATH_MAX 4096 /* # ch... | <p>I have done this before in a general case. The general idea is to grab argv[0], and do some processing on it:</p>
<pre><code>int main( int argc, char** argv )
{
string full_prog_path = argv[0];
if ( full_prog_path[0] == "/" )
{ // It was specified absolutely; no processing necessary.
}
else
{
str... | 24,495 |
<p>If I am inserting elements into a wrap panel and there is still space in the panel before it overflows on the next line, can I specifically make it wrap over so that the subsequent elements are on the next line?</p>
<p>I am looking for something like this:</p>
<pre><code><WrapPanel>
<Element/>
<... | <p>This works:</p>
<pre><code><WrapPanel>
<TextBlock>1</TextBlock>
<TextBlock>2</TextBlock>
<TextBlock>3</TextBlock>
<TextBlock>4</TextBlock>
<TextBlock Width="10000" Height="0" />
<TextBlock>5</TextBlock>
<TextBlo... | <p>Could just add a Margin to the control that is to be on the new line: </p>
<pre><code><TextBlock Margin="0,20,0,0">5</TextBlock>
</code></pre>
| 44,440 |
<p>I'm generating titles out of a few other fields, and want the "right" way to do:</p>
<pre><code>Me.Title.Value = Join(Array([Conference], [Speaker], partstr), " - ")
</code></pre>
<p>Except any of [conference], [speaker] or partstr might be null, and I don't want the extra "-"'s. Are there any functions that'll m... | <p>Nope - you'll have to check each one and then cleanup at the end</p>
<pre><code>Dim Temp As String
If Not IsNull([Conference]) Then
Temp = Temp & [Conference] & " - "
End If
If Not IsNull([Speaker]) Then
Temp = Temp & [Speaker] & " - "
End If
If Not IsNull(partstr) Then
Temp = Temp & pa... | <p>A complete re-write, and this time properly tested:</p>
<pre><code> IIf(IsNull(Partstr), IIf(IsNull(Conference), Speaker, Conference & " - " + Speaker), Conference + " - " & Speaker + " - " & Partstr)
</code></pre>
| 41,115 |
<p>Our organization has a lot of its essential data in a mainframe Adabas database. We have ODBC access to this data and from C# have queried/updated it successfully using ODBC/Natural "stored procedures".</p>
<p>What we'd like to be able to do now is to query a mainframe table from within SQL Server 2005 stored proc... | <p>Check out <a href="http://msdn.microsoft.com/en-us/library/ms178549(SQL.90).aspx" rel="nofollow noreferrer"><code>SET REMOTE_PROC_TRANSACTIONS OFF</code></a> which should disable it.
Or <a href="http://msdn.microsoft.com/en-us/library/ms178532.aspx" rel="nofollow noreferrer"><code>sp_serveroption</code></a> to confi... | <p>I'm not sure about DTC, but DTSX (Integration Services) may be useful for moving the data. However, if you can simply query the data, you may want to look at adding a linked server for direct access. You could then just write a simple query to populate your table based on a select from the linked server's table.</p... | 14,127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.