instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>In a <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> 2.0 C# application I use the following code to detect the operating system platform:</p> <pre><code>string os_platform = System.Environment.OSVersion.Platform.ToString(); </code></pre> <p>This returns "Win32NT". The problem is tha...
<p><strong>UPDATE:</strong> As Joel Coehoorn and others suggest, starting at .NET Framework 4.0, you can just check <code>Environment.Is64BitOperatingSystem</code>.</p> <hr /> <p>IntPtr.Size won't return the correct value if running in 32-bit .NET Framework 2.0 on 64-bit Windows (it would return 32-bit).</p> <p>As Micr...
<p>Just see if the "C:\Program Files (x86)" exists. If not, then you are on a 32 bit OS. If it does, then the OS is 64 bit (Windows&nbsp;Vista or Windows&nbsp;7). It seems simple enough...</p>
43,663
<p>My right side bar isn't staying on top. </p> <p>These are the two pages for example. www.cafecartel.com </p> <p>and www.cafecartel.com.index2.php</p> <p>Currently the way the site is written, the right side bar must be placed like this:</p> <p>body id="Support" div id="container1" div id="container2"</p> <pre><...
<p>I'm having trouble fully understanding the question, so my apologies in advance if I misunderstood, but to have the sidebar appear next to the content and have content appear above the sidebar in HTML, you could float the #maincontent div left, and the #sidebar div right. </p> <p><code>#content { clear: both; }</co...
<p>cc_layout.css line: 63</p> <pre><code>#maincontent { margin:0; padding:0; position:relative; width:97%; float: left; } </code></pre> <p>@Carl, the difference between the two pages (old and new) is that he has placed the sidebar HTML below the maincontent (new) compared to above (old).</p>
49,772
<p>I'm not the best programmer so I found it was much easier to write a program as several separate executables, which occasionally call each other. But now I need an easy way to actually run them without writing detailed instructions like Run file one, wait until its completed and no longer in process manager before ...
<p><a href="http://www.innosetup.com/isinfo.php" rel="noreferrer">Inno Setup</a> is easy to use, free, open source and scriptable if you need it.</p>
<p>If you're not after an installer (which is doesn't sound like you are) Why not just write a program to do what you need?</p>
20,882
<p>I want to check the login status of a user through an ajax request. Depending wether the user is logged in I want to display either the username/password input or the username. Currently the request is sent on body.onload and a prgoress indicator is shown until the response arrives. Is there a better way?</p> <hr> ...
<p>This sounds like an operation that should be done on the server first, before the page is rendered. If someone has javascript disabled, what would happen?</p>
<p>I think this should be possible, but it is not recommended. The correct thing to do is have the server fully determine the content of the page before it is even sent.</p> <p>If you're being held up by slow image downloads or other non-HTML content, check out one of the various JavaScript libraries. I always recomme...
23,256
<p>I'm relatively new to J2ME and about to begin my first serious project. My experience in testing isn't too deep either. I'm looking for a unit test framework for J2ME. </p> <p>So far I've seen J2MEUnit, but I don't now how well supported it is. I've seen JavaTest Harness but I don't know if it's not an overkill.</p...
<p><a href="http://eskasiunblog.blogspot.com/2007/09/test-unitarios-en-j2me.html" rel="nofollow noreferrer">This is a blog entry of a spanish company who makes movile games</a>. Compares many frameworks and the conclusion is (translated):</p> <ul> <li><p>MoMEUnit Offer very useful information about the tests. Is easil...
<p>Hmm... I myself have not developed a mobile application but I think J2MEUnit is the better choice as its based on the original JUnit which has a big community and is supported by most IDEs so it should be guite easy to run at least those test which do not depend on the mobile hardware directly from your IDE.</p> <p...
13,960
<p>It occurs to me that I'm never really thinking about layer height when I calibrate my z-probe offset. This is obviously an oversight, because I'll want my nozzle to start higher for 0.3mm layers than for 0.1mm layers.</p> <p>After this realization comes the question: Do I need to recalibrate every time I switch to ...
<p>All modern slicers adjust the nozzle position for the first layer in accordance with your chosen layer height. You can see this in your gcode if you slice files with different layer heights. <em>Before you add special slicer settings and offsets,</em> if you print 0.1mm layers, the nozzle will start at Z=0.1mm, and ...
<p>The first layer is usually squished more to help with the adhesion. On top of that with ABS there's a bit of deformation even if the print doesn't lift. So spare yourself the frustration, FDM 3d printers aren't that precise themselves for you to care about this.</p>
307
<p>I've been successful with writing my own SQL access code with a combination of stored procedures and parameterized queries and a little wrapper library I've written to minimize the ADO.NET grunge. This has all worked very well for me in the past and I've been pretty productive with it. </p> <p>I'm heading into a ne...
<p>I find that LINQ to SQL is much, much faster when I'm prototyping code. It just blows away any other method when I need something now.</p> <p>But there is a cost. Compared to hand-rolled stored procs, LINQ is slow. Especially if you aren't very careful as seemingly minor changes can suddenly make a single turn into...
<p>There was a great discussion on this topic at DevTeach in Montreal. If you go to this URL: <a href="http://www.dotnetrocks.com/default.aspx?showNum=240" rel="nofollow noreferrer">http://www.dotnetrocks.com/default.aspx?showNum=240</a> you will be able to hear two experts in the field (Ted Neward and Oren Eini) disc...
8,474
<p>I would like to run a job through cron that will be executed every second Tuesday at given time of day. For every Tuesday is easy:</p> <pre><code>0 6 * * Tue </code></pre> <p>But how to make it on "every second Tuesday" (or if you prefer - every second week)? I would not like to implement any logic in the script i...
<p>How about this, it does keep it in the <code>crontab</code> even if it isn't exactly defined in the first five fields:</p> <pre><code>0 6 * * Tue expr `date +\%W` \% 2 &gt; /dev/null || /scripts/fortnightly.sh </code></pre>
<p>Cron provides an 'every other' syntax "/2". Just follow the appropriate time unit field with "/2" and it will execute the cronjob 'every other time'. In your case...</p> <pre><code>0 6 * * Tue/2 </code></pre> <p>The above should execute every other Tuesday.</p>
45,556
<p>How does <code>const</code> (pointers, references and member functions) help with thread safety in C++?</p>
<p>Any immutable (that is, unchangable) data is inherently thread safe - there's no risk for multiple threads concurrently reading the same read-only data because it's never going to change!</p> <p>Marking a variable as const in C++ makes it read-only and thus thread safe.</p>
<p>C++ const allows non-const aliasing such as:</p> <pre><code>Foo myVar; const Foo* ptr1; Foo* ptr2; </code></pre> <p>Given this, const provides no guarantees as to the immutability of your data, even if you don't do any casting or anything to get around it. If you access myVar through ptr1, you can't change it thr...
47,278
<p>I have an upcoming project which will have to be able to print simple reports from its data. It'll be WPF-based, and I'm wondering which way to go.</p> <p>I know that WPF introduces its own printing technology (based on XPS) which looks quite easy to use. However, part of me wonders whether it would just be easier ...
<p>We had this same issue, and ended up using RDLC/ReportViewer for now. There's no native WPF reporting tool (that I know of) and RDLC is pretty simple to use, and is free. The runtime overhead for it is small (around 2Mb) but you must remember to distribute it as it isn't part of the .NET Framework.</p>
<p>Without getting into a whole political discussion about the future of WPF, the best option we found was to wrap the ReportViewer in a Windows Forms host control. </p> <p><a href="http://blog.pineywoodstech.com/index.php/2012/01/using-microsoft-reportviewer-with-wpf/" rel="nofollow">http://blog.pineywoodstech.com/in...
21,803
<p>I would like to use client-side Javascript to perform a DNS lookup (hostname to IP address) as seen from the client's computer. Is that possible?</p>
<p>There's no notion of hosts or ip-addresses in the javascript standard library. So you'll have to access some external service to look up hostnames for you.</p> <p>I recommend hosting a cgi-bin which looks up the ip-address of a hostname and access that via javascript.</p>
<p>I don't think this is allowed by most browsers for security reasons, in a pure JavaScript context as the question asks.</p>
12,822
<p>I have several sources of tables with personal data, like this:</p> <pre><code>SOURCE 1 ID, FIRST_NAME, LAST_NAME, FIELD1, ... 1, jhon, gates ... SOURCE 2 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 1, jon, gate ... SOURCE 3 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 2, jhon, ballmer ... </code></pre> <p>...
<p>The crux of the problem is to compute one or more measures of distance between each pair of entries and then consider them to be the same when one of the distances is less than a certain acceptable threshold. The key is to setup the analysis and then vary the acceptable distance until you reach what you consider to...
<p>You might try to cannonicalise the names by comparing them with a dicionary.<br> This would allow you to spot some common typos and correct them. </p>
14,968
<p>I have a table with three columns:</p> <p><strong>user varchar, status varchar , rep int</strong></p> <p>status and rep get updated often and one of the requirements is:</p> <p><strong>Given a datetime value view status and rep values, for each user, at the given date.</strong></p> <p>I can add an updated_at dat...
<p>Depending on exactly how you are going to use the reporting information, it might be best to create a History table that before you update the main table, you write the current values off to the History table, adding the timestamp.</p> <p>That would be best if you are really only picking out specific days/users/sta...
<p>I would store this is a separate related table since I assume most of the time you will only be querying the current status when you join. If you will be doing a lot of this type of querying and adding this type of data to many tables not just this one, I would create a separate OLAP database for reporting. </p> <p...
30,636
<p>What is the most efficient way to do this?</p>
<p>In python:</p> <pre class="lang-py prettyprint-override"><code>def hex_to_rgb(value): &quot;&quot;&quot;Return (red, green, blue) for the color given as #rrggbb.&quot;&quot;&quot; value = value.lstrip('#') lv = len(value) return tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3)) def...
<p>Very Simple and Short implementation: </p> <pre><code>color_in_hex = 'FF00EE64' # Green Color print('RGB =', tuple(int(color_in_hex[i:i+2], 16) for i in (0, 2, 4))) </code></pre>
26,349
<p>I can connect with a user who has permissions to set passwords. I'm able to change attributes, but I can't set the password.</p> <p>Found some instructions to set the attribute <code>unicodePwd</code> to <code>\UNC:"*password*"</code>, but it says:</p> <blockquote> <p>Error: Modify: Unwilling To Perform. &lt;53>...
<h2>Suffix Array and <em>q</em>-gram index</h2> <p>If your strings have a strict upper bound on the size you might consider the use of a <a href="http://en.wikipedia.org/wiki/Suffix_array" rel="noreferrer"><strong>suffix array</strong></a>: Simply pad all your strings to the same maximum length using a special charact...
<p>Would you get any advantage having your trie keys comparable to the size of the machine register? So if you are on a 32bit box you can compare 4 characters at once instead of each character individually? I don't know how bad that would increase the size of your app.</p>
24,705
<p>Would a C++ <a href="http://en.wikipedia.org/wiki/Common_Language_Infrastructure" rel="noreferrer">CLI</a> compiler be able to compile some large sets of C++ classes without modifications? </p> <p>Is C++ CLI a superset of C++?</p>
<p>According to <a href="http://en.wikipedia.org/wiki/C%2B%2B/CLI" rel="noreferrer" title="Wikipedia">Wikipedia</a>:</p> <blockquote> <p>C++/CLI should be thought of as a language of its own (with a new set of keywords, for example), instead of the C++ superset-oriented Managed C++</p> </blockquote>
<p>Page 3 of Marcus Heege's book 'Expert C++/CLI.NET for Visual C++ Programmers' states:</p> <blockquote> <p>C++/CLI is a set of extensions made to the C++ language to benefit from the services that an implementation of the CLI offers.</p> </blockquote> <p>And further down the same page:</p> <blockquote> <...
21,674
<p>Today I had my first test with the ASP.NET AJAX Timer Control, in hope that it would allow me to constantly keep updating my site.</p> <p>At the moment, it just updates once; this does not match the behavior of the previous .NET timers.</p> <p>Was the AJAX Timer control only made to update an item once? Or do I ne...
<p>Nope, it updates regularly. Make sure your timer is Enabled and the Interval is set correctly, and try putting it in an UpdatePanel. Works for my page * link in profile page.</p>
<p>You could try to check your implementation against what is described in <a href="http://msdn.microsoft.com/en-us/library/bb398787.aspx" rel="nofollow noreferrer">this tutorial on MSDN (Walkthrough)</a>.</p> <p><em>"The Timer control can work as a trigger either inside or outside an UpdatePanel control. This example...
32,012
<p>Eric Meyer's advice to keep individual rules alphabetized in a CSS style definition makes sense - there's no &quot;natural&quot; way to order rules, and this makes it easy in a complex definition to make sure you don't define the same thing twice.</p> <pre><code>div.Foo { background:Green; border:1px solid K...
<p>I don't know of anything in visual studio, but there online tools to clean up and format css. I've used <a href="http://www.cleancss.com/" rel="noreferrer">CleanCSS</a> with success</p> <p><strong>Update:</strong></p> <p>Try this one <a href="http://www.lonniebest.com/FormatCSS/" rel="noreferrer">Format CSS Onlin...
<p>It's not a plugin and it doesn't know about CSS but it's often helpful: a spreadsheet such as Excel or <a href="http://docs.google.com" rel="nofollow noreferrer">Google Spreadsheets</a>.</p> <p>I often cut code, paste it into Excel, munge it a bit, and paste it back into my editor. I find this technique especially...
25,612
<p>I didn't see it in the help but I figure it's possible. Also how do I find out what email address to use?</p>
<p>Have you looked <a href="http://help.fogcreek.com/7754/using-fogbugz-to-check-pop3-and-imap-mailboxes" rel="nofollow noreferrer">here</a>?</p> <p><sup>Updated link to new help desk 2013/10/7</sup></p>
<p>As @Jonathan said, you must first setup a mailbox for the project. See his link for details. Then you simply forward to the address you created for the project. We typically use addresses like product-support@company.com.</p>
31,807
<p>Under many operating systems Unix-domain sockets allow a process to reliably pass its credentials to another process in a way that can't be maliciously subverted. For instance, this is done on Linux through the <a href="http://linux.die.net/man/7/socket" rel="nofollow noreferrer">SO_PASSCRED and SO_PEERCRED options...
<p>I haven't ever worked with it, but I think you're looking for LOCAL_PEERCRED. ( see man unix)</p> <p><em>You can confirm the identity of the program at the other end of the socket using the LOCAL_PEERCRED socket option, introduced in Mac OS X 10.4.</em></p> <p>See <a href="http://developer.apple.com/technotes/tn20...
<p>Even better, thanks to the accepted answer, I found that getpeereid(), directly returns the required data.</p>
46,811
<p>I don't know if this has been discussed. </p> <p>Let's say you are in a three developer team. How would you share: </p> <ul> <li>models - views - controllers</li> <li>by controllers</li> <li>by use cases</li> <li>something else?</li> </ul> <p>Maybe someone says this has nothing to do with asp.net mvc but I think ...
<p>Do it by story. But by far the best way is have 2 developers work on the same story. Working together across the whole architecture. They can share the tasks as they are needed, creating the view or the model or the stored procs, and tables etc. There will be some stepping on toes but at those times they can pair pr...
<p>By use case or task. Helps spread the knowledge about the entire process around.</p>
29,498
<h1>Question</h1> <p>So I've recently came up with some new possible projects that would have to deal with deriving 'meaning' from text submitted and generated by users.</p> <p><a href="http://en.wikipedia.org/wiki/Natural_language_processing" rel="nofollow noreferrer">Natural language processing</a> is the field tha...
<p>Tough call, NLP is a much wider field than most people think it is. Basically, language can be split up into several categories, which will require you to learn totally different things.</p> <p>Before I start, let me tell you that I doubt you'll have any notable success (as a professional, at least) without having ...
<p>A very enjoyable readable introduction is The Language Instinct by Steven Pinker. It goes into the Chomsky stuff and also tells interesting stories from the evolutionary biology angle. Might be worth starting with something like that before diving into Chomsky's papers and related work, if you're new to the subject....
26,081
<p>I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes.</p> <p>How can I achieve something similar to <code>array_map</code> or <code>array_walk</code> with objec...
<p>use <a href="http://nl3.php.net/manual/en/function.get-object-vars.php" rel="noreferrer">get_object_vars()</a> to get an associative array of the members, and use the functions you mentioned.</p> <p>btw, you can also do a foreach on an object like you would on an array, which is sometimes useful as well.</p>
<p>You are looking for <a href="http://www.php.net/manual/en/function.get-object-vars.php" rel="nofollow noreferrer">get_object_vars</a> / <a href="http://www.php.net/manual/en/function.get-class-methods.php" rel="nofollow noreferrer">get_class_methods</a> (the first gets the variables, the second the method names).</p...
13,950
<p>I have done this:</p> <pre><code>$ z() { echo 'hello world'; } </code></pre> <p>How do I get rid of it?</p>
<pre><code>unset -f z </code></pre> <p>Will unset the function named z. A couple people have answered with:</p> <pre><code>unset z </code></pre> <p>but if you have a function and a variable named z only the variable will be unset, not the function.</p>
<p>In Zsh:</p> <pre><code>unfunction z </code></pre> <p>That's another (arguably better) name for <code>unhash -f z</code> or <code>unset -f z</code> and is consistent with the rest of the family of:</p> <ul> <li><code>unset</code></li> <li><code>unhash</code></li> <li><code>unalias</code></li> <li><code>unlimit</co...
30,444
<p>I've got a table of URLs and I don't want any duplicate URLs. How do I check to see if a given URL is already in the table using PHP/MySQL?</p>
<p>If you don't want to have duplicates you can do following:</p> <ul> <li>add uniqueness constraint</li> <li>use "<a href="http://dev.mysql.com/doc/refman/5.0/en/replace.html" rel="noreferrer">REPLACE</a>" or "<a href="http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html" rel="noreferrer">INSERT ... ON DUP...
<p>You could do this query:</p> <pre><code>SELECT url FROM urls WHERE url = 'http://asdf.com' LIMIT 1 </code></pre> <p>Then check if <a href="http://php.net/mysql_num_rows" rel="nofollow noreferrer">mysql_num_rows()</a> == 1 to see if it exists.</p>
8,613
<p>I'm kind of new to C++ and have some questions, this is one of them.</p> <p>Is there ANY reason when you are using a function that takes in one or several parameters, parameters of which you know will always be stored in a variable before the function call, to pass a copy of the variable, rather than a pointer to t...
<p>There are several ways in which passing a copy can be cheaper than passing a pointer.</p> <ol> <li>The object is equal to or smaller than a pointer. Directly accessing a value will always be faster than dereferencing a pointer.</li> <li>The structure is small enough to be put on the stack by the compiler. In this c...
<p>a reference is more common, or a const reference if they aren't going to change.</p>
32,715
<p>First off, I understand the reasons why an interface or abstract class (in the .NET/C# terminology) cannot have abstract static methods. My question is then more focused on the best design solution.</p> <p>What I want is a set of "helper" classes that all have their own static methods such that if I get objects A,...
<p>Looking at <a href="https://stackoverflow.com/questions/14614/static-methods-in-an-interfaceabstract-class#14655">your response</a> I am thinking along the following lines:</p> <ul> <li>You could just have a static method that takes a type parameter and performs the expected logic based on the type.</li> <li>You co...
<p>How do I post feedback on Stack Overflow? Edit my original post or post an "answer"? Anyway, I thought it might help to give an example of what is going on in AHelper.RetrieveByID() and BHelper.RetreiveByID()</p> <p>Basically, both of these methods are going up against a third party webservice that returns variou...
3,541
<p>We all know the good old "disable the submit button" trick but what are the best ways to handle multiple submissions server side? I have an application where it is absolutely <em>critical</em> that a form only be sent once - it processes a credit card. I didn't write how it is right now but as a quick fix I threw on...
<p>One really effective way is to submit a token along with the request, and keep a list of used tokens. If the token is not valid, or the token has already been processed, then abort.</p> <p>The token can be as simple as an incrementing integer, stored in a hidden text field, or you can encrypt it to increase securit...
<p>No need to generate unique tokens and all that jazz. After form validation passes, simply redirect the visitor to another page that says something like "Your credit card is being processed". If the visitor reloads the page they are reloading the redirected page, not the POST submission.</p>
26,940
<p>I have a "showall" query string parameter in the url, the parameter is being added dynamically when "Show All/Show Pages" button is clicked. </p> <p>I want the ability to toggle "showall" query string parameter value depending on user clicking the "Show All/Show Pages" button.</p> <p>I'm doing some nested "if's" a...
<p>Just to elaborate on Toran's answer:</p> <p>Use:<br> <code>&lt;asp:HiddenField ID="ShowAll" Value="False" runat="server" /&gt;</code></p> <p>To toggle your state:</p> <pre><code>protected void ToggleState(object sender, EventArgs e) { //parse string as boolean, invert, and convert back to string ShowA...
<p>Another dirty alternative could be just to use a hidden input and set that on/off instead of manipulating the url.</p>
6,679
<p>why this is happen ?</p> <p>When u create abstract class in c++ Ex: <strong>Class A</strong> (which has a pure virtual function) after that <strong>class B</strong> is inherited from class <strong>A</strong> </p> <p>And if <strong>class A</strong> has constructor called <strong>A()</strong> suppose i created a...
<p>Quick answer: constructors are special.</p> <p>When the constructor of A is still running, then the object being constructed is not yet truly of type A. It's still being constructed. When the constructor finishes, it's now an A.</p> <p>It's the same for the derived B. The constructor for A runs first. Now it's an ...
<pre><code> And if class A has constructor called A() suppose i created an Object of class B then the compiler initializes the base class first i.e.class A and then initialize the class B Then.......? </code></pre> <p>Actually you have it the wrong way around:</p> <p>When you create an object of class B the constr...
47,656
<p>I want to install PEAR on PHP 5, so I can use Spreadsheet_Excel_Writer.</p> <p>I don`t know how to install it on my ISP nor my personal MacBook.</p> <p>Thoughts for both?</p>
<p>From the command line, do this:</p> <pre><code>pear install Spreadsheet_Excel_Writer </code></pre> <p>You can also download the package directly here without using PEAR: <a href="http://download.pear.php.net/package/Spreadsheet_Excel_Writer-0.9.1.tgz" rel="nofollow noreferrer">http://download.pear.php.net/package/...
<p>You can't install pear to your isp's core. But you can install the individual files from pear's site and upload them to your host:</p> <p><a href="http://pear.php.net/package/Spreadsheet_Excel_Writer/download" rel="nofollow noreferrer">http://pear.php.net/package/Spreadsheet_Excel_Writer/download</a></p>
44,855
<p>I need to convert a named instance of SQL server 2005, to a default instance.</p> <p>Is there a way to do this without a reinstall?</p> <hr> <p>The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the other 4 of us. I am looking for ...
<p>I also wanted to convert a named instance to default - my reason was to access it with just the machine name from various applications.</p> <p>If you want to <em>access a named instance</em> from any connection string <em>without using the instance name</em>, and using only the server name and/or IP address, then y...
<p>You shouldn't ever really need to do this. Most software that <strong>claims</strong> to require the default instance (like Great Plains or Dynamics) doesn't actually.</p> <p>If you repost with your situation (installed X, then Y, but need to accomplish Z) I bet you'll get some good workarounds.</p>
5,546
<p>I have a website built in C#.NET that tends to produce a fairly steady stream of SQL timeouts from various user controls and I want to easily pop some code in to catch all unhandled exceptions and send them to something that can log them and display a friendly message to the user.</p> <p>How do I, through minimal e...
<p>All unhandled exceptions finally passed through Application_Error in global.asax. So, to give general exception message or do logging operations, see <a href="http://www.eggheadcafe.com/community/aspnet/2/10021988/applicationerror-catches.aspx" rel="noreferrer">Application_Error</a>.</p>
<p>This is old question, but the best method (for me) is not listed here. So here we are:</p> <p>ExceptionFilterAttribute is nice and easy solution for me. Source: <a href="http://weblogs.asp.net/fredriknormen/asp-net-web-api-exception-handling" rel="nofollow">http://weblogs.asp.net/fredriknormen/asp-net-web-api-excep...
37,806
<p>I have a C/C++ application and I need to create a X509 pem certificate containing both a public and private key. The certificate can be self signed, or unsigned, doesn't matter.</p> <p>I want to do this inside an app, not from command line.</p> <p>What OpenSSL functions will do this for me? Any sample code is a ...
<p>I realize that this is a very late (and long) answer. But considering how well this question seems to rank in search engine results, I figured it might be worth writing a decent answer for.</p> <p>A lot of what you will read below is borrowed from <a href="http://www.opensource.apple.com/source/OpenSSL/OpenSSL-22/o...
<p>Any chance of doing this via a <code>system</code> call from within your app? Several good reasons for doing this:</p> <ul> <li><p>Licensing: Calling the <code>openssl</code> executable arguably separates it from your application and may provide certain advantages. <em>Disclaimer: consult a lawyer on this.</em><...
31,998
<p><img src="https://farm4.static.flickr.com/3200/3116366800_570cc971b9_m.jpg" alt="Screenshot of Drop Down" /></p> <p>This would be my issue I have a drop down that's not displaying fully. I'm not sure even where to start so here's the HTML surronding the drop down and I'll provide the CSS also.</p> <p>HTML</p> <pre><...
<p>It looks like you are setting "line-height:15px;" on "select" elements. Remove that and see if it fixes the issue.</p>
<p>It may not be the DDL, but that something else on the page may be covering a part of it. In FireFox, try "Inspecting Element" on the whitespace that is at the bottom of the DDL.</p>
49,112
<p>I have an application, written in C++ using MFC and Stingray libraries. The application works with a wide variety of large data types, which are all currently serialized based on MFC Document/View serialize derived functionality. I have also added options for XML serialization based on the Stingray libraries, whic...
<p>The <a href="http://www.boost.org/doc/libs/1_36_0/libs/serialization/doc/index.html" rel="nofollow noreferrer">Boost Serialization</a> library supports XML. This library basically consists in:</p> <ol> <li>Start from the principles of MFC serialization and take all the good things it provides.</li> <li>Solve every ...
<p>We use TinyXML for all our XML needs be it MFC or straight C++.</p> <p><a href="http://sourceforge.net/projects/tinyxml" rel="nofollow noreferrer">http://sourceforge.net/projects/tinyxml</a></p>
27,845
<p>I have included a resource in my Visual Studio 2005 solution that was a file on the hard drive. It is a text file, that contains text, and has a <strong>.htm</strong> extension.</p> <p>For months it worked fine, until I wanted to edit the contents of the text file. Suddenly Visual Studio insists on syntax checking ...
<p>This obviously begs the question – why do you use a wrong file extension on a system, where file type is determined by these extensions?</p> <p>Sorry, the answer is of course wrong. I was pretty sure I had done it that way already. Still, I think the above comment is still valid, even if not applicable universally....
<p>Perhaps this?</p> <p><a href="http://weblogs.asp.net/scottgu/archive/2007/09/18/vs-2008-support-to-treat-html-css-and-jscript-validation-issues-as-warnings-instead-of-errors.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2007/09/18/vs-2008-support-to-treat-html-css-and-jscript-validation-iss...
48,271
<p>Good day,</p> <p>we just moved from asp.net 1.1 to asp.net 2.0. We are using ajax update panels.</p> <p>In an Apress book (Pro asp.net 2008) , I've read that when you use the updatepanel, you don't reduce the acount of bandwidth sent, because the entire page is still sent. </p> <p>That in mind, I've also read on ...
<p>The simplest way to do this is to add the <code>.config</code> file in the deployment section on your unit test.</p> <p>To do so, open the <code>.testrunconfig</code> file from your Solution Items. In the Deployment section, add the output <code>.config</code> files from your project's build directory (presumably <...
<p>Your unit tests are considered as an environment that runs your code to test it. Just like any normal environment, you have i.e. staging/production. You may need to add a <code>.config</code> file for your test project as well. A workaround is to create a class library and convert it to Test Project by adding necess...
44,753
<p>I'd like to create some directories of data for some unit tests and I'd like these directories to be in the default temporary directory for the user.</p> <p>I could just create a subdir under /tmp I suppose, but I don't want to make an assumption about how somebody has set up their own machine.</p> <p>I'm planning...
<p>Don't use <code>tmpnam()</code> or <code>tempnam()</code>. They are insecure (see the <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/tempnam.3.html" rel="noreferrer">man page</a> for details). Don't assume <code>/tmp</code>. Use <a href="http://developer.apple.com/documentation/C...
<p>Use the <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/tempnam.3.html" rel="nofollow noreferrer">tempnam(), tmpnam() or tmpfile()</a> function.</p>
48,966
<p>I'd like to find a way to do a SQL query that will calculate the cidr (bit representation) of a subnet mask stored in the database. So for example, I've got either 255.255.255.0 or its decimal value (4294967040) stored in the database. I'd like to do a select and get back /24 representation via the query.</p> <p>...
<p>I think I have found the solution to my issue. Here is what I have done:</p> <pre><code>select CONCAT(INET_NTOA(ip_addr),'/',32-log2((4294967296-ip_mask))) net from subnets order by ip_addr </code></pre> <p>Basically I take my decmial mask and subtract it from the maximum decimal value. I then to a log2 on tha...
<pre><code>-- -- Dumping routines for database -- /*!50003 DROP FUNCTION IF EXISTS `INET_ATOC` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_se...
35,311
<p>I want to parse a config file sorta thing, like so:</p> <pre><code>[KEY:Value] [SUBKEY:SubValue] </code></pre> <p>Now I started with a <code>StreamReader</code>, converting lines into character arrays, when I figured there's gotta be a better way. So I ask you, humble reader, to help me.</p> <p>One restr...
<blockquote> <p>I considered it, but I'm not going to use XML. I am going to be writing this stuff by hand, and hand editing XML makes my brain hurt. :')</p> </blockquote> <p>Have you looked at <a href="http://www.yaml.org/" rel="noreferrer">YAML</a>?</p> <p>You get the benefits of XML without all the pain and suff...
<p>Regardless of the persisted format, using a Regex would be the fastest way of parsing. In ruby it'd probably be a few lines of code.</p> <pre><code>\[KEY:(.*)\] \[SUBKEY:(.*)\] </code></pre> <p>These two would get you the Value and SubValue in the first group. Check out MSDN on how to match a regex against a stri...
3,486
<p>I've been looking for some guidelines on how to layout PHP code. I've found some good references, such as the following:</p> <p><a href="http://www.dagbladet.no/development/phpcodingstandard/" rel="nofollow noreferrer">http://www.dagbladet.no/development/phpcodingstandard/</a></p> <p>and <a href="https://stackover...
<p>There's really not a single, common standard for these things. Most languages are more restrictive than PHP in this sense.</p> <p>In the later years, a lot of so-called frameworks have emerged, and amongst other things they define a set of rules for everything from naming over where to place files and to which styl...
<p>I usually try and follow the standards that are set by the language's core libraries.... oh wait.</p> <p>Seriously through - you should try and follow the <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="nofollow noreferrer">MVC pattern</a> in any web application as it is pretty much standard pract...
39,518
<p>I need to figure out a way uniquely identify each computer which visits the web site I am creating. Does anybody have any advice on how to achieve this?</p> <p>Because i want the solution to work on all machines and all browsers (within reason) I am trying to create a solution using javascript.</p> <p>Cookies will n...
<h1>Introduction</h1> <p>I don't know if there is or ever will be a way to uniquely identify machines using a browser alone. The main reasons are:</p> <ul> <li>You will need to save data on the users computer. This data can be deleted by the user any time. Unless you have a way to recreate this data which is unique for...
<p>My post might not be a solution, but I can provide an example, where this feature has been implemented.</p> <p>If you visit the signup page of <code>www.supertorrents.org</code> for the first time from you computer, it's fine. But if you refresh the page or open the page again, it identifies you've previously visit...
26,622
<p>I have an iphone app where I call these three functions in appDidFinishLaunching:</p> <pre><code>glMatrixMode(GL_PROJECTION); glOrthof(0, rect.size.width, 0, rect.size.height, -1, 1); glMatrixMode(GL_MODELVIEW); </code></pre> <p>When stepping through with the debugger I get EXC BAD ACCESS when I execute the first ...
<p>I've run into this with OpenGL calls if two threads are attempting to draw to the OpenGL scene at once. However, that doesn't sound like what you're doing.</p> <p>Have you properly initialized your display context and framebuffer before this call? For example, in my UIView subclass that does OpenGL drawing, I cal...
<p>You need to replace the current matrix with the identity matrix before calling glOrthof. This can be done with glLoadIdentity()</p>
32,545
<p>How do I connect to a MSSQL database using Perl's DBI module in Windows?</p>
<p>Use DBD::ODBC. If you just create a data source with the Control Panel -> System Management -> ODBC Data Sources -> System Data Source or User Data Source (those are the names as I remember them, but my XP isn't in English, so I can't check), then all you have to do is use the name of that data source in the DBI co...
<p>Using OLEDB with Integrated Security (Windows Authentication):</p> <p><code>DBI:ADO:Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=localhost;Initial Catalog=$dbName;</code></p>
24,823
<p>I would like to call my unmanaged C++ libraries from my C# code. What are the potential pitfalls and precautions that need to be taken? Thank you for your time.</p>
<p>There are a couple routes you can go with this - one, you can update your unmanaged C++ libraries to have a managed C++ extensions wrapper around them and have C# utilize those classes directly. This is a bit time-consuming, but it provides a nice bridge to legacy unmanaged code. But be aware that managed C++ exte...
<p>You can also call into unmanaged code via P/Invoke. This may be easier if your code doesn't currently use COM. I guess you would probably need to write some specific export points in your code using "C" bindings if you went this route.</p> <p>Probably the biggest thing you have to watch out for in my experience is ...
10,226
<p>Languages like C and even C# (which technically doesn't have a preprocessor) allow you to write code like:</p> <pre><code>#DEFINE DEBUG ... string returnedStr = this.SomeFoo(); #if DEBUG Debug.WriteLine("returned string =" + returnedStr); #endif </code></pre> <p>This is something I like to use in my code as a...
<p>PHP doesn't have anything like this. but you could definitely whip up something quickly (and perhaps a regex parse to strip it out later if you wanted). i'd do it as such:</p> <pre><code>define('DEBUG', true); ... if (DEBUG): $debug-&gt;writeLine("stuff"); endif; </code></pre> <p>of course you'd have to write yo...
<p>It has a <code>define</code> funciton, documented here: <a href="http://us.php.net/manual/en/language.constants.php" rel="nofollow noreferrer">http://us.php.net/manual/en/language.constants.php</a>.</p> <p>Given the set of differences between variables and constants explained in the documentation, I assume that PHP...
23,462
<p>I need to import largish (24MB) text files into a MySQL table. Each line looks like this:</p> <pre><code>1 1 0.008 0 0 0 0 0 </code></pre> <p>There are one or more spaces after each field, and the last field is tailed by about 36 spaces before the newline.</p> <p>How do I ...
<p>If you're on unix/linux then you can put it through sed.</p> <p>open a terminal and type:</p> <pre><code>sed 's/ \+/ /g' thefile &gt; thefile.new </code></pre> <p>this replaces all sequences of multiple spaces with one space.</p>
<p>You can also use the same command posted by Jauco to change the delimiter to ';' or \n. That would also help.</p>
18,938
<p><code>My ISP</code> account requires that I send a username &amp; password for outbound <code>SMTP</code> mail. </p> <p>How do I get <code>PHP</code> to use this when executing <code>php.mail()?</code> The <code>php.ini</code> file only contains entries for the server <code>(SMTP= )</code> and <code>From: (sendmail...
<p>PHP <code>mail()</code> command does not support authentication. Your options:</p> <ol> <li><a href="http://sourceforge.net/projects/phpmailer" rel="noreferrer">PHPMailer</a>- <a href="http://phpmailer.codeworxtech.com/index.php?pg=tutorial#2" rel="noreferrer">Tutorial</a></li> <li><a href="http://pear.php.net/pack...
<p>Use Mail::factory in the Mail PEAR package. <a href="http://email.about.com/od/emailprogrammingtips/qt/et073006.htm" rel="nofollow noreferrer">Example.</a></p>
13,734
<p>I'm not looking for java-web-start, I'm looking for a thick-client application installation toolkit. I've got a stand-alone application that consists of several files (jar files, data files, etc) and would need to do some pretty standard installation tasks, like asking the user for target directories, have them loc...
<p>Not an MSI-Installer but crossplatform: <a href="http://izpack.org/" rel="noreferrer">izPack</a></p> <p>It's xml-file based with it's own GUI or ant task (whtaever you prefer)</p>
<p>The Nullsoft Scriptable Install System <a href="http://nsis.sourceforge.net/Main_Page" rel="nofollow noreferrer">NSIS</a> (originally used for winamp) creates really nice installers for windows, and it's very powerful. It has a compiler that runs under linux, but the resulting installer is windows-only, unfortunatel...
22,257
<p>I maintain the build system at my company, which is currently using CVS. This build system is used across multiple projects and multiple CVS repositories.</p> <p>Whenever we have a release milestone, we create a tag. In CVS, this is easy:</p> <pre><code>$ cvs tag TAG_NAME </code></pre> <p>That command works reg...
<p>Here is how I implemented this, in case anyone is curious:</p> <pre><code>&lt;!-- First, we need to get the svn repository root URL by parsing the output of 'svn info'. --&gt; &lt;exec executable="svn" failonerror="yes"&gt; &lt;arg line="info"/&gt; &lt;redirector outputproperty="svninfo.out" errorproperty=...
<p>Unlike CVS, tags are more than just a symbolic name in subversions, that's the point. We you create a tag, you are actually creating a branch. I recommend to read this, if you haven't already: <a href="http://svnbook.red-bean.com/" rel="nofollow noreferrer">http://svnbook.red-bean.com/</a></p>
36,208
<p>I have an application which is a portal application and I want to allow other users add their applications to it. In order to do this I need some way to be able to access their applications in mine. Is this possible?</p>
<p>You cannot put WARs inside of other WARs. You need an EAR file to contain WARs, EJBs, etc. One way to implement inter-WAR communication is to package that logic directly in the EAR. It all depends on what you're trying to do.</p>
<p>Maybe you need a plugin system or portlet, so your user will not develop a war application but include their portlet inside your application (war). There's a standard : JSR 168 and several implementations : <a href="http://developers.sun.com/portalserver/reference/techart/jsr168/" rel="nofollow noreferrer">http://de...
21,520
<p>I have seen the ASP.NET community buzzing about MVC. I know the basics of its origin, and that there are many sites (unless I am mistaken, stack overflow itself) based on ASP.NET MVC. </p> <p>From everything I have heard and read about MVC it seems to be the future of ASP.NET development. But since I don't usually...
<p>Here are my 2 cents about MVC for web applications. For the sort of GUI apps for which MVC was originally intended, "listener" code was required, so that the UI could be updated when events altered the model data.</p> <p>In MVC for the web this is unnecessary, you get your listener for free: the web server, and th...
<p>I work in a shop that has both ASP.NET and MVC applications. I think originally I was biased toward web forms because I worked with them from several years, but after working on a few MVC projects I prefer it. </p> <p>Something to consider, however, is that if you have a team of experienced web form developers in...
37,329
<p>I'm setting up our new Dev server, what is the easiest way to assign multiple IP addresses to Windows 2008 Server Network Adapter?</p> <p>I'm setting up our development machine, running IIS 7 and want to have the range between 192.168.1.200 - .254 available when I'm setting up a new website in IIS 7.</p>
<p>The complete CMD.EXE loop:</p> <pre><code>FOR /L %b IN (200,1,254) DO netsh interface ip add address "your_adapter" 192.168.1.%b 255.255.255.0 </code></pre> <p>In the code above, replace "your_adapter" with the actual interface name (usually "Local Area Connection"). In addition, the netmask at the end is an assum...
<p>Network Connections -> Local Area Network Connection Properties -> TCP/IP Properties -> Advanced -> IP Settings -> Add Button.</p>
17,203
<p>If I'm making a simple grid based game, for example, I might have a few 2d lists. One might be for terrain, another might be for objects, etc. Unfortunately, when I need to iterate over the lists and have the contents of a square in one list affect part of another list, I have to do something like this.</p> <pre><c...
<p>I'd start by writing a generator method:</p> <pre><code>def grid_objects(alist, blist): for i in range(len(alist)): for j in range(len(alist[i])): yield(alist[i][j], blist[i][j]) </code></pre> <p>Then whenever you need to iterate over the lists your code looks like this:</p> <pre><code>for...
<pre><code>for d1 in alist for d2 in d1 if d2 = "whatever" do_my_thing() </code></pre>
22,931
<p>Obviously it gets updated during a write operation, but are there any non-destructive operations that also force an update? Basically looking to be able to do the equivalent of the *nix touch command, but in C# programmatically.</p>
<p>Use the function SetFileTime (C++) or File.SetLastWriteTime (C#) to set the last write time to the current time. </p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetime.aspx" rel="nofollow noreferrer">System.IO.File.SetLastWriteTime(string path, DateTime lastWriteTime);</a></p>
39,435
<p>I am trying to send some data from a LINQ query in C# to an Excel speed sheet using OLE</p> <p>I have a query like this:</p> <pre><code>Var data = from d in db.{MyTable} where d.Name = "Test" select d; </code></pre> <p>I have the Excel OLE object working fine, I just can't figure out how to ...
<p>Sending individual OLE commands for each Excel cell is very slow so the key is to create an object array like this:</p> <pre><code>int noOfRows = data.Count - 1; int noOfColumns = mydataclass.GetType().GetProperties().Count() - 1; Object[noOfRows, noOfColumns] myArray; </code></pre> <p>Sending an object array allo...
<p>I assume you are not using OLE in a web scenario, because it will eventually fail. </p> <p>If you just need raw data, you can dump to a tab-delimited textfile:</p> <p>var lines = data.Select(d => d.Name + '\t' + d.AnotherProperty + ...);</p>
49,290
<p>I'm migrating a website made in classic asp to asp.net, but the asp.net dev server doesn't handle .asp pages.</p> <p>Is it possible to make it run .asp pages? Maybe a custom httphandler for .asp?</p> <p>thanks!</p>
<p>Are you running Winxp with IIS installed? If so, here's what I do: hit the asp pages in the browser using your local IIS, and then open the folder where the ASP pages reside as a website project in VS. Go to the Debug menu, choose Attach to Process, and then look for the dllhost.exe process that is running under th...
<p>The last time I had to debug asp pages I found it was easier to insert a bunch of Response.Write()'s. If you cant find a way to do it in VS, then this may help. </p>
43,381
<pre><code>Nozzle diameter = .4 Extrusion multiplier = 1 Extrusion Width = .45 &lt;-- I feel like this could be reduced to fix it? Layer Height = .3 </code></pre> <p>I'm using Simplify3D.</p> <p><a href="https://i.stack.imgur.com/SsiMS.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/SsiMS.jpg" alt="ente...
<p>If it's on each corner, and not the layer change corner, it's a combination of overshoot and the short "pause" of the printer when it changes direction. </p> <p>You can minimize it, but it won't go away 100% (due to overshoot from direction changes), usually models with a slight rounded corners work great. If yo...
<p>Your printer is over extruding.</p> <p>It looks like PLA on the photo, the preset multiplier in S3D is 0.90 (not 1.0!)</p> <p>The nozzle diameter should be the same as the extrusion width (both 0.40).</p> <p>When you set the width to auto you get a bigger width. I don't really know why, but it was told me so.</p>...
473
<p>I am printing out a list of college majors we offer, then within each major, we have concentrations for each major.</p> <p>Our Science Major has the following concentrations: Environmental Science &amp; Forestry, Chiropractic, Chemistry, Biology</p> <p>Here is a screen shot of what it is doing: <a href="https://i....
<p>Without some javascript you won't be able to do this. With mozilla or webkit you can use -[moz|webkit]-column-count: 2; but even that isn't going to give you the same solution that the given css is almost providing for you, in other words the ordering will be vertical instead of horizontal. When I was playing with t...
<p>Try float: right instead of float: left.</p> <p>This works for Firefox 2. Doesn't work with (many) other browsers.</p>
41,611
<p>I have this Document table with some meta data for the document in it and also the document content as a blob.</p> <p>then I use lucene.Net to query my documents; which in return gives me a list of Guids to my Document table and also two fields containing the highlighted html versions of the document name and extra...
<p>You can specify that a field is delay loaded. Its one of the properties available for table fields in the DBML designer.</p>
<p>Would it help to create a View in your database that excludes the blob, and then generate your dbml from the view? It's not too terribly different from your second option, but keeps the changes mainly in the database itself, without requiring any changes to your existing table structure.</p>
23,076
<p>I have a header file x.h which is included by more than one *.c source files. This header file has some structure variables defined.</p> <p>I have put multiple inclusion prevention guard at the beginning of the header file as:</p> <pre><code>#ifndef X_H #define X_H ... .. //header file declarations and definitons...
<p>If the linker is complaining, it means you have definitions rather than just declarations in your header. Here's an example of things that would be wrong.</p> <pre><code>#ifndef X_H #define X_H int myFunc() { return 42; // Wrong! definition in header. } int myVar; // Wrong! definition in header. #endif </code>...
<p>Maybe <code>X_H</code> is already defined somewhere else? I just ran into this issue, where Xlib defines <code>X_H</code> in /usr/include/X11/X.h.</p> <p>To check, you can call <code>gcc -dM -E</code> (if you are using gcc), e.g. in the buildsystem I’m using that works with <code>CC=gcc CFLAGS="-dM -E" make</code>....
31,049
<p>I've got the following Linq2Sql and it's doing more than one round trip for my 'SELECT' statement. I'm not sure why. First the code, then the explanation:-</p> <pre><code>from p in db.Questions select new Models.Question { Title = p.Title, TagList = (from t in p.QuestionTags select t.Tag.Name...
<p>The ToList() is definitely holding you back. You should do a ToList() on the whole query.</p> <p>Another thing that I think you can do is use "let". I think in this case, it can create a delayed execution and be included in the expression tree, but YMMV.</p> <pre><code>from p in db.Questions let Tags = (from t i...
<p>I guess the problem is that you should call .ToList() for the whole query too. This will return the whole collection at one from the db.</p> <p>In your case, the first SQL command returns only IDs of all questions and then, single SQL call occurs for every question (during iteration in a foreach loop) - see @x1 par...
48,519
<p>Is there any simple way to access the <code>DataContext</code> in a linq2sql entity class.</p> <p>I'm trying to create something like <code>EntitySet</code> but I cannot figure out how the <code>EntitySet</code> has access to the context that created the entity object in the first place.</p> <p>I want to have a re...
<p>I've just had to do exactly the same thing. Here's my solution (albeit probably not the best approach, but is at least quite elegant):</p> <p>Firstly, Create an interface for all your entities to implement that inherits from INotifyPropertyChanging. This is used to hook up some extension methods and keep our implem...
<p>I know exactly what you mean. We're supposed to do our calculations/validation within the entity's partial class, but if the entity doesn't have access to the datacontext then how much can we do? For instance, in my SalesOrder object, whenever the "Ship To" address gets changed, the SalesOrder needs to query the dat...
48,166
<p>Sometimes it's difficult to describe some of the things that "us programmers" may think are simple to non-programmers and management types.</p> <p>So...</p> <p>How would you describe the difference between Managed Code (or Java Byte Code) and Unmanaged/Native Code to a Non-Programmer?</p>
<p>Managed Code == "Mansion House with an entire staff or Butlers, Maids, Cooks &amp; Gardeners to keep the place nice"</p> <p>Unmanaged Code == "Where I used to live in University"</p>
<p>"The specific term managed code is particularly pervasive in the Microsoft world."</p> <p>Since I work in MacOS and Linux world, it's not a term I use or encounter.</p> <p>The Brad Abrams "<a href="http://blogs.msdn.com/brada/archive/2004/01/09/48925.aspx" rel="nofollow noreferrer">What is Managed Code</a>" blog p...
31,398
<p>I want to do sparse high dimensional (a few thousand features) least squares regression with a few hundred thousands of examples. I'm happy to use non fancy optimisation - stochastic gradient descent is fine.</p> <p>Does anyone know of any software already implemented for doing this, so I don't have to write to my ...
<p>While I don't know for sure, this strikes me as the kind of thing that <a href="http://www.netlib.org/lapack/" rel="nofollow noreferrer">LAPACK</a> (linear algebra package) would be able to provide support for. They are typically interested in large matrix math, incluing sparse matrices and out-of-core sizes. The ...
<p>I'd suggest taking a look at <a href="http://www.netlib.org/lapack/" rel="nofollow noreferrer">LAPACK</a>. It's a pretty mature linear algebra library, although interfacing with it can be a little tricky, since it's written in Fortran. That's fine, though, since Fortran is ABI compatible with C, if you get your fu...
25,358
<p>I need to provide statistics on how many lines of code <code>(LOC)</code> associated with a system. The application part is easy but I need to also include any code residing within the SQL Server database. This would apply to stored procedures, functions, triggers, etc. </p> <p>How can I easily get that info? Can i...
<p>In Management Studio, right click the database you want a line count for... select Tasks -> Generate Scripts, you can select script options in the Scripts Wizard to include or exclude objects, when you have it set the way you like it can generate to a new query window </p>
<p>Personally you might just script the objects to file using SQL Server Management tools, it will get a few extras in there for the checks to do the drop first incase the object exists.</p>
10,077
<p>Here are the requirements:</p> <p>Must be alphanumeric, 8-10 characters so that it is user friendly. These will be stored as unique keys in database. I am using Guids as primary keys so an option to use GUids to generate these unique Ids would be preferable.</p> <p>I am thinking on the lines of a base-n converter ...
<p>You might consider <a href="http://en.wikipedia.org/wiki/Base_36" rel="nofollow noreferrer">base 36.</a> in that it can do letters and numbers. Consider removing I (eye) and O (Oh) from your set so they don't get mixed up with 1 (one) and 0 (zero). Some people might complain about 2 and Z as well.</p>
<p>You may want to try a CRC32 hashing algorithm. The CRC32 generates an 8 character string.</p> <p><a href="http://en.wikipedia.org/wiki/Cyclic_redundancy_check" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Cyclic_redundancy_check</a></p> <p><a href="http://textop.us/Hashing/CRC" rel="nofollow noreferrer"...
26,702
<p>I used to use the standard mysql_connect(), mysql_query(), etc statements for doing MySQL stuff from PHP. Lately I've been switching over to using the wonderful MDB2 class. Along with it, I'm using prepared statements, so I don't have to worry about escaping my input and SQL injection attacks.</p> <p>However, there...
<p>This sounds like a problem with the MDB2 API fumbling PHP's duck typing semantics. Because the empty string in PHP is equivalent to NULL, MDB2 is probably mis-treating it as such. The ideal solution would be to find a workaround for it within it's API, but I'm not overly familiar with it.</p> <p>One thing that you ...
<p>I'm confused. It looks like you're using mysqli OO (from the tags and style), but the syntax is different than the <a href="http://us.php.net/manual/en/mysqli.prepare.php" rel="nofollow noreferrer">manual</a> on php.net, which says to do this instead:</p> <pre><code>$query = "INSERT INTO mytable SET somevarchar = ...
33,405
<p>Is there a ColdFusion analog for the deployment descriptor/web.xml file found in a J2EE web container? I know CF is running on top of JRun and that I could just tweak the JRun dd, but what about an application-specific configuration file? Is there something like this that I'm not aware of or do you just have to roll...
<p>ColdFusion 8 has several application-specific configurations that can be set in the application.cfc file</p> <p>application.cfc also implements several "general events" which occur during application execution. </p>
<p>ColdFusion provides client and server deployment descriptor files located in \ColdFusion8\wwwroot\WEB-INF. The files are client-config.wsdd and server-config.wsdd respectfully</p>
24,219
<p>I don't edit CSS very often, and almost every time I need to go and google the <a href="http://www.w3.org/TR/REC-CSS2/box.html" rel="noreferrer">CSS box model</a> to check whether <code>padding</code> is inside the <code>border</code> and <code>margin</code> outside, or vice versa. (Just checked again and <code>pad...
<p>When working with CSS finally drives you mad the padded cell that they will put you in has the padding on the <em>inside</em> of the walls.</p>
<p>Margin:When you want move the block. Padding: When you want move the items within a block.</p>
5,266
<p>Imagine this case where I have an object that I need to check a property. However, the object can currently have a null value.</p> <p>How can I check these two conditions in a single &quot;if&quot; condition?</p> <p>Currently, I have to do something like this:</p> <pre class="lang-cs prettyprint-override"><code>if (...
<pre class="lang-cs prettyprint-override"><code>if (myObject != null &amp;&amp; myObject.Id != pId) { myObject.Id = pId; myObject.Order = pOrder; } </code></pre> <p><code>&amp;&amp;</code> is a short-circuiting logic test - it only evaluates the right-hand-side if the left-hand-side is true. Contrast to <code>a &...
<pre><code>if (myObject != null &amp;&amp; myObject.Id != pId) { myObject.Id = pId; myObject.Order = pOrder; } </code></pre>
49,026
<p>Looking for a string to pass to String#matches(String) that will match IPv4, and another to match IPv6.</p>
<pre><code>public static final String IPV4_REGEX = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z"; public static final String IPV6_HEX4DECCOMPRESSED_REGEX = "\\A((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?) ::((?:[0-9A-Fa-f]{1,4}:)*)(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4...
<p>The regex allows the use of leading zeros in the IPv4 parts.</p> <p>Some Unix and Mac distros convert those segments into octals.</p> <p>I suggest using <code>25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d</code> as an IPv4 segment.</p>
6,819
<p>I'm pretty new to developing AIR apps, so maybe this is a dumb question, but I can't seem to find any answers from google. Any help you can give me is greatly appreciated.</p> <p>I'm building an AIR app with Ajax using an api that is identical to flickr's Api, with a shared secret key. The problem is that the air i...
<p>You may want to use <a href="http://help.adobe.com/en_US/AIR/1.5/jslr/flash/data/EncryptedLocalStore.html" rel="nofollow noreferrer">EncryptedLocalStore</a> to securely store you API key.</p> <p>But, you won't be able to distribute it with the application as the store's encryption depends of which OS the applicatio...
<p>First question - does the license allow you write an app and give it to someone else to use with your key, rather than having their own key?</p> <p>If so, and if this is an AIR-compatible SDK, they should have some method they recommend.</p> <p>EDIT:</p> <p><a href="https://stackoverflow.com/questions/86163/why-d...
37,632
<p>I want to run a shell command in Terminal, then clear the console, from Applescript.</p> <p>If I was doing this by hand, I'd use ^K -- how do I send the ^K character in a string to Terminal?</p>
<p>At the moment, async support is not built into MVC. It's on the feature list, but no guarantees as to exactly when it might be released (and in what form).</p>
<p>As Brad mentioned, Microsoft is working on a solution as part of MVC futures. There is also an implementation at: <a href="http://code.msdn.microsoft.com/AsyncMvc/Wiki/View.aspx?id=11350" rel="nofollow noreferrer">http://code.msdn.microsoft.com/AsyncMvc/Wiki/View.aspx?id=11350</a></p>
34,734
<p>Already implemented performance boosters : - Get compatible image of GraphicsConfiguration to draw on - Enable OpenGL pipeline in 1.5: Not possible due to severe artifacts</p> <p>So far I am fine, the main profiled bottleneck of the program is drawing an image with several thousand tiles. Unfortunately it is not re...
<p>You could try to set the popups to non-leightweight. I am not quite sure if it works but it could, because the popup is a native component then and will not be overdrawn. Setting Popups to heavyweight: JPopupMenu.setDefaultLightWeightPopupEnabled(false)</p> <p>More Information: <a href="http://www.oracle.com/techne...
<p>Well, I'm not sure if I fully understand your problem but it seems that main problem is with repainting the panel where image is displayed. Should you please provide your drawing routine which draws image on panel? </p>
31,053
<p>Is it possible to use BackGroundWorker thread in <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> 2.0 for the following scenario, so that the user at the browser's end does not have to wait for long time?</p> <h2>Scenario</h2> <ol> <li>The browser requests a page, say SendEmails...
<p>If you don't want to use the AJAX libraries, or the e-mail processing is REALLY long and would timeout a standard AJAX request, you can use an AsynchronousPostBack method that was the "old hack" in the .net 1.1 days. </p> <p>Essentially what you do is have your submit button begin the e-mail processing in an asynch...
<p>It is possible. Once you start a new thread asynchronously from page, page request will proceed and send the page back to the user. The async thread will continue to run on the server but will no longer have access to the session.</p> <p>If you have to show task progress, consider some Ajax techniques.</p>
8,225
<p>I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.</p> <p>The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not.</p> <p>The two ways are:</...
<p>The difference is that <code>functionOne</code> is a function expression and so only defined when that line is reached, whereas <code>functionTwo</code> is a function declaration and is defined as soon as its surrounding function or script is executed (due to <a href="http://adripofjavascript.com/blog/drips/variable...
<p>Another difference between both function is functionOne can be used as a variable that can hold multiple functions within and functionTwo holds some block of code that gets executed all when called. Please check below :</p> <pre><code> var functionOne = (function() { return { sayHello: function(){...
43,700
<p>The Gang of Four's <a href="http://en.wikipedia.org/wiki/Design_Patterns" rel="nofollow noreferrer">Design Patterns</a> uses a word processor as an example for at least a few of their patterns, particularly Composite and Flyweight.</p> <p>Other than by using C or C++, could you really use those patterns and the obj...
<p>Flyweight really is just a way of conserving resources in situations where there are thousands of objects with intrinsic shared state, so it could be useful in higher level languages than C/C++. Maybe the GoF's example using glyphs in a document was not the best choice to illustrate this pattern.</p> <p>I think the...
<p>This question actually seems to be about Java vs. C++ performance, and that's not the object orientation so much as running on a virtual machine with garbage collection and such.</p> <p><a href="http://scribblethink.org/Computer/javaCbenchmark.html" rel="nofollow noreferrer">This whitepaper</a> on Java vs. C++ perf...
3,641
<p>So for this one project, we have a bunch of queries that are executed on a regular basis (every minute or so. I used the "Analyze Query in Database Engine " to check on them. </p> <p>They are pretty simple: select * from tablex where processed='0'</p> <p>There is an index on processed, and each query should return...
<p>Statistics are what SQL Server uses to determine the viability of how to get data.</p> <p>Let's say, for instance, that you have a table that only has a clustered index on the primary key. When you execute <code>SELECT * FROM tablename WHERE col1=value</code>, SQL Server only has one option, to scan every row in th...
<p>In Sql Server 2005, set auto create statistics and auto update statistics. You won't have to worry about creating them or maintaining them yourself, since the database handles this very well itself.</p>
22,760
<p>I need to use lists for my program and needed to decide if I use std::vector or std::list. The problem with vector is that there is no remove method and with list that there is no operator []. So I decided to write my own class extending std::list and overloading the [] operator.</p> <p>My code looks like this:</p>...
<p>Depending on your needs, you should use <code>std::vector</code> (if you need often appends/removes at the end, and random access), or <code>std::deque</code> (if you need often appends/removes at the end or at the beginning, and your dataset is huge, and still want random access). Here is a good picture showing you...
<p>There is no need to call destructor of std::list , because you already derive from std::list when destructor called for myList automatically std::list destructor will be called.</p>
47,830
<p>Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the <em>actual</em> name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)?</p> <p>Some ways I know, all of which seem quite backwards:</p> <ol> <li>Given the full path, search for each f...
<p>And hereby I answer my own question, based on <a href="https://stackoverflow.com/questions/74451/getting-actual-file-name-with-proper-casing-on-windows#74588">original answer from <em>cspirz</em></a>.</p> <p>Here's a function that given absolute, relative or network path, will return the path with upper/lower case ...
<p>After a quick test, <a href="http://msdn.microsoft.com/en-us/library/aa364980(VS.85).aspx" rel="nofollow noreferrer">GetLongPathName()</a> does what you want.</p>
10,010
<p>I'm writing a simple program that's going to parse a logfile of a packet dump from wireshark into a more readable form. I'm doing this with python.</p> <p>Currently I'm stuck on this part:</p> <pre><code>for i in range(len(linelist)): if '### SERVER' in linelist[i]: #do server parsing stuff packet = linel...
<p>Looking at the<a href="http://docs.python.org/library/stdtypes.html#file.readlines" rel="nofollow noreferrer">file.readlines()</a> doc:</p> <blockquote> <p>file.readlines([sizehint])</p> <p>Read until EOF using readline() and return a list containing the lines thus read. If the optional sizehint argument is present,...
<p>General idea is:</p> <pre><code>inpacket = False packets = [] for line in open("logfile"): if inpacket: content += line if line in ("\n", ""): # empty line inpacket = False packets.append(content) elif '### SERVER' in line: inpacket = True content = line # put here packets.append on ...
37,456
<ol> <li>We are looking to store transactional data in SharePoint lists. The lists will easily grow to 100,000+ items.</li> <li>How would the query performance be compared with queries on a database table with these columns?</li> </ol> <p>Queries: Select by Id Select Where ColumnValue = X Group By OrderId Group By Dat...
<p>Don't do it. SharePoint is not good at handling transactional data and will perform badly.</p> <p>Any abilities you might have to improve performance at the database level (like adding indexes) may have detrimental effects on the SharePoint installation (although columns in lists can be "indexed" through SharePoint...
<p>The SharePoint lists will be slower. </p> <p>More overhead = worse performance. </p>
22,327
<p>I am currently learning OLAP &amp; MDX after many years of relational database development. </p> <p>Any tips on getting started in MDX? What are the best books and resources to learn MDX?</p>
<p>A classic, albeit a bit dated, book is <a href="https://rads.stackoverflow.com/amzn/click/com/1846281741" rel="nofollow noreferrer" rel="nofollow noreferrer">Fast Track to MDX</a>. It's a great overview and a quick read, though it doesn't cover the new MDX features of SQL Server 2005.</p> <p>The Spofford book <a hre...
<p>We used the LearnItFirst.com training videos and found them to be a very thorough introduction to SSAS and MDX. There are around 40 hours of content plus exercises including around 6 hours of pure MDX Training.</p> <p>The details for the SSAS Course can be found at: <a href="http://www.learnitfirst.com/Course/165/...
4,461
<p>When deploying a ready to use erlang application I <strong>don't</strong> want the user to </p> <ul> <li>Find the right erl release on the internet.</li> <li>Install the erl vm</li> <li>unzip and decide a location for the beam files (with the application)</li> <li>read a readme</li> <li>modify anything that even lo...
<p>The location you specify states:</p> <pre><code>Message: 'nodeName' is null or not an object Line: 19 Char: 150 Code: 0 URI: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js </code></pre> <p>That particular piece of jquery is:</p> <pre><code>nodeName:function(elem,name){ return elem.nod...
<p>Have you tried it without a space after the comma? <a href="http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN" rel="nofollow noreferrer">The examples given in the specification have no space.</a></p>
22,621
<p>When looking at C# code, I often see patterns like this:</p> <pre><code>DataType[] items = GetSomeItems(); OtherDataType[] itemProps = new OtherDataType[items.Length]; int i = 0; foreach (DataType item in items) { // Do some stuff with item, then finally itemProps[i] = item.Prop; i++; } </code></pre> ...
<p>If you are using C# 3.0 that will be better;</p> <pre><code>OtherDataType[] itemProps = items.Select(i=&gt;i.Prop).ToArray(); </code></pre>
<p>Some data structures are not well suited for random access but can be iterated over very fast ( Trees, linked lists, etc ). So if you need to iterate over one of these but need a count for some reason, your doomed to go the ugly way...</p>
36,015
<p>In several web application projects I've been a part of, the client asks to be able to create their own forms. The question arises on how to store their form definitions, and then how to store user inputted values into those custom forms.</p> <p>I've seen it done two ways:</p> <ol> <li><p>Assuming that the client ...
<p>What you're describing is often called "Entity-Attribute-Value," and sometimes described as "mixing data and metadata." That is, the names of attributes (fields) are stored as strings (data). </p> <p>This leads to a bunch of complex problems like making sure each form instance includes the same set of fields, or ...
<p>There is a third option, where you create tables and add columns if needed. It depends on how many forms are created, but databases can handle easily a lot of tables. So if a user wants to add a form 'Car Registration Form', you add a table 'CarRegistrationForm'. For every field they want on the form, you can let th...
15,983
<p>is there an elegant way to determine the size of data downloaded from a website -- bearing in mind that not all requests will go to the same domain that you originally visited and that other browsers may in the background be polling at the same time. Ideally i'd like to look at the size of each individual page -- or...
<p>Have you tried Firebug for Firefox?</p> <p>The "Net" panel in Firebug will tell you the size and fetch time of each fetched file, along with the totals.</p> <p><a href="https://i.stack.imgur.com/cxnwA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxnwA.png" alt="enter image description here"><...
<p>You can download the entire site and then you will know for sure!</p> <p><a href="https://www.httrack.com/" rel="nofollow noreferrer">https://www.httrack.com/</a></p>
21,795
<p>I'm writing a license agreement dialog box with Win32 and I'm stumped. As usual with these things I want the "accept/don't accept" buttons to become enabled when the slider of the scroll bar of the richedit control hits bottom, but I can't find a way to get notified of that event. The earliest I've been able to le...
<p>You need to sub-class the edit box and intercept the messages to the edit box itself. <a href="http://msdn.microsoft.com/en-us/library/ms997565.aspx" rel="nofollow noreferrer">Here's an artical on MSDN about subclassing controls</a>.</p> <p>EDIT: Some code to demonstrate the scroll bar enabling a button: </p> <pre...
<p>Even though it is possible, I don't think you should do it that way - the user will have no clue why the buttons are disabled. This can be very confusing, and confusing the user should be avoided at all costs ;-)</p> <p>That's why most license dialogs have radio buttons for accept/decline with decline enabled by de...
29,688
<p>My boss is looking for a .NET text control to build a custom editor on. Here’s what we need it to do:</p> <ul> <li>Supports embedded tables, with easily editing (like Word tables).</li> <li>Supports different text styles (font, size, color, background, etc).</li> <li>Ability to programmatically set styles, both on ...
<p>Try the <a href="http://www.telerik.com/products/aspnet-ajax/editor.aspx" rel="nofollow noreferrer">editor</a> control from <a href="http://www.telerik.com/" rel="nofollow noreferrer">telerik</a>. have a look at the <a href="http://demos.telerik.com/aspnet-ajax/Editor/Examples/Overview/DefaultCS.aspx" rel="nofollow ...
<p>How about hosting the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx" rel="nofollow noreferrer">The WPF RichTextBox</a> control <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.aspx" rel="nofollow noreferrer">in WinForms</a>.</p>...
48,682
<p>I have created a VB.Net lending application for a cooperative that caters to widows. The application tracks the members' loans and payments, and is also used as an accounting system. In my first release, the users felt that showing a messagebox every time an error occurs is very annoying. My solution is to output er...
<p>They were probably annoyed with a modal dialog that interrupted their input flow. Imagine if Word interrupted you every time you typed a word it couldn't find in the dictionary, instead of just underlining it in red and letting you fix your typos later. You'd type pretty slow.</p> <p>I recommend you just highligh...
<p>Start with someone else's validator control, like this one:</p> <p><a href="http://www.codeproject.com/KB/validation/validationprovider.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/validation/validationprovider.aspx</a></p> <p>and then modify it if necessary. This one works as the Lizard suggests...
34,951
<p>I've been attempting to write a Lisp macro that would perfom the equivalent of ++ in other programming languages for semantic reasons. I've attempted to do this in several different ways, but none of them seem to work, and all are accepted by the interpreter, so I don't know if I have the correct syntax or not. My...
<p>Remember that a macro returns an expression to be evaluated. In order to do this, you have to backquote:</p> <pre><code>(defmacro ++ (variable) `(incf ,variable)) </code></pre>
<p>This should do the trick, however I'm not a lisp guru.</p> <pre><code>(defmacro ++ (variable) `(setq ,variable (+ ,variable 1))) </code></pre>
9,133
<p>Two reasons this would be useful, in case there's some other way to achieve these goals: 1) Building in the Flash IDE is really slow; I was hoping a third-party compiler would be faster. 2) It would be nice to be able to build projects on machines that don't have the Flash IDE installed. I'm familiar with other AS3 ...
<p>To answer the original question, there is no way to compile FLAs without using the Flash IDEs. </p> <p>The only partial solution to to use a command line script that automates opening Flash Authoring and compiling the FLA. You can find one such example here:</p> <p><a href="http://www.mikechambers.com/blog/2004/02...
<p>There's a plugin for Eclipse called FDT. It uses the open source compiler MTASC and supports ANT. The tool is free for OpenSource developers. Get more Infos here: <a href="http://fdt.powerflasher.com/" rel="nofollow noreferrer">http://fdt.powerflasher.com/</a></p> <p>Hope it helps :)</p>
8,886
<p>On my Mac OS X 10.5 (Leopard) machine, I have installed Git 1.6.0.2 using the <a href="http://code.google.com/p/git-osx-installer/" rel="nofollow noreferrer">git-OSX-Installer</a> from Google Code. The installer installs Git to /usr/local/Git.</p> <p>I would now like to keep up with the latest stable Git release (M...
<p>The script <a href="http://www.simplicidade.org/notes/archives/2008/09/updated_xgitupd.html" rel="nofollow noreferrer">x-git-update-to-latest-version</a> will compile and install the latest version of git (from the git repository).</p> <p>It's set to use the current <code>HEAD</code> revision of the master branch,...
<p>I compiled git from source with no problems, as far as i can tell no port is required so just keep your version updated in the usual way.</p>
33,017
<p>I need to use a byte array as a profile property in a website. Normally I would declare the type as system.string or system.int32 but I have no idea what the type if for a byte array.</p> <p>EDIT: I need to use this as profile property that is declared in the web.config like below:</p> <pre><code>&lt;profile defau...
<p>If the file is opened by another process in exclusive mode, you can't -- Windows won't let you. In that case, the best you can do is to either wait for the other process to close the file and then delete it, or have it be deleted at the next reboot by using <a href="http://msdn.microsoft.com/en-us/library/aa365240(...
<p>I don't think that it is possible. On windows, you cannot delete a file which has open handles. <a href="http://support.microsoft.com/kb/320081" rel="nofollow noreferrer">http://support.microsoft.com/kb/320081</a></p> <p>However, from your description you don't need to keep the file open in your application. Open t...
38,625
<p>How do I define the Assembly folder for an Application correctly? I tried to use the registry Key: HKLM/SOFTWARE/Microsoft/.NET Framework/AssemblyFolders/App-Name and use the (Default) to set this to the path where the assemblies are located.</p> <p>Some time ago this worked fine, but as I compiled a new Version an...
<p>OtrosLogViewer user VFSFileSystems and can load logs from remote server (ftp, sftp, smb, http). It supports java.util.logging.XMLFormatter and java.util.logging.SimpleFormatter. See: <a href="http://code.google.com/p/otroslogviewer/" rel="noreferrer">http://code.google.com/p/otroslogviewer/</a></p>
<p>VFSLogFilePatternReceiver uses Jakarta Commons-VFS, so it supports SFTP and SCP. See: <a href="http://commons.apache.org/vfs/filesystems.html#SFTP" rel="nofollow noreferrer">http://commons.apache.org/vfs/filesystems.html#SFTP</a></p>
22,630
<p>I'm trying to run an interactive command through paramiko. The cmd execution tries to prompt for a password but I do not know how to supply the password through paramiko's exec_command and the execution hangs. Is there a way to send values to the terminal if a cmd execution expects input interactively?</p> <pre><...
<p>The full paramiko distribution ships with a lot of good <a href="https://github.com/paramiko/paramiko/tree/master/demos" rel="noreferrer">demos</a>.</p> <p>In the demos subdirectory, <code>demo.py</code> and <code>interactive.py</code> have full interactive TTY examples which would probably be overkill for your sit...
<p>Take a look at example and do in similar way </p> <p>(sorce from <a href="http://jessenoller.com/2009/02/05/ssh-programming-with-paramiko-completely-different/" rel="nofollow">http://jessenoller.com/2009/02/05/ssh-programming-with-paramiko-completely-different/</a>):</p> <pre><code> ssh.connect('127.0.0.1', use...
48,862
<p>I am <strong>losing hair</strong> on this one ... it seems that when I fix width an HTML SELECT control it renders its width differently depending on the browser. </p> <p>Any idea how to to standardize this without having to turn to multiple style sheets?</p> <p>Here is what I am working with:</p> <pre><code>.co...
<p>Form controls will always be less obedient to styling attempts,in particular selects and file inputs, so the only way to reliably style them cross-browser and with future-proofing in mind, is to replace them with JavaScript or Flash and mimic their functionality</p>
<p>Try using <a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow noreferrer">Firebug</a> or Chrome's "Inspect Element" feature (right click on the select control, click "inspect element") to see exactly what style properties are being inherited/rendered for that specific object. That should lead...
16,361
<p>I'm trying to make an SVN post-commit script that makes backups to a Gmail drive. Blat doesn't seem to support TLS. Are there any good scripting programs on windows that can send an email via TLS?</p>
<p>I don't know about other mail senders, but <a href="http://www.stunnel.org/" rel="nofollow noreferrer">stunnel</a> is able to accept a plain text connection and tunnel it through an SSL connection. You can have it listen on localhost:25 and make an SSL connection to an smtps server (tcp/465). I have used it in a s...
<p>The blat folks are saying the stunnel is the best bet for tls support but i've found that gmail doesn't require tls to send mail. Now, the data may not be encrypted but I send out email via my account (to other gmail accounts only) all the time as an automated process and it works great. if you need it let me know...
29,349