instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP</p>
<pre><code><?php
$class_name = 'SomeClassName';
$object = new $class_name;
?>
</code></pre>
<p>This is a contrived example, but I've seen this form used in Factories (OOP) to... | <p>One of the issues with the resolving at run time is that you make it really hard for the opcode caches (like APC). Still, for now, doing something like you describe in your question is a valid way if you need a certain amount of indirection when instanciating stuff.</p>
<p>As long as you don't do something like</p>... | <p>I use dynamic instantiation in my custom framework. My application controller needs to instantiate a sub-controller based on the request, and it would be simply ridiculous to use a gigantic, ever-changing switch statement to manage the loading of those controllers. As a result, I can add controller after controller ... | 7,037 |
<p>I have a small financial application with PHP as the front end and MySQL as the back end. I have ancient prejudices, and I store money values in MySQL as an integer of cents. My HTML forms allow input of dollar values, like "156.64" and I use PHP to convert that to cents and then I store the cents in the database.</... | <p>If you want precision, you should store your money values using the <a href="http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html" rel="nofollow noreferrer">DECIMAL</a> data type in MySQL.</p>
| <p>Instead of using</p>
<p>$cents = (integer) ($dollars * 100);</p>
<p>you may want to try to use:</p>
<p>$cents = bcmul($dollars, 100, 2);</p>
| 23,526 |
<p>I have something here that is really catching me off guard.</p>
<p>I have an ObservableCollection of T that is filled with items. I also have an event handler attached to the CollectionChanged event.</p>
<p>When you <strong>Clear</strong> the collection it causes an CollectionChanged event with e.Action set to Not... | <p>It doesn't claim to include the old items, because Reset doesn't mean that the list has been cleared</p>
<p>It means that some dramatic thing has taken place, and the cost of working out the add/removes would most likely exceed the cost of just re-scanning the list from scratch... so that's what you should do.</p>
... | <p><a href="http://msdn.microsoft.com/en-us/library/system.collections.specialized.notifycollectionchangedaction(VS.95).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.collections.specialized.notifycollectionchangedaction(VS.95).aspx</a></p>
<p>Please read this documentation with your eyes open and... | 27,689 |
<p>I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list:</p>
<pre><code>public IList<Customer> GetCustomerByFirstName(string customerFirstName)
{
return _session.CreateCriteria(typeof(Customer))
.Add(new NHibernate.Expression.EqExpression... | <p>Always be careful with NULLable fields whenever you deal with NHibernate. If your field is NULLable in DB, make sure corresponding .NET class uses Nullable type too. Otherwise, all kinds of weird things will happen. The symptom is usually will be that NHibernate will try to update the record in DB, even though you h... | <p>I also experienced this problem in NH 2.0.1 when trying to hide the inverse ends of many-to-many bags using access="noop" (hint: this doesn't work). </p>
<p>Converting them to access="field" + adding a field on the class fixed the problem. Pretty hard to track them down though.</p>
| 5,522 |
<p>I need to execute a select and then update some of the rows in the <code>ResultSet</code> in an atomic way.</p>
<p>The code I am using looks like (simplified):</p>
<pre><code>stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT ...");
while (rs.ne... | <p>There's probably a whole heap of technologies and concepts that come into play here, and things start to get fairly sticky when you start considering multi-threaded / multi request applications.</p>
<p>As Iassevk stated, you should look into using <a href="http://java.sun.com/docs/books/tutorial/jdbc/basics/transac... | <p>Use transactions.</p>
| 25,978 |
<p>How do you do low low level sockets in C, example: actually sending a SYN.</p>
| <p>What you actually want is a raw socket ... you can completely control the headers and flags with the raw socket interface, but programming them is much more challenging. Here's a great tutorial to get you started: <a href="http://www.cs.binghamton.edu/~steflik/cs455/rawip.txt" rel="nofollow noreferrer">http://www.c... | <p>I suspect the nmap sources would be an excellent place to look.</p>
| 15,194 |
<p>In C#, when you implement an interface, all members are implicitly public. Wouldn't it be better if we could specify the accessibility modifier (<code>protected</code>, <code>internal</code>, except <code>private</code> of course), or should we just use an abstract class instead?</p>
| <p>If an interface is internal, all its members will be internal to the assembly. If a nested interface is protected, only the subclasses of the outer class could access that interface.</p>
<p>Internal members for an interface outside of its declaring assembly would be pointless, as would protected members for an inte... | <p>I'm familiar with Java rather than C#, but why an earth would you want a private member within an interface? It couldn't have any implementation and would be invisible to implementing classes, so would be useless. Interfaces exist to specify behaviour. If you need default behaviour than use an abstract class.</p>
| 3,818 |
<p>How do Window's programmers profile their native C++ code?
On Unix/Linux you have gprof <em>[thanks Evan]</em> & valgrind (I personally used this one, although it's not a real profiler), and recently I'm on Mac and Solaris, which means I moved to dTrace. Now when I've had the need to profile on Windows in the pa... | <p>You should give <a href="http://blogs.msdn.com/pigscanfly/archive/2008/02/09/xperf-a-new-tool-in-the-windows-sdk.aspx" rel="nofollow noreferrer">Xperf</a> a try - it's a new system wide performance tool that can drill down to a particular application and what exactly it's doing inside itself as well as what's it's a... | <p><a href="https://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux/378024#378024">This link</a> talks about Linux, but I use the same technique in MSVC and in C#.</p>
| 40,858 |
<p>Computer Management -> Services and Applications -> Message Queues</p>
<p>How to delete a message from a specific queue?
It seems to me there was some way but I cannot find it right now.</p>
| <p>Well, it isn't possible to delete a poison message by MMC. </p>
<p>You can try <a href="http://www.cogin.com/mq/download.php" rel="nofollow noreferrer">QueueExplorer</a> and maybe that will help you out, or you have to programmically to solve your issues</p>
| <p>In Windows 10 you can empty a queue in Computer Management --> Services and Applications --> Message Queuing by right-clicking the queue and selecting All Tasks --> Purge:</p>
<p><a href="https://i.stack.imgur.com/WON1y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WON1y.jpg" alt="enter image d... | 25,013 |
<p>I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error "Sys is undefined".</p>
<p>It doesn't happen all the time, but it is reproducible. When it happens, the user has to ... | <p>I fixed my problem by moving the <code><script type="text/javascript"></script></code> block containing the Sys.* calls lower down (to the last item before the close of the body's <code><asp:Content/></code> section) in the HTML on the page. I originally had my the script block in the HEAD <code>&l... | <p>Please please please do check that the Server has the correct time and date set...</p>
<p>After about wasting 6 hours, i read it somewhere...</p>
<p>The date and time for the server must be updated to work correctly...</p>
<p>otherwise you will get 'Sys' is undefined error.</p>
| 10,096 |
<p>Within Ruby on Rails applications database.yml is a plain text file that stores database credentials.</p>
<p>When I deploy my Rails applications I have an after deploy callback in my Capistrano
recipe that creates a symbolic link within the application's /config directory to the database.yml file. The file itself ... | <p>You'll also want to make sure that your SSH system is well secured to prevent people from logging in <em>as</em> your Capistrano bot. I'd suggest restricting access to password-protected key pairs.</p>
<p>Encrypting the .yml file on the server is useless since you have to give the bot the key, which would be store... | <p>If you're very concerned about security of the yml file, I have to ask: Is it stored in your version control? If so, that's another point where an attacker can get at it. If you're doing checkout/checkin over non-SSL, someone could intercept it.</p>
<p>Also, with some version control (svn, for exampl), even if yo... | 3,889 |
<p>I have a function I've written that was initially supposed to take a string field and populate an excel spreadsheet with the values. Those values continually came up null. I started tracking it back to the recordset and found that despite the query being valid and running properly through the Access query analyzer... | <p>When using ADO LIKE searches must use % instead of *. I know * works in Access but for some stupid reason ADO won't work unless you use % instead. </p>
<p>I had the same problem and ran accoss this forum while trying to fix it. Replacing *'s with %'s worked for me.</p>
| <p>I put brackets around the word "Description" in the SELECT statement, but it's behavior remains. It works fine as long as I don't put anything in the WHERE clause. I've found if I put anything in the where clause, the description is blank (despite showing up in the Query analyzer). If I use a LIKE statement in th... | 31,656 |
<p>For example, how can I run me.test below?</p>
<pre><code>myvar = 'test'
me.myvar
</code></pre>
<p>ASP looks for the method "myvar" and doesn't find it. In PHP I could simply say $me->$myvar but ASP's syntax doesn't distinguish between variables and methods. Suggestions?</p>
<p>Closely related to this, is there a ... | <p>You can achieve this in VBScript by using the <code>GetRef</code> function:-</p>
<pre><code>Function Test(val)
Test = val & " has been tested"
End Function
Dim myvar : myvar = "Test"
Dim x : Set x = GetRef(myvar)
Response.Write x("Thing")
</code></pre>
<p>Will send "Thing has been tested" to the client.</p>... | <p>ASP does not support late binding in this manner. What are you trying to do, in a larger sense? Explain that, and someone can show you how to accomplish it in asp.</p>
| 43,543 |
<p>I have great doubts about this forum, but I am willing to be pleasantly surprised ;) <strong>Kudos and great karma to those who get me back on track.</strong></p>
<p>I am attempting to use the blitz implementation of JavaSpaces (<a href="http://www.dancres.org/blitz/blitz_js.html" rel="nofollow noreferrer">http://w... | <p>So com.sun.jini.mahalo.TxnMgrProxy is contained in some jar, that is contained in your CLASSPATH environment variable.</p>
<p>But probably your are using some script to start the server. And this most probably starts java by specifying a "-classpath" commandline switch which takes precendence over your environment ... | <p>Well, your java spaces server does not seem to find the class:</p>
<p>com.sun.jini.mahalo.TxnMgrProxy.</p>
<p>So I guess you just have to add Mahalo (should be included in the blitz distribution according to this: <a href="http://www.dancres.org/blitz/blitz_inst.html" rel="nofollow noreferrer">http://www.dancres.o... | 15,560 |
<p>I need to find out time taken by a function in my application. Application is a MS VIsual Studio 2005 solution, all C code. </p>
<p>I used thw windows API GetLocalTime(SYSTEMTIME *) to get the current system time before and after the function call which I want to measure time of.
But this has shortcoming that it lo... | <p>There are some other possibilities.</p>
<h2>QueryPerformanceCounter and QueryPerformanceFrequency</h2>
<p><a href="http://msdn.microsoft.com/en-us/library/ms644904.aspx" rel="noreferrer">QueryPerformanceCounter</a> will return a "performance counter" which is actually a CPU-managed 64-bit counter that increments f... | <p>On Windows you can use the 'high performance counter API'. Check out: <a href="http://msdn.microsoft.com/en-us/library/ms644904(VS.85).aspx" rel="nofollow noreferrer">QueryPerformanceCounter</a> and <a href="http://msdn.microsoft.com/en-us/library/ms644905(VS.85).aspx" rel="nofollow noreferrer">QueryPerformanceCoun... | 7,231 |
<p>I'm working on a project that generates PDFs that can contain fairly complex math and science formulas. The text is rendered in Times New Roman, which has pretty good Unicode coverage, but not complete. We have a system in place to swap in a more Unicode complete font for code points that don't have a glyph in TNR ... | <p>Here's a pass at it using c# and the windows API.</p>
<pre><code>[DllImport("gdi32.dll")]
public static extern uint GetFontUnicodeRanges(IntPtr hdc, IntPtr lpgs);
[DllImport("gdi32.dll")]
public extern static IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
public struct FontRange
{
public UInt16 Low;
pub... | <p>This Microsoft KB article may help:
<a href="http://support.microsoft.com/kb/241020" rel="nofollow noreferrer">http://support.microsoft.com/kb/241020</a></p>
<p>It's a bit dated (was originally written for Windows 95), but the general principle may still apply. The sample code is C++, but since it's just calling st... | 12,939 |
<p>See title: what does it mean for a C++ function to be inline?</p>
| <p>The function is placed in the code, rather than being called, similar to using macros (conceptually).</p>
<p>This can improve speed (no function call), but causes code bloat (if the function is used 100 times, you now have 100 copies).</p>
<p>You should note this does not force the compiler to make the function inli... | <p>Informally, it means that compilers are allowed to graft the contents of the function onto the call site, so that there is no function call. If your function has big control statements (e.g., <code>if</code>, <code>switch</code>, etc.), and the conditions can be evaluated at compile time at the call site (e.g., cons... | 18,923 |
<p>I have a .NET dll which needs to read it's config settings from it's config file. Usually, the config file is placed in the same directory as the DLL. But how do i read the config file if the DLL is GAC'ed, because I can put only the DLLs in the GAC, and not it's config files.</p>
| <p>Does the user need to configure the Dll? If so, then the DLL should be using configuration settings from the app.config file, not it's own config. The app.config file should be stored in the same directory as the application. If not, then you could go a couple of different ways. You could make changes to the mac... | <p>You can make use of <code>AppDomain.CurrentDomain.BaseDirectory</code> since the DLL library will not be executed by itself you just need to get Executable file directory who is calling him</p>
<p>Something like:</p>
<pre><code>var appDomain = AppDomain.CurrentDomain.BaseDirectory;
string sFileName = appDomain.Re... | 40,115 |
<p>This question is a follow up on one of my other questions, <a href="https://stackoverflow.com/questions/94346/can-i-legally-incorporating-gpl-lgpl-open-sourced-software-in-a-proprietary-clo">Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project?</a></p>
<p>Many of... | <p>Yes it does. One of the reasons the GPL came into being in the first place was to prevent the situation where somebody had a binary, but no source to go with it. </p>
<p>IANAL, so I can't speak to whether the consultancy-client relationship would constitute a loophole which you could use to avoid passing on source ... | <p>Any time you give someone else a copy of some software you have distributed that software. It does not have to be to the public at large to qualify as distribution.</p>
| 12,028 |
<p>When I parse my xml file (variable f) in this method, I get an error </p>
<blockquote>
<p>C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified)</p>
</blockquote>
<p>I know I do not have the dtd, nor do I need it. How can I parse this File object into a ... | <p>A similar approach to the one suggested by <a href="https://stackoverflow.com/questions/155101/make-documentbuilderparse-ignore-dtd-references#155330">@anjanb</a></p>
<pre><code> builder.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String publicId, String sy... | <p>I'm working with sonarqube, and sonarlint for eclipse showed me <strong>Untrusted XML should be parsed without resolving external data (squid:S2755)</strong></p>
<p>I managed to solve it using:</p>
<pre><code> factory = DocumentBuilderFactory.newInstance();
factory.setFeature("http://apache.org/xml/feature... | 18,753 |
<p>Can you use Windows Workflow and Compact Framework 3.5?</p>
<p>I've just got an evaluation version of Visual Studio 2008 and I've had a look around but can't work out quickly if there is a way of doing this.
I just don't want to waste anymore time looking around if there is no way of doing it.</p>
| <p>The best answer I've come across is a "No." at this point. I haven't been able to find anything or see anything that says otherwise as well. Looks like other folks are <a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=4014836&SiteID=1" rel="nofollow noreferrer">asking</a> as well.</p>
| <p>I think the answer is 'No', although I have no definite proof. It certainly wouldn't have been in any version of compact framework earlier than 3.5. According to the release notes, it looks like compact framework 3.5 adds WCF, but no WF. Definite proof would be to try and fail and find WF dlls inside the framework i... | 33,233 |
<p>I'm writing a C++ client which is using libcurl for communicating with a PHP script.</p>
<p>The communication should be session based, and thus the first task is to login and make the PHP script set up a session.</p>
<p>I'm not used to working with sessions either from C++ or PHP. I basically know that it has to d... | <p>As far as I understand it, CURL will handle session cookies automatically for you if you enable cookies, as long as you reuse your CURL handle for each request in the session:</p>
<pre><code>CURL *Handle = curl_easy_init();
// Read cookies from a previous session, as stored in MyCookieFileName.
curl_easy_setopt( H... | <p>A session in PHP has the purpose of preserving some state over several requests, since HTTP in itself is stateless. To get a session from PHP, simply request a php page that starts a session, and keep the cookie you get back for subsequent requests.</p>
<p>Starting a session in php is simple - call the session_star... | 24,954 |
<p>I need a SQL query that returns ContactDate, SortName, City, ContactType, and Summary from the tables below. If any value is null, I need it to return the text “No Entry”.</p>
<p><strong>ContactTable</strong></p>
<ul>
<li><em>ContactID</em></li>
<li>ContactDate </li>
<li>UserID </li>
<li>Summary </li>
<li>ContactT... | <pre><code>SELECT COALESCE(CAST(CONVERT(VARCHAR(10), ContactTable.ContactDate, 101) AS VARCHAR(10)), 'No Entry') AS ContactDate,
COALESCE(ContactTable.SortName, 'No Entry') AS SortName,
COALESCE(AddressTable.City, 'No Entry') AS City,
COALESCE(ContactTable.ContactType, 'No Entry') AS ContactType
FR... | <p>Using '<strong>IIF</strong>' is an Access DB solution but may work in other DBs.</p>
<pre><code>SELECT IIF(IsNull(Foo), 'No Entry' ,Foo), IIF(IsNull(Bar), 'No Entry' ,Bar) From TableName
</code></pre>
<p>The function IIF returns one of 2 values depends of the evaluation of an expression.<br>
SQL Syntax:
I... | 25,326 |
<p>Is the sorting algorithm used by .NET's <code>Array.Sort()</code> method a <a href="http://en.wikipedia.org/wiki/Stable_sort#Classification" rel="noreferrer">stable</a> algorithm?</p>
| <p>From <a href="http://msdn.microsoft.com/en-us/library/6tf1f0bc.aspx" rel="noreferrer">MSDN</a>:</p>
<blockquote>
<p>This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.</p>
... | <p><strong>UPDATE:</strong> This code not stabilizing Array.Sort (ensure that the elements are always sorted in the same order):</p>
<pre><code>public static class ComparisonExtensions
{
public static Comparison<T> WithGetHashCode<T>(this Comparison<T> current)
{
return (x, y) =>
... | 17,840 |
<p>I am building application that required some data from iPhone's Call log(read only).
The call log is a sqlite db located at "<em>/User/Library/CallHistory/call_history.db</em>". I used a jailbroken device to extract the log.
However trying to open this location using the <em>sqlite_open3()</em> command I get a <em>S... | <p>There is no access to the call log from Cocoa Touch or other iPhone APIs.</p>
| <p>Honestly, how can you imagine they would let you access the whole Call log? How about you transmit it over the Internet once you have fetched it and make good use of this information?</p>
| 44,407 |
<p>I'm trying to model the threads of a "Poland Spring" 500 ml bottle so I can 3D print an adapter for it. But I can't find information about it. I emailed them but they said they didn't have the information.</p>
<p>How can I find this information out?</p>
<p>The bottle seems to use non standard threads. It u... | <p>You can use a program known as <a href="http://www.openscad.org/" rel="nofollow noreferrer">OpenSCAD</a> with the <a href="https://dkprojects.net/openscad-threads/" rel="nofollow noreferrer">threads library</a> to assist your objective.</p>
<p>The important aspects of a thread are the major diameter (outside diamete... | <p>It's really unlikely that a bottle is using nonstandard threads; the engineering and tooling cost for doing so would not make sense. Most plastic drink bottles use PCO 1881 or PCO 1810 threads. If not, it should be one of a number of other less widely used standards.</p>
<p>The industry term for drink bottle thread ... | 1,721 |
<p>How do you add a JAR file to an already existing Java library in Eclipse? Note that this is not a user library.</p>
<p>That is, if you look at the Java Build Path for a Java project and click on the Libraries tab, you will see the list of libraries used by the project. If you expand a given library, you will see ... | <p>In eclipse Galileo :</p>
<ul>
<li>Open the project's properties</li>
<li>Select <em>Java Build Path</em></li>
<li>Select <em>Libraries</em> tab</li>
</ul>
<p>From there you can Add External Jars</p>
| <p>You might also consider using a build tool like Maven to manage your dependencies. It is very easy to setup and helps manage those dependencies automatically in eclipse. Definitely worth the effort if you have a large project with a lot of external dependencies.</p>
| 21,588 |
<p>I am a bit confused in what the application controller should do? Because I see the functionality will also exists in your MVP pattern to make the decisions which form should be shown when a button is clicked? Are there any good examples for Windows Forms that uses the application controller pattern?</p>
<p>There ... | <p>I recently wrote an article on creating and using an ApplicationController in a C# Winforms project, to decouple the workflow and presenters from the forms directly. It may help:</p>
<p><a href="http://www.lostechies.com/blogs/derickbailey/archive/2009/04/18/decoupling-workflow-and-forms-with-an-application-control... | <p>Personally I have no experience with MVP or winforms, but I have worked with MVC. I hope this is what you're asking, otherwise ignore my answer completely.</p>
<p>The C in MVC is responsible for more than just choosing the next view to be presented to the client. It holds most, preferably <b>all</b>, business-logic... | 14,687 |
<p>How do type casting happen without loss of data inside the compiler?</p>
<p>For example:</p>
<pre><code> int i = 10;
UINT k = (UINT) k;
float fl = 10.123;
UINT ufl = (UINT) fl; // data loss here?
char *p = "Stackoverflow Rocks";
unsigned char *up = (unsigned char *) p;
</code></pre>
<p>How does the compil... | <p>Well, first note that a cast is an <em>explicit request to convert a value of one type to a value of another type</em>. A cast will also always produce a new object, which is a temporary returned by the cast operator. Casting to a reference type, however, will not create a new object. The object referenced by the va... | <p>Casts mean different things depending on what they are. They can just be renamings of a data type, with no change in the bits represented (most casts between integral types and pointers are like this), or conversions that don't even preserve length (such as between double and int on most compilers). In many cases,... | 44,230 |
<p>I need a webserver to serve up very simple POST/GET requests as JSON. I don't need MVC, Rails, Django. I need something that takes up very little memory, preferrably around 5K per reqeust. The webserver will talk to backend services like Scribe using Facebook Thrift. Each http request will also access a SQLLite ... | <p>I've had a good experience with nginx (<a href="https://nginx.org/" rel="nofollow noreferrer">https://nginx.org/</a>), that said, when choosing a webserver, you should look closely at your requirements and make an informed decision as these things can be very application specific.</p>
<p>You'll notice that in this ... | <p>Take a look at klone at koanlogic.com site ... being targeted at embedded systems it's very small, and incidentally very fast too: <a href="http://john.freml.in/teepeedee2-vs-klone" rel="nofollow noreferrer">http://john.freml.in/teepeedee2-vs-klone</a> .
It can be scripted in C/C++ (ultra performant) or usual PHP/CG... | 30,974 |
<p>Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing <code>Func<T, bool></code> vs. <code>Predicate<T></code> </p>
<p>I would imagine there is no difference as both take a generic parameter and return bool?</p>
| <p>They share the same signature, but they're still different types.</p>
| <p>Even without generics, you can have different delegate types that are identical in signatures and return types. For example:</p>
<pre><code>namespace N
{
// Represents a method that takes in a string and checks to see
// if this string has some predicate (i.e. meets some criteria)
// or not.
internal delega... | 5,269 |
<p>From C# on a Windows box, is there a way to find out how a process was stopped?
I've had a look at the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx" rel="nofollow noreferrer">Process</a> class, managed to get a nice friendly callback from the Exited event once I set <code>EnableR... | <p>Fire up Process Monitor (from Sysinternals, part of Microsoft), run your process and let it die, then filter the Process Monitor results by your process name -- you will be able to see everything that it did, including exit codes.</p>
| <p>You can use the return code of the process for that. If your process returns a non-zero value from its Main method, you can then check whether or not the process exited by itself (the return value matches).</p>
| 8,249 |
<p>I have a web forum that I have coded in Python for the App Engine platform. I have noticed that it is not being indexed well by Google and I am trying to fix that.<br>
I have used Google Webmaster to submit a sitemap with almost 400 URLs but apparently only 8 were indexed!<br>
I even get a warning stating:</p>
<blo... | <p>The real thing to look out for it stuff like:</p>
<pre><code> http://www.example.com/forum.py?thread=1000
http://www.example.com/forum.py?thread=1000&mode=printer
</code></pre>
<p>The web crawler sees two different URLs with the same content and assume you are trying to do something fishy. You need to make su... | <p>URL content is part of the picture, but only a small part.</p>
<p>Having the URL say readforum2106 instead of /readforum?id=2106 doesn't do anything, unless someone is searching for the word "readforum". To have the URL really help, you need to include some good search terms in the text, which just doesn't make se... | 46,618 |
<p>I'm running PHP 5.2.6 on a Windows Server 2003 Enterprise box. IIS is set to deny anonymous access and use Integrated Windows authentication.</p>
<p>I'm using a PHP script to save a file uploaded from a web form. The file is uploaded to a temp folder, the script creates a file name and path depending on other vari... | <p>This seems to be an issue with the <code>move_uploaded_file()</code> function:<br>
<a href="http://us3.php.net/move_uploaded_file" rel="nofollow noreferrer">http://us3.php.net/<code>move_uploaded_file</code></a><br>
Take a look at the comments below, take note of Florian's comment about copy().<br>
<br>
Would copy()... | <p>This seems to be an issue with the <code>move_uploaded_file()</code> function:<br>
<a href="http://us3.php.net/move_uploaded_file" rel="nofollow noreferrer">http://us3.php.net/<code>move_uploaded_file</code></a><br>
Take a look at the comments below, take note of Florian's comment about copy().<br>
<br>
Would copy()... | 25,219 |
<p>I have Java and Flash client applications. What is the best way for the two to communicate without special Flash-specific servers such as BlazeDS or Red5? I am looking for a light client-only solution.</p>
| <p>Well, you can make http requests from flash to any url... so if your java server has a point where it can listen to incoming requests and process XML or JSON, your flash client can just make the request to that url. BlazeDS and Red5 just aim to make it simpler by handling the translation for you making it possible t... | <p>WebORB for Java may be of some help to you. It integrates with your J2EE code.</p>
<p>For more info:
<a href="http://www.themidnightcoders.com/weborb/java/" rel="nofollow noreferrer">http://www.themidnightcoders.com/weborb/java/</a></p>
<p>I'm sorry, I reread your question that you are only looking for a client s... | 12,949 |
<p>I'm printing on an Ender 5 with the default flex/magnetic build surface.
I read that PLA and PETG may sometimes be printed without any bed heating at all and also that bed heating is the main contributor to the power consumption of a printer.</p>
<p>As I do see that bed heating definitely helps with the first layer... | <p>There are three reasons (I can think of):</p>
<ol>
<li><p>A large problem you'd face with allowing the bed to cool after first layer is you stand the chance of losing adhesion after it cools. When you heat the bed, it expands somewhat. When it cools it contracts. It has been known for parts to actually pop off the ... | <p>A way to save energy would be use a pretty tight enclosure around the printer, I think a pretty thin layer of insulation would be enough to reduce power usage by a large factor. I've not build one myself yet but there seems to be so many benefits.</p>
| 1,426 |
<pre><code>#include<iostream>
using namespace std;
class A
{
int a;
int b;
public:
void eat()
{
cout<<"A::eat()"<<endl;
}
};
class B: public A
{
public:
void eat()
{
cout<<"B::eat()"<<endl;
}
};
class C: public A
{
public:
void eat()
... | <h2>Inheriting twice</h2>
<p>With double inheritance you have an ambiguity - the compiler cannot know which of the two A bases do you want to use. If you want to have two A bases (sometimes you may want to do this), you may select between them by casting to B or C. The most appropriate from default casts here is the <... | <p>First of all, <code>obj</code> does not have a member named B. It Inherits from B, which means that it inherits all of B's members as its own.</p>
<p>You can call:</p>
<p><pre><code>foo(static_cast<B*>(&obj));</code></pre> to make it work.</p>
| 49,866 |
<p>I have implemented a YUV to RGB conversion via a fragment shader written in Nvidia's shader language. (Y, U and V are stored in separate textures that are combined via multi texturing in my fragment shader). It works great under OpenGL, but under Direct3D I just can't get the output image to look right. I'm starting... | <p>We figured it out. :) Basically the problem was that while our YUV to RGB equations were correct, we weren't properly sampling the V data! So no amount of futzing with the equations would have helped!</p>
<p>In the end, I would recommend the following strategy for anyone attempting to do this:</p>
<p>1) Set R, G, ... | <p>The only suggestion that comes to mind is that the textures are in an inappropriate format (low-precision or compressed).</p>
<p>Can you describe in what way the output looks wrong? Any chance of a right vs wrong screenshot?</p>
| 17,493 |
<p>I have a class derived from <code>CTreeCtrl</code>. In <code>OnCreate()</code> I replace the default <code>CToolTipCtrl</code> object with a custom one:</p>
<pre><code>int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTreeCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
// Replace tool... | <p>Finally! I (partially) solved it:</p>
<p>It looks like the CDockablePane parent window indeed caused this problem...</p>
<p>First I removed all the tooltip-specific code from the CTreeCtrl-derived class. Everything is done in the parent pane window.</p>
<p>Then I edited the parent window's <code>OnCreate()</code>... | <p>Try to specifically handle all tooltip ids:</p>
<pre><code>ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT, 0, 0xFFFF, &CMyTreeCtrl::OnNeedTipText)
</code></pre>
<p>If that doesn't work, you may have to manually call RelayEvent() from PreTranslateMessage().</p>
| 33,907 |
<p>If you've used Oracle, you've probably gotten the helpful message "ORA-00942: Table or view does not exist". Is there a legitimate technical reason the message doesn't include the name of the missing object? </p>
<p>Arguments about this being due to security sound like they were crafted by the TSA. If I'm an attack... | <p>You can set an EVENT in your parameter file (plain text or spfile) to force Oracle to dump a detailed trace file in the user_dump_dest, the object name might be in there, if not the SQL should be.</p>
<p>EVENT="942 trace name errorstack level 12"</p>
<p>If you are using a plain text file you need to keep all your ... | <p>@Matthew</p>
<p>Your query's a start, but it might not work when you have multiple schemas. For example, if I log into our instance as myself, I have read access to all our tables. But if I don't qualify the table name with the schema I'll get an ORA-00942 for tables without synonyms:</p>
<pre>
SQL> select * fro... | 6,850 |
<p>I have a fairly simple const struct in some C code that simply holds a few pointers and would like to initialize it statically if possible. Can I and, if so, how?</p>
| <p>You can, if the pointers point to global objects:</p>
<pre><code>// In global scope
int x, y;
const struct {int *px, *py; } s = {&x, &y};
</code></pre>
| <p>But if there is some <code>struct</code> as following:</p>
<pre><code>struct Foo
{
const int a;
int b;
};
</code></pre>
<p>and we want to dynamically create the pointer to the <code>struct</code> using <code>malloc</code>, so can we play the trick:</p>
<pre><code>struct Foo foo = { 10, 20 };
char *ptr = (... | 24,246 |
<p>You'll have to forgive my ignorance, but I'm not used to using wide character sets in c++, but is there a way that I can use wide string literals in c++ without putting an L in front of each literal?</p>
<p>If so, how?</p>
| <p>No, there isn't. You have to use the L prefix (or a macro such as _T() with VC++ that expands to L anyway when compiled for Unicode).</p>
| <p>Why do you not want to prefix string literals with an L? It's quite simple - strings without an L are ANSI strings (<code>const char*</code>), strings with an L are wide-character strings (<code>const wchar_t*</code>). There is the <code>TEXT()</code> macro, which makes a string literal into an ANSI or a wide-char... | 32,506 |
<p>How do I set the date/time of the computer in C#?</p>
| <p>You can set the date using <a href="http://msdn.microsoft.com/en-us/library/9z20y6ha(VS.80).aspx" rel="nofollow noreferrer">Microsoft.VisualBasic.Today</a> and <a href="http://msdn.microsoft.com/en-us/library/8hhbhw4c(VS.80).aspx" rel="nofollow noreferrer">Microsoft.VisualBasic.TimeOfDay</a>, although they're subjec... | <p>You will need to call the <a href="http://www.pinvoke.net/default.aspx/kernel32.SetSystemTime" rel="nofollow noreferrer">SetSystemTime</a> Win32 API function through P/Invoke.</p>
| 35,226 |
<p>I read in <a href="http://www.ddj.com/hpc-high-performance-computing/210605281" rel="noreferrer">this article </a> that a company has created a software capable of using multiple GPU-based video cards in parallel to process hundreds of billions fixed-point calculations per second.</p>
<p>The program seems to run in... | <p>I imagine that they are using a language like <a href="http://en.wikipedia.org/wiki/CUDA" rel="nofollow noreferrer">CUDA</a> to program the critical sections of code on the GPUs to accelerate their computation.</p>
<p>The main function for the program (and its threads) would still run on the host CPU, but data are ... | <p>A good place to start - <a href="http://en.wikipedia.org/wiki/GPGPU" rel="nofollow noreferrer">GPGPU</a></p>
<p>Also, for the record, I don't think there is such a thing as non-GPU based graphic cards. GPU stands for graphics processing unit which is by definition the heart of a graphics card.</p>
| 19,959 |
<p>I'm trying to search multiple attributes in XML :</p>
<pre><code><APIS>
<API Key="00001">
<field Username="username1" UserPassword="password1" FileName="Filename1.xml"/>
<field Username="username2" UserPassword="password2" FileName="Filename2.xml"/>
<field Username="username... | <p>To search for what you want in the snippet of XML you provided, you would need the following XPath expression:</p>
<pre><code>/APIS/API/field[@Username='username1' and @UserPassword='password1']
</code></pre>
<p>This would either return something, if user name and password match - or not if they don't.</p>
<p>Of ... | <p>To search for multiple attributes in case of XML tag, we can use the following XPATH
/APIS/API/field[@Username='username1'][@UserPassword='password1'] </p>
| 46,094 |
<p>I'm looking for a technique or tool which we can use to obfuscate or somehow secure our compiled c# code. The goal is not for user/data security but to hinder reverse engineering of some of the technology in our software. </p>
<p>This is not for use on the web, but for a desktop application.</p>
<p>So, do you know... | <p>This is a pretty good list of obfuscators from <a href="https://marketplace.visualstudio.com/search?term=.net%20obfuscators&target=VS&category=All%20categories&vsVersion=&sortBy=Relevance" rel="noreferrer">Visual Studio Marketplace</a>
Obfuscators</p>
<ul>
<li><a href="https://www.armdot.com/" rel="... | <p>You are wasting your time going down that path. If you have code that you don't want anyone to see, you need to keep it behind closed doors. For example, only execute that code on your own server using a web service interface.</p>
<p>Obfuscating your code only deters the most casual of people. As the video game ind... | 8,465 |
<p>OK, I am trying to generate the rDoc for paperclip, but the rake task is choking on another plugin before it gets to it, so this is out of the question:</p>
<pre><code>rake doc:plugins
</code></pre>
<p>I could go and fix up the broken plugin, but I'm busy and lazy, so I just want to generate the docs for paperclip... | <p>Unbelievably, I've just figured it out!</p>
<pre><code>rake doc:plugins:paperclip
</code></pre>
<p>That was simple.</p>
| <p>You can always just run rdoc from the plugin's individual directory. This wouldn't include it in your project's /doc folder, but it would create a /doc folder inside the plugin which you can browse</p>
| 30,599 |
<p>I am extending a class defined in a library which I cannot change:</p>
<pre><code>public class Parent
{
public void init(Map properties) { ... }
}
</code></pre>
<p>If I am defining a class 'Child' that extends Parent and I am using Java 6 with generics, what is the best way to override the init method without ... | <p>Yes, you have to declare the overriding method with the same signature as in the parent class, without adding any generics info.</p>
<p>I think your best bet is to add the <code>@SuppressWarnings("unchecked")</code> annotation to the raw-type parameter, not the method, so you won't squelch other generics warnings y... | <p>You have to declare the method with the same signature as the parent, and therefore you will get warnings when you compile. You can suppress them with @SuppressWarnings("unchecked")</p>
<p>The reason why there is no way to get rid of this is that the warnings are there to let you know that it's possible to create C... | 29,898 |
<p>I have been using netbeans as a tool for my java, and i have a problem. I read <a href="http://www.netbeans.org/kb/61/java/gui-db-custom.html" rel="nofollow noreferrer">this tutorial</a> and then i tried to create a table using this SQL:</p>
<pre><code>CREATE TABLE CUSTOMERS (
ID INTEGER NOT NULL AUTO_INCREMENT... | <p>You seem to be using MySQL syntax with another database engine. The parts it complained about are precisely the MySQL-specific ones.</p>
| <p>Been a long time but if anybody else stumbles on this like I did, a solution that worked for me is instead of using <code>auto_increment</code>, describe the ID column as </p>
<p><code>ID INTEGER GENERATED ALWAYS AS IDENTITY, WHATEVER VARCHAR(20), ETC ETC...</code></p>
| 34,812 |
<pre><code> <object height="25" width="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" name="movie"/>
... | <p>You can nest object elements to display alternatives. The W3C explains it <a href="http://www.w3.org/TR/html401/struct/objects.html#h-13.3" rel="nofollow noreferrer">here</a>. I copied a snippet below:</p>
<blockquote>
<p>One significant consequence of the OBJECT element's design is that it offers a mechanism for sp... | <p>I use function AC_FL_RunContent for embedding flash objects - it's good because it supports all browsers and is recommended by Adobe.</p>
<p>More is <a href="http://www.adobe.com/devnet/activecontent/articles/devletter.html" rel="nofollow noreferrer">here</a>:</p>
<p>They also suggest using <object> tag instea... | 34,266 |
<p>This question comes on the heels of the question asked <a href="https://stackoverflow.com/questions/371/how-do-you-make-sure-email-you-send-programmatically-is-not-automatically-marke">here</a>.</p>
<p>The email that comes from our web server comes from an IP address that is different than that for the Exchange ser... | <p>The use of <code>System.exit</code> is frowned upon when the 'application' is really a sub-application (e.g. servlet, applet) of a larger Java application (server): in this case the <code>System.exit</code> could stop the JVM and hence also all other sub-applications. In this situation, throwing an appropriate excep... | <p>It's frowned upon for <em>normal</em> exits. If "not everything is going according to plan", then System.exit is fine.</p>
<p>Update: I should add that I assume your '1' has meaning that is documented somewhere.</p>
| 5,280 |
<p>I have a Probablistic Neural Network classification experiment set up in MATLAB. I can get the classes for unseen data using the <code>sim</code> command. Is there any way I can get the probabilities for the classes that the classifier calculates? Also, is there any direct way to plot the Reciever Operating Characte... | <p>if you have the Statistics Toolbox, you can use <strong><a href="http://www.mathworks.com/access/helpdesk/help/toolbox/stats/perfcurve.html" rel="nofollow noreferrer">perfcurve</a></strong> function added in recent versions of MATLAB to plot ROC curves and get AUC.</p>
| <p>You may have better luck getting a response if you include a little more background and define your terms. I recognize ROC as receiver operating characteristic curve, but PNN and AUC are just alphabet soup to me. Don't make the mistake of assuming that someone outside of your very specific problem domain cannot he... | 36,543 |
<p>Anyone know of a good, hopefully free FTP class for use in .NET that can actually work behind an HTTP proxy or FTP gateway? The FtpWebRequest stuff in .NET is horrible at best, and I really don't want to roll my own here.</p>
| <p>Our <a href="http://www.rebex.net/ftp.net/" rel="nofollow noreferrer">Rebex FTP</a> works with proxies just fine. Following code shows how to connect to the FTP using HTTP proxy (code is taken from <a href="http://www.rebex.net/ftp.net/tutorial-ftp.aspx#proxy" rel="nofollow noreferrer">FTP tutorial page</a>).</p>
<... | <p>System.Net.WebClient can handle ftp urls, and it's a bit easier to work with. You can set credentials and proxy information with it, too.</p>
| 9,930 |
<p>I'm learning functional programming, and have tried to solve a couple problems in a functional style. One thing I experienced, while dividing up my problem into functions, was it seemed I had two options: use several disparate functions with similar parameter lists, or using nested functions which, as closures, can ... | <p>Nesting functions is an excellent way to divide up the labor in many functions. It's not really "side-effecty"; if it helps, think of the captured variables as implicit parameters. </p>
<p>One example where nested functions are useful is to replace loops. The parameters to the nested function can act as induction v... | <p>Consider the following (contrived) Haskell snippet:</p>
<pre><code>putLines :: [String] -> IO ()
putLines lines = putStr string
where string = concat lines
</code></pre>
<p><code>string</code> is a locally bound named constant. But isn't it also a function taking no arguments that closes over <code>lines</... | 40,072 |
<p>I'm new to the MVC framework and wondering how to pass the RSS data from the controller to a view. I know there is a need to convert to an IEnumerable list of some sort. I have seen some examples of creating an anonymous type but can not figure out how to convert an RSS feed to a generic list and pass it to the view... | <p>I've been playing around with a way of doing WebParts in MVC which are basically UserControls wrapped in a webPart container. One of my test UserControls is an Rss Feed control. I use the RenderAction HtmlHelper extension in the Futures dll to display it so a controller action is called. I use the SyndicationFee... | <p>A rss is a xml file with special format. You may design a dataset with that generic format and read the rss(xml) with ReadXml method and the uri as the path to the file. Then you have got a dataset you can consume from another clases.</p>
| 34,081 |
<p>I think it can be done by applying the transformation matrix of the scenegraph to z-normal (0, 0, 1), but it doesn't work. My code goes like this:</p>
<pre><code>Vector3f toScreenVector = new Vector3f(0, 0, 1);
Transform3D t3d = new Transform3D();
tg.getTransform(t3d); //tg is Transform Group of all objects in a sc... | <p>If I get this right, you want a vector that is normal to the screen plane, but in world coordinates?</p>
<p>In that case you want to <code>INVERT</code> the transformation from <code>World -> Screen and do Screen -> World</code> of <code>(0,0,-1)</code> or <code>(0,0,1)</code> depending on which axis the scre... | <p>Yes, you got my question right. Sorry that I was a little bit confused yesterday. Now I have corrected the code by following your suggestion and mixing two pieces of code in the question together:</p>
<pre><code>Vector3f toScreenVector = new Vector3f(0, 0, 1);
Transform3D t3d = new Transform3D();
canvas.getImagePl... | 6,122 |
<p>I have a few things that I cannot find a good way to perform in Visual Studio:</p>
<ol>
<li><p>Pre-build step invokes a code generator that generates some source files which are later compiled. This can be solved to a limited extent by adding blank files to the project (which are later replaced with real generated ... | <ol>
<li><p>If you need make behavior and are used to it, you can create <a href="http://msdn.microsoft.com/en-us/library/txcwa2xx(VS.80).aspx" rel="noreferrer">visual studio makefile projects</a> and include them in your project.</p></li>
<li><p>If you want less clunky, you can write visual studio <a href="http://visu... | <p><strong>(1)</strong>. I don't know a simple answer to this, but there are workarounds:</p>
<p>1a. If content of generated files does not clash (i.e. there is no common static identifiers etc.), you can add to the project a single file, such as AllGeneratedFiles.c, and modify your generator to append a #include "gen... | 39,645 |
<p>I keep hearing about the DRY Principle and how it is so important in ASP.NET MVC, but when I do research on Google I don't seem to quite understand exactly how it applies to MVC.</p>
<p>From what I've read its not really the copy & paste code smell, which I thought it was, but it is more than that.</p>
<p>Can ... | <p>DRY just means "Don't Repeat Yourself". Make sure that when you write code, you only write it one time. If you find yourself writing similar functionality in all of your Controller classes, make a base controller class that has the functionality and then inherit from it, or move the functionality into another clas... | <p>DRY should not only be applied to code, but to information in general. Are you repeating things in your build system? Do you have data which should be moved to a common configuration file, etc.</p>
| 22,764 |
<p>I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow. :P</p>
<p>I started a build.xml for a project that generates a JAR file but stopped there and I need real examples to compare notes. My good f... | <p>My Environment: Fedora 8; WAS 6.1 (as installed with Rational Application Developer 7)</p>
<p>The documentation is very poor in this area and there is a dearth of practical examples.</p>
<p><strong>Using the WebSphere Application Server (WAS) Ant tasks</strong></p>
<p>To run as described here, you need to run the... | <p>If you just want to play around why not use the netbeans IDE to generate your ear files. If you create an enterprise project it will automatically generate the ant files for you. Good for prototyping and just getting started :-)</p>
<p>There is even a was plugin which allows automated deployment however this seems ... | 2,605 |
<p>I have a project with a number of different classes querying and modifying data in a common set of tables. I've set up a .dbml file which provides us with a DataContext class. My question is whether a single instance of the DataContext should be used by all objects, or whether multiple instances are safe to use. I'm... | <p>Rick Strahl has a nice article about your options: <a href="http://www.west-wind.com/weblog/posts/246222.aspx" rel="nofollow noreferrer">http://www.west-wind.com/weblog/posts/246222.aspx</a>.</p>
<p>See also: <a href="https://stackoverflow.com/questions/196253/linq-to-sql-where-does-your-datacontext-live">LINQ to S... | <p>I've always heard that you should use a single instance of the DataContext. I usually create a singleton instance of my DC in my business logic class, and use it for all my linq queries.</p>
<p>I'm sure some of the linq gurus on here might be able to give you exact reasons as to why you should only have on instanc... | 27,955 |
<p>We have PHP 5.2.6 deployed to c:\php and in that folder there is the php.ini file. On Windows, can a website override these settings similar to the way that apache has .htaccess? e.g.</p>
<pre><code>DirectoryIndex index.php index.html
<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag register_glo... | <p>I would recommend doing all you can to avoid changing r<code>egister_globals</code> to on as it's a major security hole.</p>
<p>But you can try using <code>init_set()</code> to change the settings within your PHP code, although some settings cannot be changed once PHP has started running. (These are somewhat server... | <p>For cgi environments, there is a module called <a href="http://pecl.php.net/package/htscanner" rel="nofollow noreferrer">htscanner</a>. It basically fakes .htaccess behavior and allows per directory configurations. Unfortunately I have no experience with this on Windows, let alone with IIS6.</p>
| 23,339 |
<p>For example, I have an ASP.NET form that is called by another aspx:</p>
<pre><code>string url = "http://somewhere.com?P1=" + Request["param"];
Response.Write(url);
</code></pre>
<p>I want to do something like this:</p>
<pre><code>string url = "http://somewhere.com?P1=" + Request["param"];
string str = GetResponse... | <pre><code>WebClient client = new WebClient();
string response = client.DownloadString(url);
</code></pre>
| <p>An HttpResponse is something that is sent back to the client in response to an HttpRequest. If you want process something on the server, then you can probably do it with either a web service call or a page method. However, I'm not totally sure I understand what you're trying to do in the first place.</p>
| 14,924 |
<p>I want to import data from MS SQL Server, run it through some sort of regexp to filter out stuff, and import it into MySQL. I then, for each query, wish to display a relevant image from a third database. What would be the easiest way to do this, importing and linking wise?</p>
<p>Thank you.</p>
<p>Clarification: I... | <p>You can try the MySQL Migration Toolkit.
<a href="http://dev.mysql.com/downloads/gui-tools/5.0.html" rel="nofollow noreferrer">http://dev.mysql.com/downloads/gui-tools/5.0.html</a></p>
<p>Now archived at <a href="http://downloads.mysql.com/archives.php?p=mysql-migration-toolkit" rel="nofollow noreferrer">http://dow... | <p>I would use the Microsoft SQL Server Data Publishing Wizard (free). You can use it to script your entire database (including insert statements.) You'll have to edit this script a little bit probably to get it to run in MySQL. Now you just have a regex problem. You can try:</p>
<ul>
<li>Manipulating the data in MS S... | 22,092 |
<p><a href="https://www.youtube.com/watch?v=WIkT8asT90A" rel="nofollow noreferrer">This video</a> brought to my attention the 8 mm lead of the Ender 3's Z axis screw, which seems like an exceedingly bad choice from a standpoint of accuracy with respect to common grid alignments in the Z direction. In particular, with t... | <p>I've not seen trapezoid lead screws with 5 mm lead, you can get 5 mm lead ball screws though.</p>
<p>On one printer I use 4 mm lead screws to get native 0.02 mm resolution (so 5 full steps for 0.1 mm, 10 for 0.2 mm, etc.). I also geared down 8 mm lead screws with a 2:1 ratio (e.g.... | <p>You are delving into the darker recesses of 3D printing here!</p>
<p>ACME threads, anti-backlash nuts, ball-screws, etc. will ALL follow...</p>
<p>The simple answer is that the Z-axis screw on all the cheaper 3D printers are pure crap! They use 8mm With triangular threads because it they are cheap and most softwar... | 1,363 |
<p>In some of our projects, there's an class hierarchy that adds more parameters as it goes down the chain. At the bottom, some of the classes can have up to 30 parameters, 28 of which are just being passed into the super constructor.</p>
<p>I'll acknowledge that using automated DI through something like Guice would b... | <p>The Builder Design Pattern might help. Consider the following example</p>
<pre><code>public class StudentBuilder
{
private String _name;
private int _age = 14; // this has a default
private String _motto = ""; // most students don't have one
public StudentBuilder() { }
public Student bui... | <p>Refactoring to reduce the number of parameters and depth of you inheritance hierarchy is pretty much all I can think of because, nothing is really going to help keep 20-something parameters straight. You're just going to have to every single call while looking at the documentation.</p>
<p>One thing you could do, i... | 27,411 |
<p>when calling a SSIS package (C# app) using LoadFromSqlServer, does the user account have to have any special permissions on the database or server?</p>
<p>I can't seem to view the packages in EM at the moment ...</p>
| <p>You will need to grant some rights to the users which need to run the SSIS packages.</p>
<p><a href="http://sqljunkies.com/WebLog/knight_reign/archive/2006/01/05/17769.aspx" rel="nofollow noreferrer">This page</a> should provide the information you need.</p>
| <p>I don't know the answer exactly, but where an SSIS package is run from is important. If I run it from Visual Studio, it's using my account and permissions. If I load it to the server and just try to run the package directly, it's using something else (and usually fails because of they way our servers are set up). ... | 46,025 |
<p>I just recently got my first mac. I do lots of programming on windows but now I want to get into Mac development. What are some languages i should know or tools i should use to get started with mac development?</p>
| <p><a href="https://rads.stackoverflow.com/amzn/click/com/0321503619" rel="nofollow noreferrer" rel="nofollow noreferrer">Cocoa(R) Programming for Mac(R) OS X (3rd Edition) by Aaron Hillegass</a>:</p>
<p><img src="https://i.stack.imgur.com/2AHwE.jpg" alt="enter image description here"></p>
<p>Fantastic book and the a... | <p>If you have Windows experience but also want to develop Mac software you might consider looking into <a href="http://www.realsoftware.com" rel="nofollow noreferrer">REALbasic</a>. It doesn't give you complete access to the Mac OS X Cocoa framework, but it can be used to make some slick Mac apps. And it's really ea... | 19,605 |
<p>I am trying to send a user to another page using a Javascript Function:</p>
<pre><code><input type="button" name="confirm" value="nextpage" onClick="message()">
</code></pre>
<p>And my JavaScript:</p>
<pre><code>function message() {
ConfirmStatus = confirm("Install a Virus?");
if (ConfirmStatus == ... | <p>your code got messed up, but if I got it right you can use the following:</p>
<pre><code>location.href = 'http://www.google.com';
or
location.href = 'myrelativepage.php';
</code></pre>
<p>Good luck!</p>
<p>But I must say to you, </p>
<ol>
<li>Javascript can be turned off, so your function won't work.</li>
</ol>
... | <p>window.location.href = url; </p>
<p>It is ok for redirecting to the required url using javascript.</p>
<p>The simple example can be found in <a href="http://ramsharanshrestha.blogspot.com/2013/04/window.html" rel="nofollow">this url</a></p>
| 37,462 |
<p>I need to run a stored procedure from a C# application.</p>
<p>I use the following code to do so:</p>
<pre><code>Process sqlcmdCall = new Process();
sqlcmdCall.StartInfo.FileName = "sqlcmd.exe";
sqlcmdCall.StartInfo.Arguments = "-S localhost\\SQLEXPRESS -d some_db -Q \":EXIT(sp_test)\""
sqlcmdCall.Start();
sqlcmdC... | <p>If you are trying to call a stored procedure from c# you would want to use ADO.Net instead of the calling sqlcmd via the command line. Look at <code>SqlConnection</code> and <code>SqlCommand</code> in the <code>System.Data.SqlClient</code> namespace.</p>
<p>Once you are calling the stored procedure via <code>SqlCo... | <p>Even with windows authentication you can still use <code>SqlCommand</code> and <code>SqlConnection</code> to execute, and you don't have to re-invent the wheel for exception handling.</p>
<p>A simple connection configuration and a single <code>SqlCommand</code> can execute it without issue.</p>
| 9,871 |
<p>After attending a talk on Oslo/M I am struggling a bit to see the advantages of using it over existing methods and in what situation it would be useful.</p>
<p>I know its quite new and not all details have been released etc but can some one give me some advantages and when you might use it?</p>
<p>Thanks,</p>
<p>... | <p>This questions seems to have the answer you're looking for:<br>
<a href="https://stackoverflow.com/questions/308803/what-is-model-driven-development-good-for">What is model driven development good for?</a></p>
<p>Erik Wynne has a nice blog-post on this topic:<br>
<a href="http://erikwynne.blogspot.com/2008/11/oslo-... | <p>Thinking about this a bit more and after reading the articles posted by Qdoom and RoadWarrior I can see Oslo aiding sharing,</p>
<p>Okay you can share a model with something like xml & xsd but Oslo could make it easier as it looks like you can generate classes and your database from them whilst storing the mode... | 40,264 |
<p>Many developers will claim that moving from one programming language to another is relatively simple especially if the languages are based on similar paradigms. However, in practice the effort comes not from learning the syntax of the language but in developing a deep understanding of the language nuances and more i... | <p>The biggest challenge (for me) is usually the API, rather than the language itself (.NET notwithstanding). For example, I've been using Microsoft's C++ and C# for a lot of years (Delphi before that). But I have great difficulty getting started on Java; even trivial projects can take me a while. Not because the langu... | <p>Just like learning a new human language, for me the biggest problem lies on typical constructions you need to do to solve a problem.</p>
<p>I know that perhaps learning "while" or "for" loops in several languages aren't so difficult - but when your problem goes up one level of abstraction (iterate through this arra... | 26,074 |
<p>I have a web system which has a classical parent-children menu saved in a database, with fields id as the PK, and parent_id to pointing to the owning menu. (Yes, I know this doesn't scale very well, but that's another topic). </p>
<p>So for these records (id-parent_id pairs):</p>
<pre><code>0-7 0-4 4-9 4-14 4-16 9... | <p>This is the perfect chance to use recursion!</p>
<p>Pseudo-code:</p>
<pre><code>nodeList = {}
enumerateNodes(rootNode, nodeList);
function enumerateNodes(node, nodeList) {
nodeList += node;
foreach ( childnode in node.children ) {
enumerateNodes(childnode, nodeList);
}
}
</code></pre>
<p>Edit: Di... | <p>This is a graph problem. Check out <a href="http://en.wikipedia.org/wiki/Breadth-first_search" rel="nofollow noreferrer">BFS(breadth first search)</a> and <a href="http://en.wikipedia.org/wiki/Depth-first_search" rel="nofollow noreferrer">DFS(depth first search).</a>. You can google out those terms and find hundreds... | 10,445 |
<p>I would like to write a utility that will provide me with a relatively unique ID in Java. Something pretty simple, like x bits from timestamp + y bits from random number.</p>
<p>So, how would I implement the following method:</p>
<pre><code>long getUniqueID()
{
long timestamp = System.currentTimeMillis();
... | <p>Just clip the bits you don't need:</p>
<pre><code>return java.util.UUID.randomUUID().getLeastSignificantBits();
</code></pre>
| <p>What you are trying to do is create a <a href="http://en.wikipedia.org/wiki/Hash_function" rel="nofollow noreferrer">hash function</a> that combines two long values into a single long value. In this case, the <a href="http://en.wikipedia.org/wiki/Hash_function#Uniformity" rel="nofollow noreferrer">uniformity</a> of ... | 41,027 |
<p>What are the advantages of rendering a control like this:</p>
<pre><code><% Html.RenderPartial("MyControl") %> or
<%=Html.TextBox("txtName", Model.Name) %>
</code></pre>
<p>over the web Forms style:</p>
<pre><code><uc1:MyControl ID=MyControl runat=server />
</code></pre>
<p>I understand that pe... | <p>There are a couple of reasons for this. A "traditional" ASP.NET WebForm control encapsulates both the Controller and View aspect of an MVC application and that would be a violation to the pattern. Also by making them extension methods you gain nice abilities such as being able to swap them out with your own implemen... | <p>I found <a href="https://stackoverflow.com/questions/108320/code-behind-in-aspnet-mvc">this question</a> where @Matt answers:</p>
<blockquote>
<p>Does this code A) Process, store,
retrieve, perform operations on or
analyze the data, or B) Help to
display the data?</p>
<p>If the answer is A, it belongs ... | 34,188 |
<p>The question is actually about stack overflows in C.
I have an assigment that I can not get done for the life of me, I've looked at everything in the gdb and I just cant figure it.</p>
<p>The question is the following:</p>
<pre><code>int i,n;
void confused()
{
printf("who called me");
exit(0);
}
void sh... | <p>I probably shouldn't do your homework for you. But the basically:</p>
<p>You need to get a character buffer somewhere in memory to store the string you want to execute. Obviously, you can do this the same way you are getting the other functions called (i.e. you put the text on the stack as well). After you have ... | <p>You need to manipulate the stack-frame of the caller (<code>main()</code>), and arrange it in such a way that returning to <code>shell_call()</code> from the epilog of the overflowed <code>victim_func()</code> the latter could find a settled stack as it was been called by the main. </p>
<p>In doing so you probably ... | 36,344 |
<p>I have seen some lasers attached to the RepRap platform for cutting but most seem to be cutting paper, balsa wood, or merely etching. If I were wanting to build a platform for cutting wood, similar to the wood framed or boxed 3D printers on the market, what power laser would I need for that? I assume that a lower ... | <p>Please do not go down this road. First, not all lasers are equally absorbed by the material and the energy converted to heat to vaporize the material. The light not absorbed is reflected right back into your eyes. This is especially dangerous because it doesn't make you go blind instantly, fooling you into thinking ... | <p>Strapping a laser to a cheap robot made with flammable plastic parts and no enclosure is stupid in the extreme. Don't do it. Seriously, just don't. <strong>RepRaps are not suitable for laser conversions.</strong> </p>
<p>You have to worry about reflected light damaging your eyes, and for the blue diode lasers curre... | 208 |
<p>Programs that index filesystems seem to know which parts have changed since their last index and only rescan that part. How can I determine where the filesystem/files have changed since my last index. Don't care what language you answer in but I'm thinking c and windows.</p>
<p>An example of such a program is Sequo... | <p>A fairly simplistic method would be to take the file system's reported files sizes, dates (as integer values), and file names in a given directory and calculate a <a href="http://en.wikipedia.org/wiki/Checksum" rel="noreferrer">checksum</a> you could then associate with that directory. You would still need to perfo... | <p>FindFirstChangeNotification</p>
| 31,001 |
<p>I have my SVN repository hosted somewhere. I want to move to somebody else. How can I create a dump of my repository so I can import it into my new host? This is all I keep seeing: svnadmin dump /path/to/repos > repos.dump</p>
<p>My repository is hosted, so it's not local.</p>
| <p>svnadmin dump is the recommended way to <a href="http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.5" rel="noreferrer">migrating your repositories</a>, but you'll need shell access to do it, otherwise you will have to contact your hosting provider and ask them to do the full repository dump for you. </... | <p>Sounds like you need a <a href="http://rsvndump.sourceforge.net/" rel="nofollow noreferrer">remote SVN dump command</a>. I haven't used it but it claims to do what you want.</p>
| 46,260 |
<p>I am a bit rusty on my Haskell and am looking to ramp back up. One thing I enjoy from F# is the F# Interactive shell integrated with Visual Studio: I can evaluate virtually anything (including function and class definitions) and use F# as a shell. Is there an equivalent in Haskell? When I use <code>ghci</code>, I ca... | <p>You can define a function using 'let':</p>
<pre><code>$ ghci
Prelude> let double n = n + n
Prelude> double 42
84
</code></pre>
<p>Also, I won't quite recommend this, since (A) I wrote it, and (B) it's terribly undeveloped, but <a href="http://github.com/darius/halp/" rel="noreferrer">Halp</a> can be handy in... | <p>With O'Caml and F#, definitions proceed from the top of the file down. However, in Haskell, a type or function defined earlier in a file can reference a type or function later in that file. So in Haskell, a module needs to be compiled all at once. An interactive loop is incompatible with compilation all-at-once.</p>... | 44,445 |
<p>I'd like to use alternatives to System Center Virtual Machine Manager 2008 is possible, in other words, any FREE tools?</p>
| <p>Before SCVMM, Microsoft's solution was the <a href="http://technet.microsoft.com/en-us/virtualserver/bb676674.aspx" rel="nofollow noreferrer">Virtual Server Migration Toolkit</a>. This requires Windows Server 2003 Automated Deployment Services, which in turn can only be installed on Windows Server 2003 Enterprise Ed... | <p>Use VMWare its not free, but you can get a decent 30 day trial, which should be enough to do your conversions. VMWare also has other great advantages if you're willing to pay for the product. </p>
| 9,001 |
<p>Are there any free tools to help simplify working with an NHibernate project in .NET 3.5? Primarily, I'm looking for some kind of code and config file generator to automate some of the more tedious parts of working with NHibernate.</p>
| <p><a href="http://code.google.com/p/fluent-nhibernate/" rel="nofollow noreferrer">Fluent-NHibernate</a> presents an alternative way of writing your mapping, that for example is more refactor friendly than the standard XML approach.</p>
<p>Example:</p>
<pre><code>public CustomerMap : ClassMap<Customer>
{
publ... | <p>Have a look at: <a href="http://www.dpulpo.com" rel="nofollow">dPulpo</a>, a datalayer generation tool that generates NHibernate mapping files, C# entity classes and your SQL database. There is a Visual Studio plugin and it's currently in beta and free for download.</p>
| 35,102 |
<p>If not, what are the significant differences?</p>
<hr>
<p><strong>Edit:</strong> Daren Thomas asks:</p>
<blockquote>
<p>which ones?</p>
<p>I use gvim on Windows and MacVim on the mac. Seem similar enough to be the same to me...</p>
</blockquote>
<p>By which ones, I'm guessing that you mean a specific impl... | <p>I use <a href="http://ftp.gnu.org/pub/gnu/emacs/windows/" rel="nofollow noreferrer">GNU emacs built for Windows</a>, and have found very few, if any, differences. There's the option to load your .emacs file from _emacs or .emacs (although .emacs works fine on XP and above). You can configure it to use Windows-style ... | <p>which ones?</p>
<p>I use <code>gvim</code> on Windows and <code>MacVim</code> on the mac. Seem similar enough to be the same to me...</p>
| 6,285 |
<p>We are experiencing some slowdowns on our web-app deployed on a Tomcat 5.5.17 running on a Sun VM 1.5.0_06-b05 and our hosting company doesn't gives enough data to find the problem.</p>
<p>We are considering installing <a href="http://www.lambdaprobe.org" rel="noreferrer">lambda probe</a> on the production server b... | <p>You can cross out security flaws by using secure authentication. Just keeping the JMX service ready does not incur any significant overhead and is generally a good idea. There's a benchmark <a href="http://weblogs.java.net/blog/emcmanus/archive/2006/07/how_much_does_i.html" rel="noreferrer">here</a> about this.</p>
| <p>it depends on the JMX implementation and on how expensive the stuff is you want to monitor.
I now at least one JMX application, which has a relatively high memory overhead. </p>
| 40,448 |
<p>I have the following makefile that I use to build a program (a kernel, actually) that I'm working on. Its from scratch and I'm learning about the process, so its not perfect, but I think its powerful enough at this point for my level of experience writing makefiles.</p>
<pre><code>AS = nasm
CC = gcc
LD = l... | <p>As already pointed out elsewhere on this site, see this page:
<a href="http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/" rel="noreferrer">Auto-Dependency Generation</a></p>
<p>In short, gcc can automatically create .d dependency files for you, which are mini makefile fragments containing th... | <p>I believe the <code>mkdep</code> command is what you want. It actually scans .c files for <code>#include</code> lines and creates a dependency tree for them. I believe Automake/Autoconf projects use this by default.</p>
| 38,072 |
<p>I have a very long-running stored procedure in SQL Server 2005 that I'm trying to debug, and I'm using the 'print' command to do it. The problem is, I'm only getting the messages back from SQL Server at the very end of my sproc - I'd like to be able to flush the message buffer and see these messages immediately duri... | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/ms178592.aspx" rel="noreferrer"><code>RAISERROR</code></a> function:</p>
<pre><code>RAISERROR( 'This message will show up right away...',0,1) WITH NOWAIT
</code></pre>
<p>You shouldn't completely replace all your prints with raiserror. If you have a loop or... | <p>To extend <a href="https://stackoverflow.com/a/36703942/4255824">Eric Isaac's answer</a>, here is how to use the table approach correctly:</p>
<p>Firstly, if your sp uses a transaction, you won't be able monitor the contents of the table live, unless you use the <code>READ UNCOMMITTED</code> option:</p>
<pre><code>S... | 39,490 |
<p>I'm specifically interested in Windows 2000/XP, but Vista/7 would be interesting too (if different).</p>
<p>I was thinking along the lines of task scheduling a batch file or equivalent on a daily basis.</p>
<p>EDIT: Sorry, I should have provided more info. The question pertains to 10 machines which I manually appl... | <p>You could use <code>WUApiLib</code>:</p>
<pre class="lang-cs prettyprint-override"><code>UpdateSessionClass session = new UpdateSessionClass();
IUpdateSearcher search = session.CreateUpdateSearcher();
ISearchResult result = search.Search("IsInstalled=0 and IsPresent=0 and Type='Software'");
int numberOfUpdates =... | <p>The "easiest" way to tell is to setup Windows Updates to occur nightly and download the updates if available which then puts the update shield icon in the system tray. Just glance at the tray to see if the icon is present. </p>
<p>You could also setup Windows to check nightly for the updates, then download and in... | 14,782 |
<p>Is it possible to get the equivalent of the focus and blur events that we have on other form controls for the RTE? That is, I would like to know when a given RTE gets the focus and when it loses it.</p>
<p>I see that the RTE supports lots of events (<a href="http://developer.yahoo.com/yui/editor/#events" rel="nofol... | <p>If anyone finds this question and is looking for the answer, Dav Glass poste an answer in the YUI community forums <a href="http://tech.groups.yahoo.com/group/ydn-javascript/message/40867" rel="nofollow noreferrer">http://tech.groups.yahoo.com/group/ydn-javascript/message/40867</a> .</p>
| <p>If anyone finds this question and is looking for the answer, Dav Glass poste an answer in the YUI community forums <a href="http://tech.groups.yahoo.com/group/ydn-javascript/message/40867" rel="nofollow noreferrer">http://tech.groups.yahoo.com/group/ydn-javascript/message/40867</a> .</p>
| 36,411 |
<p>I'm writing in second-person just because its easy, for you. </p>
<p>You are working with a game engine and really wish a particular engine class had a new method that does 'bla'. But you'd rather not spread your 'game' code into the 'engine' code.</p>
<p>So you could derive a new class from it with your one new... | <p>My only question to you is, "does your added functionality need to be a member function, or can it be a free function?" If what you want to do can be solved using the class's existing interface, then the only difference is the syntax, and you should use a free function (if you think that's "ugly", then... suck it u... | <p>Sounds like you want Ruby mixins. Not sure there's anything close in C++. I think you have to do the inheritance.</p>
<p>Edit: You might be able to put a friend method in and use it like a mixin, but I think you'd start to break your encapsulation in a bad way.</p>
| 28,264 |
<p>I use a basic Post to send data to a Django server.</p>
<p>The data consists of a base64 encoded 640*380 PNG image dynamically created by the flex
component.</p>
<pre><code><mx:HTTPService id="formSend" showBusyCursor="true"
useProxy="false" url="http://127.0.0.1/form/"
method="POST" result="formSentC... | <p>Found something interesting than we can dig on it. Use this:</p>
<pre><code>var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.data = _img.data;
urlLoader.addEventListener(Event.COMPLETE,LoadedComplete);
var request:URLRequest = new URLRequest("w... | <ol>
<li><p>Probably, yes. It depends whether you impose a hard limit on the the file size and how the destination page handles the request.</p></li>
<li><p>I don't believe it's actually possible at the moment.</p></li>
<li><p>Read <a href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?c... | 47,703 |
<p>I just saw a really useful UI feature of the forthcoming Windows 7 ( visit <a href="http://www.gizmodo.com.au/2008/10/windows_7_walkthrough_boot_video_and_impressions-2.html" rel="nofollow noreferrer">http://www.gizmodo.com.au/2008/10/windows_7_walkthrough_boot_video_and_impressions-2.html</a> and scroll down to the... | <p>There's an offical way: <a href="http://code.msdn.microsoft.com/WindowsAPICodePack" rel="nofollow noreferrer">Windows API Code Pack</a></p>
<p>The Windows® API Code Pack for Microsoft® .NET Framework provides a source code library that can be used to access some new Windows 7 features (and some existing features of... | <p>Yes, you can do this from C#, via PInvoke. Tbh, the best way to learn such APIs is by looking at the source of something like Bblean. This'll show you what you need to know and exposing it to PInvoke is pretty trivial.</p>
| 30,871 |
<p>I have a master page with one form on it. It is a search form which must always be visible. When the button of that form is clicked I want the form data to be sent to search.aspx. The problem is, I don't know how. I cannot set the form action to search.aspx, because all my other pages which use the master form will ... | <p>In order to pass the values of the control "txtSearch", when Server.Transfer is executed, you could do many things, including passing it via a querystring variable or setting up a session variable, and then check either of those in the Page_Load event of Search.aspx, and if it's populated, call the event that is fir... | <p>ASP.NET webform pages only have one form (which would generally be included on the master page). You can set the postback url for the search button to your search page..</p>
<pre><code><asp:Button ID="btnSearch" runat="server" Text="Search" PostBackUrl="~/search.aspx" />
</code></pre>
<p>..or just redirect t... | 41,049 |
<p>How would one change the view on the screen programmatically in an iPhone app?</p>
<p>I've been able to create navigation view's and programmatically push/pop them to produce this behaviour, but if I wanted to simply change the current view (not using a UINavigation controller object), what is the neatest way to ac... | <p>I use <code>presentModalViewController:animated:</code> to bring up a settings view from my main window's <code>UIViewController</code> and then when the user presses "done" in the settings view I call <code>dismissModalViewControllerAnimated:</code> from the settings view (reaching back to the parent view) like thi... | <p>How about pushing a generic UIView into the UINavigationController?</p>
<p>When you want one particular view shown, simply add it as a subview to that previously pushed UIView. When you want to change views, remove the previous subview and add the new one.</p>
| 48,336 |
<p>I am using asp.net 2.0 I know can set the pages title via the code behind. But is it possible to set the page title using Theme, skin or css?</p>
<p>I need to display a different title depending on the theme selected.</p>
| <p>By inserting a Literal control in the Head-element of the page you should be able to apply a theme to it and thereby set its Text property.</p>
<p>If that doesn't work you can always check the Page.Theme property and set the pages title accordingly.</p>
| <p>Not via CSS</p>
| 33,141 |
<p>What are the best free resources for learning advanced batch-file usage?</p>
| <p>It's not free, but it's probably the best. <a href="https://rads.stackoverflow.com/amzn/click/com/1578700477" rel="noreferrer" rel="nofollow noreferrer">"Windows NT Shell Scripting" by Tim Hill</a>.</p>
<p>That said, whenever I try to do something 'advanced' in cmd batch files, I always end up regretting it. </p>... | <p>Tried <a href="http://en.wikipedia.org/wiki/Batch_file" rel="nofollow noreferrer">Wikipedia's batch file entry</a>? ...or any of <a href="http://www.google.co.uk/search?q=advanced+batch+file+usage&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a" rel="nofollow noreferrer">th... | 21,805 |
<p>Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblies has settings or configuration information. Our team tends to like the VS ... | <p>You use one master config file that points to other config files. <a href="http://blog.andreloker.de/post/2008/06/Keep-your-config-clean-with-external-config-files.aspx" rel="noreferrer">Here's an example of how to do this.</a></p>
<hr>
<p>In case the link rots, what you do is specify the <a href="http://msdn.mic... | <p>We created an AssemblySettingsConfig class that acts like ConfigurationManager, but loads a .config for each individual assembly. So the application has a .config, and any DLLs it references have their own .config files. Has worked out well so far.</p>
| 11,482 |
<p>I've got a User table with a bitmask that contains the user's roles. The linq query below returns all the users whose roles include 1, 4 or 16. </p>
<pre><code>var users = from u in dc.Users
where ((u.UserRolesBitmask & 1) == 1)
|| ((u.UserRolesBitmask & 4) == 4)
||... | <p>You can use the <a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="noreferrer">PredicateBuilder</a> class.</p>
<p>PredicateBuilder has been released in the <a href="https://www.nuget.org/packages/LinqKit/" rel="noreferrer">LINQKit NuGet package</a></p>
<blockquote>
<p>LINQKit is a free set of ... | <pre><code>private List<User> GetUsersFromRoles(uint UserRoles) {
return from u in dc.Users
where (u.UserRolesBitmask & UserRoles) != 0
select u;
}
</code></pre>
<p>UserRoles parameter should be provided, however, as a bit mask, instead of array.</p>
| 21,764 |
<p>I have to produce an RSS/Atom feed in various applications, and I want to know a good library or class which is able to produce both, and which already handles all common problems.</p>
<p>For example, the one I used for years does not put the right format for date, so my feed is not well-handled by several aggregat... | <p>The <a href="http://www.phpclasses.org/package/4427-PHP-Generate-feeds-in-RSS-1-0-2-0-an-Atom-formats.html" rel="noreferrer">PHP Universal Feed Generator</a> seems to be exactly what you're after - it has a simple, OO-based way of declaring a new feed and outputting it to your desired specification. </p>
<p>It also... | <p>PHP Universal Feed Generator is a good answer. I had just to modify the code accordingly to a comment on the webpage to handle correcly french characters.</p>
<p><a href="http://www.ajaxray.com/blog/2008/03/08/php-universal-feed-generator-supports-rss-10-rss-20-and-atom/#comment-341" rel="nofollow noreferrer">http:... | 22,053 |
<p>I am using Borland Builder C++ 2009. I want to add a button to a form that allows the user to open a file in Excel that I specify. I can't think of how to do this. I know how to link with other code and executables -- is there a Microsoft Excel executable that I could use? How could I specify the file then? Any hint... | <p>Assuming that the file type is registered with Excel, you could call ShellExecute() on the file, using the "open" verb. This will cause the file to be opened as if double clicked by the user in Explorer and will invoke Excel.</p>
<p>If that isn't the case, and you can assume that Excel is installed, you could inste... | <p><code>System()</code> command should be enough i think.
For any Windows application, we can open any file using the Location of .exe file and the File Path.</p>
<p>Eg.,</p>
<pre><code>system("PATH C:\\Program\ Files\\Microsoft\ Office\\OFFICE11;%PATH% & excel \"C:\\Documents and Settings\\User\\Desktop\\ExcelF... | 39,946 |
<p>At my workplace, the traffic blocker/firewall has been getting progressively worse. I can't connect to my home machine on port 22, and lack of ssh access makes me sad. I was previously able to use SSH by moving it to port 5050, but I think some recent filters now treat this traffic as IM and redirect it through an... | <p>Find out why the company has such a restrictive policy. It might be for a good reason.</p>
<p>If you still find that you want to bypass the policy, you could write a small proxy that will listen on your server on port 443 and then, depending on the request, will forward the traffic either to your web server or to th... | <blockquote>
<p>Must work over port 443, without disturbing other HTTPS traffic (i.e. I can't just put the ssh server on port 443, because I would no longer be able to serve pages over HTTPS)</p>
</blockquote>
<p>Is it possible to bind your HTTPS server to a different port? Depending on what it's used for, you may e... | 21,884 |
<p>There's a lot of interest these days in Erlang as a language for writing parallel programs on multicore. I've heard people argue that Erlang's message-passing model is easier to program than the dominant shared-memory models such as threads. </p>
<p>Conversely, in the high-performance computing community the domina... | <p>I agree with all previous answers, but I think a key point that is not made totally clear is that one reason that MPI might be considered hard and Erlang easy is the match of model to the domain. </p>
<p>Erlang is based on a concept of local memory, asynchronous message passing, and shared state solved by using som... | <p>Regarding MPI vs OpenMP/UPC: MPI forces you to slice the problem in small pieces and take responsibility for moving data around. With OpenMP/UPC, "all the data is there", you just have to dereference a pointer. The MPI advantage is that 32-512 CPU clusters are much cheaper than 32-512 CPU single machines. Also, w... | 22,424 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.