instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I used web site deployment projects but I discovered that the aspnet_merge.exe utility is not on my build server. This prevents me from being able to build. In order to get this utility I have to install the Windows SDK which comes as an ISO file and is over 1gb. I do not want to install this entire thing when I all... | <p>I downloaded the "web" version of the SDK because the setup is only 500KB and it prompts you for which components to install and only downloads and installs the ones you choose. I unchecked everything except for "<strong>.NET Development Tools</strong>". It then downloaded and installed about 250MB worth of stuff,... | <p>It looks like aspnet_merge.exe can be found in the <a href="http://msdn.microsoft.com/en-us/library/aa479568.aspx" rel="nofollow noreferrer">Web Deployment Projects</a> install. I don't have a clean box to test on, but if I recall correctly, you could put this on a build server without installing VisualStudio or th... | 34,293 |
<p>The existing site has it own "users" table in a database. I'm wondering how to integrate PHPList with the existing site so that a user can check the newsletter during registration. I installed phplist thru cpanel.</p>
<p>Any help is greatly appreciated.</p>
| <p>PHPList lets you define a table prefix to avoid name clashes</p>
<p>See "Using a database prefix" : <a href="http://docs.phplist.com/PhpListConfigDatabase" rel="nofollow noreferrer">http://docs.phplist.com/PhpListConfigDatabase</a></p>
| <p>My solution is keeping both tables in sync manually, both by a daily run script and on demand when a user account is modified in the main site. I don't propagate changes from phplist to the master app tough.</p>
| 24,009 |
<p>In ActionScript, how can you test if an object is defined, that is, not null?</p>
| <blockquote>
<p><strong>test if an object is defined</strong></p>
</blockquote>
<p>This works in AS2 and AS3, and is the most reliable way to test if an object has a value.</p>
<pre><code>if (obj != null) {
doSomethingWith(obj);
}
</code></pre>
<p>Its also the most reliable way to test an object's property and... | <p>You could also loop through a parent object to see if it contains any instances of the object you're looking for.</p>
<pre><code>foundit=false;
for (var i in this) {
if (this[i]._name == "MyMovie") {
foundit=true;
}
}
</code></pre>
| 37,965 |
<p>I've noticed, using visual studio 2003, that I can "comment out" my comments to make them no longer be comments. This one needs an example:</p>
<p>If I have:</p>
<pre><code>/*
int commented_out = 0;
*/
</code></pre>
<p>I can comment out the /* and */ with // and code within the /* and */ is no longer "commented o... | <p>Yep, this is perfectly normal behavior. The C++ standard says that a <code>/*</code> is the start of a comment block only if it itself is not commented out. I often use what you've written above to comment or uncomment a block of code by adding/deleting one character. A nice little trick for switching between two... | <p>Actually this works in almost any language with C style block comments.</p>
<pre><code>/*
int foo = 0;
/*/
int foo = 1;
//*/
</code></pre>
<p>or even XML comments</p>
<pre><code><!--->
a
<!-->
b
<!---->
</code></pre>
<p>unfortunately I'm drawing a blank on lua's lightsaber comments</p>
<pre><c... | 35,781 |
<p>I would like to drag and drop my data file onto a Python script and have it process the file and generate output. The Python script accepts the name of the data file as a command-line parameter, but Windows Explorer doesn't allow the script to be a drop target.</p>
<p>Is there some kind of configuration that needs ... | <p>Sure. From a <a href="http://mindlesstechnology.wordpress.com/2008/03/29/make-python-scripts-droppable-in-windows/" rel="noreferrer">mindless technology article called "Make Python Scripts Droppable in Windows"</a>, you can add a drop handler by adding a registry key:</p>
<blockquote>
<p>Here’s a registry import ... | <p>For those who use argv in .py script but still can't drag files to execute,
this could be solved by simply <em>using Python Launcher (with rocket icon)</em></p>
<p>the script property "Open File" was set as python.exe,
which has no knowledge that the script needs command-line arguments "%*"</p>
<... | 17,261 |
<p>I have a VB.NET application which needs to generate reports (invoices) which contains optional images. The images are going to be loaded into 1 of 6 places on the report, but will reside on the client PC (deployed with the application). I've been trying to access the ICROleObject object, which is what's placed ont... | <p>There is no reliable way to do this using the current iPhone SDK. You should file a <a href="http://bugreporter.apple.com" rel="nofollow noreferrer">bug</a> with Apple to try to get them to add more control over the camera.</p>
| <p>I've been trying to do this for quite some time. </p>
<p>Aswell as the link in the post above mine. I've stumbled across this page - <a href="http://blog.airsource.co.uk/index.php/2008/11/11/views-of-uiimagepickercontroller/" rel="nofollow noreferrer">http://blog.airsource.co.uk/index.php/2008/11/11/views-of-uiimag... | 33,643 |
<p>I am implementing a design that uses custom styled submit-buttons. They are quite simply light grey buttons with a slightly darker outer border:</p>
<pre><code>input.button {
background: #eee;
border: 1px solid #ccc;
}
</code></pre>
<p>This looks just right in Firefox, Safari and Opera. The problem is with... | <p>Well this works here:</p>
<pre><code><html>
<head>
<style type="text/css">
span.button {
background: #eee;
border: 1px solid #ccc;
}
span.button input {
background:none;
border:0;
... | <p>A hackish solution might be to use markup like this:</p>
<pre><code><button><span>Go</span></button>
</code></pre>
<p>and apply your border styles to the span element.</p>
| 15,382 |
<p>I may be going about this backwards...
I have a class which is like a document and another class which is like a template. They both inherit from the same base class and I have a method to create a new document from a template (or from another document, the method it is in the base class).
So, if I want to create a... | <p>If you want to be able to do anything other than create a new object just from the code in the constructor, don't use a constructor in the first place.</p>
<p>Do you really need an Instance constructor taking an int? Why not turn it into a static factory method:</p>
<pre><code>public static Instance CreateInstance... | <p>I'm with Jon, it is much better to use factory methods as this is crystal clear to the developer about what is happening (something <em>more</em> than just creating a new object). </p>
<p>A factory method says to the programmer, "there's some special initialisation happening here, where using <strong>new</strong> ... | 42,002 |
<p>Some time ago, I came across an online article that described how to configure Windows XP to automatically accept the default option on a dialog box. As I (vaguely) recall, it was some sort of oddball registry configuration that did this, and it amazingly worked. Yeah - it's dangerous, but it would be very helpful r... | <p>I found this again later. There's a registry entry called "EnableDefaultReply" that can be used to control this functionality. An MSDN article with extensive detail, cleverly called <a href="http://msdn.microsoft.com/en-us/library/ms940850.aspx" rel="nofollow noreferrer">"Enabling Default Reply"</a> can be found at ... | <p>Not sure if XP can do that, but give <a href="http://www.basta.com/Product.aspx?pid=13" rel="nofollow noreferrer">Buzof from Basta Computing</a> a try. Works very well for what you have in mind.</p>
<p>Maybe you recall setting the option of the mouse pointer to the default button?</p>
| 26,970 |
<p>I have just discovered the nifty unhandled exception handler for cocoa-touch.</p>
<p>Now that I can gracefully notify the user about any unhandled exceptions that might crash my application, I'd like to shut down my application after notifying the user that a crash has occured.</p>
<p>Does anyone know how to shut ... | <p>You can call [[UIApplication sharedApplication] terminate]; - that won't build the screenshot Springboard uses to animate the application's exit, though, so the screen will just go black until the icons move in. There doesn't seem to be a published way to do this; the UIApplication header doesn't even mention the -t... | <p>Apple's documentation says there is no "normal" way to shut down. In your case - an unhandled exception - immediate termination makes sense anyway.</p>
| 29,973 |
<p>I need to write an SNMP agent for my application.</p>
<p>I read the <a href="http://www.codeproject.com/KB/IP/SNMP_Agent_DLL__Part1_.aspx" rel="noreferrer">CodeProject article</a> on how to write an SNMP extension agent DLL using win32, but would like to know if it is possible to do it with managed code.</p>
<p>Al... | <p>If you would like to use the SNMP protocol from the .Net Framework, regard this library: <a href="http://sharpsnmplib.codeplex.com/" rel="noreferrer">#SNMP</a>.</p>
<p>It seems possibly to write your own SNMP server with it. But the standard SNMP Agent archictecture is not based on .Net und so - I assume - you cann... | <ol>
<li>the best library I have used in 8
years of NMS development -
<a href="http://snmp.adventnet.com/" rel="nofollow noreferrer">adventnet</a> </li>
<li>you can write your own, but you need to understand <a href="http://en.wikipedia.org/wiki/ASN.1" rel="nofollow noreferrer">ASN</a>. Good luck with that. </li>
<li>S... | 16,489 |
<p>Currently, I'm using a Creality printer to print PLA (that's what I have on hand) but I'm definitely interested in working with other materials that require higher temperatures (both much higher, and just enough higher that the stock hotend is very marginal) in the future. </p>
<p>I understand that all-metal hotend... | <blockquote>
<p>All-metal hotends are less forgiving </p>
</blockquote>
<p>Yes </p>
<blockquote>
<p>not as good for PLA</p>
</blockquote>
<p>No</p>
<blockquote>
<p>but how bad?</p>
</blockquote>
<p>That is very subjective and totally depending on the skill of the 3D printer operator! So, that part of the que... | <blockquote>
<p>Are they so bad I should plan on changing back to a PTFE hot end?</p>
</blockquote>
<p>No, all metal hot end are not that bad, and may even be beneficial when printing at higher temperatures. You mentioned that you want to print ABS and other such materials. At temperatures this high, my understandin... | 1,668 |
<p>I have a form in Axapta/Dynamics Ax (EmplTable) which has two data sources (EmplTable and HRMVirtualNetworkTable) where the second data source (HRMVirtualNetworkTable) is linked to the first on with "Delayed" link type.</p>
<p>Is there a way to set an filter on the records, based on the second data source, without ... | <p>You could use "Outer join" instead of "Delayed" then change the join mode programmaticly when there is search for fields on HRMVirtualNetworkTable.</p>
<p>Add this method to class SysQuery:</p>
<pre><code>static void updateJoinMode(QueryBuildDataSource qds)
{
Counter r;
if (qds)
{
qds.joinMode(... | <p>You can do it programmaticaly by joining QueryBuildDataSource or by extended filter (Alt+F3, Right click on datasorce, 1:n and find sev\condary DS)</p>
| 47,658 |
<p>I previously asked about Version Cue 3 vs Subversion. I think this is a better question and someone suggested <a href="http://www.gridironsoftware.com/Flow/" rel="noreferrer">http://www.gridironsoftware.com/Flow/</a> I hope this question will allow others to join in and suggest other tools or give specific recommend... | <p>Take a look at <a href="http://joshcarter.com/productivity/svn_hg_git_for_home_directory" rel="nofollow noreferrer">this article</a> comparing Subversion, Mercurial, Git and Bazaar for managing the files in a home directory, including image files and large Photoshop files that are being edited and versioned.</p>
<p... | <p>Take a look at Perforce (<a href="http://www.perforce.com" rel="nofollow noreferrer">www.perforce.com</a>), particularly if you are managing these files in the context of development projects. It is a code-oriented system, but it supports binary files well and has a Photoshop plugin. P4 isn't free, but it is worth e... | 5,688 |
<p>I wonder what the best way to make an entire tr clickable would be?</p>
<p>The most common (and only?) solution seems to be using JavaScript, by using onclick="javascript:document.location.href('bla.htm');" (not to forget: Setting a proper cursor with onmouseover/onmouseout).</p>
<p>While that works, it is a pity ... | <p>If you don't want to use javascript, you can do what Chris Porter suggested by wrapping each td element's content in matching anchor tags. Then set the anchor tags to <code>display: block</code> and set the <code>height</code> and <code>line-height</code> to be the same as the td's height. You should then find that ... | <p>If you're already relying on javascript for the click, then you can also use javascript to show the url in status area, change the cursor, or do other things so it looks more like a link. Of course, the browser may ignore the code that sets the status area.</p>
| 24,057 |
<p>Does any one know of an API that would allow me to draw something like this. It would need some interactivity to it</p>
<ul>
<li>zooming</li>
<li>change second dimension axis angle</li>
</ul>
<p>I was looking at <a href="http://www.jfree.org/jfreechart/" rel="nofollow noreferrer">JFreeChart</a> but I don't see any... | <p>I did this quite recently. Pretty simple, really. I can send you the code to draw the base grid, and the rest is just a series of histograms (Polygons) with an offset between each layer.</p>
| <p>May be <a href="http://www.tan.co.jp/JClass/Chart3D" rel="nofollow noreferrer">Chart3D</a> might be what you are after (not free though)</p>
<p><img src="https://i.stack.imgur.com/429al.jpg" alt="http://www.tan.co.jp/images/jclass/chart3d/3d_4e.gif?width=260&height=173&quality=95&sharpen=0.15&format... | 33,622 |
<p>I use the MFC list control in report view with grid lines to display data in a vaguely spreadsheet manner.</p>
<p>Sometimes when the user scrolls vertically through the control, extra grid lines are drawn, which looks terrible.</p>
<p>This does not happen when the slider or the mousewheel are used to scroll, only ... | <p>This is indeed a bug related to "smooth scrolling," here's a workaround:</p>
<pre><code>void CMyListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
__super::OnVScroll(nSBCode, nPos, pScrollBar);
Invalidate();
UpdateWindow();
}
</code></pre>
| <p>To fix this bug in the MFC List Control you need to specialize the control, over-ride the method wich responds to the scroll, and force it to redraw the list completely after it has done the scroll.</p>
<p>interface header</p>
<pre><code>class cSmoothListControl : public CListCtrl
{
public:
DECLARE_MESSAGE_MAP... | 22,134 |
<p>Why one would use one of the following packages instead of the other?</p>
<ul>
<li>Java Logging</li>
<li>Commons Logging</li>
<li>Log4j</li>
<li>SLF4j</li>
<li>Logback</li>
</ul>
| <p>In chronological order of api apperance (as far as I know):</p>
<ul>
<li>Log4j because most everybody uses it (in my experience)</li>
<li>Commons Logging because open source projects use it (so they can integrate with whatever logging framework is used in the integrated solution); especially valid if you're an API/... | <p>I would suggest creating a thin logging facade that can write to any of the logging frameworks, at which point the choice of backing engine become pretty much a moot point.</p>
| 46,232 |
<p>I have a package that I just made and I have an "old-mode" that basically makes it work like it worked before: importing everything into the current namespace. One of the nice things about having this as a package is that we no longer have to do that. Anyway, what I would like to do is have it so that whenever any... | <p>Well, as you specifically state that you want to alarm in the cases of <code>use Mod qw<:oldmode>;</code> This works better:</p>
<pre><code>package Foo;
use base qw<Exporter>;
use Carp qw<carp>;
...
sub import {
#if ( grep { $_ eq ':oldmode' } @_ ) { # Perl 5.8
if ( @_ ~~ ':oldmode' ) { ... | <p>You write your own <code>sub import</code> in <code>package Foo</code> that will get called with the parameter list from <code>use Foo</code>.</p>
<p>An example:</p>
<pre><code>package Foo;
use Exporter;
sub import {
warn "called with paramters '@_'";
# do the real import work
goto &{Exporter->... | 22,713 |
<p>I am currently running the following code based on Chapter 12.5 of the Python Cookbook:</p>
<pre><code>from xml.parsers import expat
class Element(object):
def __init__(self, name, attributes):
self.name = name
self.attributes = attributes
self.cdata = ''
self.children = []
... | <p>I looks to me as if you do not need any DOM capabilities from your program. I would second the use of the (c)ElementTree library. If you use the iterparse function of the cElementTree module, you can work your way through the xml and deal with the events as they occur.</p>
<p>Note however, Fredriks advice on using c... | <p>In Python3 you should change the syntax <br />
Instead of this</p>
<pre><code># get the root element
event, root = context.next()
</code></pre>
<p>Try this (like recommended in <a href="https://stackoverflow.com/questions/28542497/iterparse-object-has-no-attribute-next">Iterparse object has no attribute next</a>)</p... | 41,984 |
<p>We are trying to make big decisions about our support for classic asp. Does anyone see a reason why Microsoft can't drop support for IIS.</p>
<p>Any examples of Microsoft technologies like this that have had their support dropped would help. ASP is a tricky one because dropping support in IIS would eventually kill ... | <p>I think this is a possibility considering it is not enabled by default in IIS7.</p>
<p>Another point is that Visual Studio 2003 requires hacks to make it work with Vista. So its probably not a stretch to think that that IIS10 will require hacks to make classic ASP work...</p>
| <p>"Classic" Visual Basic 6 is already unsupported.</p>
<p>Of <em>course</em> Microsoft will eventually drop support for Classic ASP. It is not their policy to support every product forever.</p>
| 31,251 |
<p>I'm trying to figure out what would be the simplest way to validate required fields without having to do an if statement for each element's name. Perhaps just with a loop and verify its class.</p>
<p>What I'm trying to accomplish is to check only the ones that have the class name as "required"</p>
<pre><code><i... | <p>I'm not at all against the libraries suggested by others, but I thought that you may want some samples of how you could do it on your own, I hope it helps.</p>
<p>This should work:</p>
<pre><code>function validate() {
var inputs = document.getElementsByTagName("input");
for (inputName in inputs) {
... | <p>I would recommend you to use <a href="http://www.openjs.com/scripts/dom/css_selector/" rel="nofollow noreferrer">this javascript based css selector</a> wich will get all elements of a specific class. Validating the form just like the way you mentioned.</p>
| 44,054 |
<p>I have an existing GUI application that should have been implemented as a service. Basically, I need to be able to remotely log onto and off of the Windows 2003 server and still keep this program running.</p>
<p>Is this even possible?</p>
<p>EDIT: Further refinement here... I do not have the source, it's not my ap... | <p>Windows services cannot have GUIs, so you will need to either get rid of the GUI or separate your application into two pieces - a service with no UI, and a "controller" application. If you have the source code, converting the non-GUI code into a service is easy - Visual Studio has a 'Windows Service' project type th... | <p>First I would have to ask why your service needs a user interface. Most likely it does not but you probably need a client that gets data from this service. The reason services don't usually have GUI's is they may not have a window environment to run in. Services can start and run without a user logged in to the mach... | 7,667 |
<p>I have a questionable coding practice. </p>
<p>When I need to iterate through a small list of items whose count limit is under <code>32000</code>, I use <code>Int16</code> for my <em>i</em> variable type instead of <code>Integer</code>. I do this because I assume using the <code>Int16</code> is more efficient than ... | <p>You should <strong>almost always</strong> use <code>Int32</code> or <code>Int64</code> (and, no, you do not get credit by using <code>UInt32</code> or <code>UInt64</code>) when looping over an array or collection by index.</p>
<p>The most obvious reason that it's less efficient is that all array and collection inde... | <p>There is no significant performance gain in using a data type smaller than Int32, in fact, i read somewhere that using Int32 will be faster than Int16 because of memory allocation</p>
| 15,687 |
<p>According to MSDN</p>
<blockquote>
<p>The return value specifies the result
of the message processing; it depends
on the message sent.</p>
</blockquote>
<p>I know it is defined as </p>
<pre><code>typedef LONG_PTR LRESULT;
</code></pre>
<p>Meaning it will be 8 bytes on 64bit machine but it doesn't!</p>
<p>... | <p>No it's not safe, because the return value is defined by the message being sent and the handler.</p>
<p>If you control the handler and the message then it'd be possible, it's not safe in the general case. </p>
<p>James</p>
| <p>No it is not safe in general. Do not assume the downcast. Also, useful is to compile your code with /RTCc which ensures inadvertent casts are asserted at runtime.</p>
| 35,906 |
<p>Edit:
From another question I provided an answer that has links to a lot of questions/answers about singletons: <a href="https://stackoverflow.com/questions/1008019/c-singleton-design-pattern/1008289#1008289">More info about singletons here:</a></p>
<p>So I have read the thread <a href="https://stackoverflow.com... | <p>Answer:</p>
<p>Use a Singleton if:</p>
<ul>
<li>You need to have one and only one object of a type in system</li>
</ul>
<p>Do not use a Singleton if:</p>
<ul>
<li>You want to save memory</li>
<li>You want to try something new</li>
<li>You want to show off how much you know</li>
<li>Because everyone else is doing it ... | <p>In desktop apps (I know, only us dinosaurs write these anymore!) they are essential for getting relatively unchanging global application settings - the user language, path to help files, user preferences etc which would otherwise have to propogate into every class and every dialog.</p>
<p>Edit - of course these sho... | 11,214 |
<p>In a comment on a previous question, someone said that the following sql statement opens me up to sql injection:</p>
<pre><code>select
ss.*,
se.name as engine,
ss.last_run_at + interval ss.refresh_frequency day as next_run_at,
se.logo_name
from
searches ss join search_engines se on ss.engin... | <p>Assuming it is properly escaped, it doesn't make you vulnerable. The thing is that escaping properly is harder than it looks at first sight, and you condemn yourself to escape properly every time you do a query like that. If possible, avoid all that trouble and use prepared statements (or binded parameters or parame... | <p>That statement as such isn't really a problem, its "safe", however I don't know how you are doing this (one level up on the API stack). If $user_id is getting inserted into the statement using string operations (like as if you are letting Php automatically fill out the statement) then its dangerous.</p>
<p>If its g... | 40,847 |
<p>int l = strlen(s);</p>
<p>warning C4244: '=' : conversion from '__w64 int' to 'int', possible loss of data</p>
<p>I need to replace strlen with an inline function
int l = new_strlen(s);</p>
<p>But how do I portably get the result of the strlen into the int without a warning, and without using pragmas? I can guar... | <pre><code>const char * str = "Hello";
int len = static_cast< int >( strlen( str ) );
return len;
</code></pre>
<p>This code doesn't produce any error or warning even on Warning Level 4 (VS2005).
What compiler do you use?</p>
| <blockquote>
<p>I need to replace strlen with an
inline function int l = new_strlen(s);</p>
</blockquote>
<p>Note that in VC++, strlen is automatically replaced by a inline version when you build an optimized version.</p>
| 24,583 |
<p>I have an application where, in the course of using the application, a user might click from</p>
<pre><code>virginia.usa.com
</code></pre>
<p>to</p>
<pre><code>newyork.usa.com
</code></pre>
<p>Since I'd rather not create a new session each time a user crosses from one subdomain to another, what's a good way to s... | <p>You tagged this with ASP.NET and IIS, so I will assume that is your environment. Make sure you have this in your web.config:</p>
<pre><code><httpCookies domain=".usa.com"/>
</code></pre>
<p>If your 2 subdomains map to the same application, then you are done. However, if they are different applications you wi... | <p>If you're using PHP, one hack would be to make a little include script (or two) to do the following:</p>
<p>1 Serialize your $_SESSION array
2 Pass that string as a hidden input, making all your links to those buttons in separate forms using POST.
3 Also include a boolean hidden input to let your script know wh... | 34,491 |
<p>I am working on a database application that runs on various independent servers.
Each server runs an Instance of SQL Server 2005 with the same database. We would have a Master Server where that would be the definitive source of information and various "Client" Servers that would be distributed around (with no netwo... | <p>MS SQL Integration Services may help:</p>
<p><a href="http://www.microsoft.com/sql/technologies/integration/default.mspx" rel="nofollow noreferrer">http://www.microsoft.com/sql/technologies/integration/default.mspx</a></p>
| <p>MS SQL Integration Services may help:</p>
<p><a href="http://www.microsoft.com/sql/technologies/integration/default.mspx" rel="nofollow noreferrer">http://www.microsoft.com/sql/technologies/integration/default.mspx</a></p>
| 10,627 |
<p>Is it possible to configure Windows Servers that reside on the same domain such that when a web service call is made from a web app using an IP address, the request does not go via a proxy server?</p>
<p>The web service is running on one of the servers on the domain. </p>
<p>I want to configure IP based security o... | <p>I think that proxycfg.exe has what you need. Its a console application that is part of standard windows installation.
look at:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa384069.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa384069.aspx</a></p>
| <p>With ASMX the proxy can be set on the Proxy property:</p>
<p><a href="http://johnwsaundersiii.spaces.live.com/blog/cns!600A2BE4A82EA0A6!435.entry" rel="nofollow noreferrer">http://johnwsaundersiii.spaces.live.com/blog/cns!600A2BE4A82EA0A6!435.entry</a></p>
<p>With WCF, this is part of the binding configuration:</p... | 26,880 |
<p>Using Microsoft's AntiXssLibrary, how do you handle input that needs to be edited later?</p>
<p>For example:</p>
<p>User enters:
<code><i>title</i></code></p>
<p>Saved to the database as:
<code><i>title</i></code></p>
<p>On an edit page, in a text box it displays something like:
... | <p>Looks like you're encoding it more than once. In ASP.NET, using Microsoft's AntiXss Library you can use the HtmlAttributeEncode method to encode untrusted input:</p>
<pre><code><input type="text" value="<%= AntiXss.HtmlAttributeEncode("<i>title</i>") %>" /></code></pre>
<p>This results in
<... | <p>Yes, the code inside input boxes is safe from scripting attacks and does not need to be encoded. </p>
| 42,068 |
<p>Beyond the official documentation, are there any recommended resources for learning to build jQuery plugins. I'm particularly interested in building plugins for the UI libary. </p>
<p>I've been looking at the source for some of the official ones, but I've found they all look quite different from each other. Many ar... | <h2>Tutorial at "Learning jQuery"</h2>
<p><a href="http://www.learningjquery.com" rel="nofollow noreferrer">Learning jQuery</a> is a very helpful site, and has a <a href="http://www.learningjquery.com/2007/10/a-plugin-development-pattern" rel="nofollow noreferrer">great tutorial on plugin authoring</a>.</p>
<... | <p>Have you tried the Manning Publications book on jQuery, <a href="http://www.manning.com/bibeault/" rel="nofollow noreferrer">jQuery In Action</a>? The <a href="http://www.manning.com/bibeault/excerpt_contents.html" rel="nofollow noreferrer">table of contents</a> indicates there is good material on writing your own p... | 46,073 |
<p>I started a project a long time ago and created a <strong>Data Access Layer</strong> project in my solution but have never developed anything in it. What is the purpose of a data access layer? Are there any good sources that I could learn more about the Data Access Layer?</p>
| <p>In two words: <a href="http://en.wikipedia.org/wiki/Loose_coupling" rel="noreferrer">Loose Coupling</a></p>
<p>To keep the code you use to pull data from your data store (database, flat files, web services, whatever) separate from business logic and presentation code. This way, if you have to change data stores, yo... | <p>I recommend you read up here: <a href="http://msdn.microsoft.com/en-us/practices/default.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/practices/default.aspx</a>
Using a DAL will help you isolate your data access from your presentation and business logic. I use it a lot so that I can easily swap ou... | 8,471 |
<p>I ask because I am sending a byte stream from a C process to Java. On the C side the 32 bit integer has the LSB is the first byte and MSB is the 4th byte.</p>
<p>So my question is: On the Java side when we read the byte as it was sent from the C process, what is <a href="https://en.wikipedia.org/wiki/Endianness" re... | <p>Use the network byte order (big endian), which is the same as Java uses anyway. See man htons for the different translators in C.</p>
| <p>java force indeed big endian : <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.11" rel="nofollow noreferrer">https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.11</a></p>
| 47,293 |
<p>I have two questions:</p>
<p>1) How can I make an array which points to objects of integers?</p>
<pre><code>int* myName[5]; // is this correct?
</code></pre>
<p>2) If I want to return a pointer to an array, which points to objects (like (1)) how can I do this in a method? ie) I want to impliment the method:</p>
... | <blockquote>
<p>How can I make an array which points
to objects?</p>
</blockquote>
<pre><code>int * myName[5]; /* correct */
</code></pre>
<blockquote>
<p>If I want to return a pointer to an
array, which points to objects (like
(1)) how can I do this in a method?</p>
</blockquote>
<p>Technically, you write... | <p>Steve Jessop, I think you meant:</p>
<pre><code>int **myFunction() {
int **myArray = new int*[5];
return myArray;
}
</code></pre>
| 41,294 |
<p>What is the best practice for testing an API that depends on data from the database?
What are the issues I need to watch out for in a "Continuous Integration" environment that runs Unit Tests as part of the build process? I mean would you deploy your database as part of the build scripts (may be run your installer) ... | <p>As far as possible you should mock out code to avoid hitting the database altogether, but it seems to me you're right about the need to test your SQL somewhere along the line. If you do write tests that hit the database, one key tip for avoiding headaches is to make sure that your setup gets the data into a known st... | <p>One thing I did was create static methods that returned test data of a known state. I would then use a "fake" DAL to return this data as if I was actually calling the database. As for testing the sql/stored procedure, I tested it using SQL Management Studio. YMMV!</p>
| 30,259 |
<p>Has anyone run into issues serializing components into a file and reading them back, specifically in the area where the component vendor upgrades the VCL components. For example a file serialized with DelphiX and then years later read back with delphiY. Do the serialization formats change and if so what can be don... | <p>The built-in RTTI based system for serializing published properties is vulnerable to changes in the components. Going forwards is manageable as long as old properties are kept in new objects. I.e. you leave the property interface as is, but can toss away the contents if you like. Going backwards is worse - as a ne... | <p>Formats will defintely change, as vendors will add features to their components. Serialization simply loops over all published properties and saves them to a stream. When they are read back, each of the properties that is read from the stream will be set back to the component. If the property does not exist anymore,... | 9,960 |
<p>Let's say I have a simple chunck of XML:-</p>
<pre><code><root>
<item forename="Fred" surname="Flintstone" />
<item forename="Barney" surname="Rubble" />
</root>
</code></pre>
<p>Having fetched this XML in Silverlight I would like to bind it with <a href="http://en.wikipedia.org/wiki/... | <p>See <em><a href="http://grahammurray.wordpress.com/2010/05/30/binding-to-anonymous-types-in-silverlight/" rel="nofollow noreferrer">Binding to Anonymous types in Silverlight</a></em> for information.</p>
| <p>As far as I'm aware the Silverlight Binding lacks the XPath properties found in WPF so there is no nice way to bind directly to XML. When I've encountered this problem I've used xsd.exe against a schema to generate my classes and then use Xml Serialization to populate them. It's not ideal but at least I'm not writin... | 44,264 |
<p>What's the proper way to convert from a scientific notation string such as "1.234567E-06" to a floating point variable using C#?</p>
| <pre><code>Double.Parse("1.234567E-06", System.Globalization.NumberStyles.Float);
</code></pre>
| <p>Also consider using</p>
<pre><code>Double.TryParse("1.234567E-06", System.Globalization.NumberStyles.Float, out MyFloat);
</code></pre>
<p>This will ensure that <code>MyFloat</code> is set to value 0 if, for whatever reason, the conversion could not be performed. Or you could wrap the <code>Double.Parse()</code> ... | 9,022 |
<p>I have a web application deployed in an internet hosting provider. This web application consumes a WCF Service deployed at an IIS server located at my company’s application server, in order to have data access to the company’s database, the network guys allowed me to expose this WCF service through a firewall for se... | <p>You might try decorating your service class with:</p>
<pre><code>[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
</code></pre>
| <p>I don't know about the solution from Mitch Baker, never tried it. But this involves modifying the generated code. There is another way to get around that.</p>
<p>I assume that you generated client code using svcutil.exe, giving a MEX address that points to the firewall. When you do this, all the configuration neede... | 47,117 |
<p>I am coding in ColdFusion, but trying to stay in cfscript, so I have a function that allows me to pass in a query to run it with
<code>
<cfquery blah >
#query#
</cfquery> </code></p>
<p>Somehow though, when I construct my queries with <code>sql = "SELECT * FROM a WHERE b='#c#'"</code> and pass it in, Cold... | <p>ColdFusion, by design, escapes single quotes when interpolating variables within <code><cfquery></code> tags.</p>
<p>To do what you want, you need to use the <a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_m-r_14.html" rel="noreferrer"><code>PreserveSingleQuotes()</code></a> function.</p>
... | <p>I voted up Dave's answer since I thought he did a good job. </p>
<p>I'd like to add however that there are also several different tools designed for ColdFusion that can simplify a lot of the common SQL tasks you're likely to perform. There's a very light-weight tool called <a href="http://datamgr.riaforge.org/" rel... | 33,423 |
<p>I've been searching a lot but couldn't find a solution. How do you deal with a DateTime that should be able to contain an uninitialized value (equivalent to null)? I have a class which might have a DateTime property value set or not. I was thinking of initializing the property holder to DateTime.MinValue, which then... | <p>For normal DateTimes, if you don't initialize them at all then they will match <code>DateTime.MinValue</code>, because it is a value type rather than a reference type.</p>
<p>You can also use a nullable DateTime, like this:</p>
<pre><code>DateTime? MyNullableDate;
</code></pre>
<p>Or the longer form:</p>
<pre><... | <p>Given the nature of a date/time data type it cannot contain a <code>null</code> value, i.e. it needs to contain a value, it cannot be blank or contain nothing. If you mark a date/time variable as <code>nullable</code> then only can you assign a null value to it. So what you are looking to do is one of two things (th... | 27,337 |
<p>I have a dynamic Facelets page that needs to show information from database when the page loads. At this point in the flow, there have not been any form submissions. Every JSF example I can find only shows a form submission with dynamic results on the next page.</p>
<p>Every call I make to our database is currently... | <p>You should be able to do your initialization work in the constructor (or lazily in one of your accessors) of your managed bean.</p>
| <p>You write (with my emphasis added):</p>
<blockquote>
<p>Every call I make to our database is currently takes place after an action
has been triggered by a form submission. Where should this code go
if there <em>hasn't been a form submission</em>, and how do I trigger it? A
code snippet would really help me ... | 31,451 |
<p>I have some HTML that displays fine on FireFox3/Opera/Safari but not with IE7. The snippet is as follows:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></... | <p>What if you try it like this:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body bgcolor="#AA5566" >
<table width="100%" bord... | <p>I'm not quite sure why that is happening. What layout are you trying to achieve, does it really need to be a table? You shouldn't layout pages with tables, they should only be used for true tabular data.</p>
<p>Have you considered using divs?</p>
| 31,235 |
<p>When I try to commit the first revision to my git repository (git commit) from Cygwin, I'm getting an error in gvim which says "Unable to open swap file for "foo\.git\COMMIT_EDITMSG" [New Directory]. I think it might be some sort of permission problem, but I've tried removing the read-only flag from the folder, as w... | <blockquote>
<p>Unable to open swap file for "foo\.git\COMMIT_EDITMSG" [New Directory].</p>
</blockquote>
<p>Looks like the <code>git commit</code> is passing the file path as a Windows path, not a POSIX path. note the <code>\</code> in the message.</p>
<p><code>gvim</code> is going to try to open `foo.gitCOMMIT_ED... | <p>I faced the same issue first time but I found out that this is normal. Only I don't remember how to deal with Vim. I found solution in that link: <a href="http://vim.runpaint.org/basics/quitting-vim/" rel="nofollow noreferrer">http://vim.runpaint.org/basics/quitting-vim/</a>. I used the vim command :x that resulted ... | 31,960 |
<p>How do I insert Chinese characters into a SQLExpress text field? I'm using SQL Express from VS 2008. When I add Chinese characters, either via an import app I wrote or by pasting them in from the data view inside Visual Studio, they end up as question marks.</p>
| <p>Just add an 'N' before your text delimiter in the INSERT/UPDATE statement for fields of the nchar/nvarchar/ntext type:</p>
<p>INSERT INTO myTable (myField1, myField2) VALUES (N'any chinese character',N'any arabic character')</p>
| <p>Be sure you made your column type nchar, nvarchar or ntext. So you can store Unicode. It is all rather well described <a href="http://msdn.microsoft.com/en-us/library/aa223981.aspx" rel="noreferrer">here...</a></p>
| 38,949 |
<p>Is there a way to have msdn documentation on a usb key ?
either web or the MSDN Library program.
i've been setting up my usbkey with portableapps stuff.</p>
| <p>i think when you do step 2 and install the documentation just tell direct it to the usb key drive letter. easy peasy.</p>
| <p><a href="https://windows-cdn.softpedia.com/screenshots/MSDN-to-USB_2.png" rel="nofollow noreferrer"><img src="https://windows-cdn.softpedia.com/screenshots/MSDN-to-USB_2.png" alt="enter image description here" /></a></p>
<p>@Oleg You can use <a href="https://marketplace.visualstudio.com/items?itemName=Moataz99.MSDNt... | 5,806 |
<p>And how do you keep them in synch between test and production environments?</p>
<p>When it comes to indexes on database tables, my philosophy is that they are an integral part of writing any code that queries the database. You can't introduce new queries or change a query without analyzing the impact to the indexe... | <p>Indexes are a part of the database schema and hence should be source controlled along with everything else. Nobody should go around creating indexes on production without going through the normal QA and release process- particularly performance testing.</p>
<p>There have been numerous other threads on schema versio... | <p>I do not put my indexes in source control but the creation script of the indexes. ;-)</p>
<p>Index-naming:</p>
<ul>
<li>IX_CUSTOMER_NAME for the field "name" in the table "customer"</li>
<li>PK_CUSTOMER_ID for the primary key,</li>
<li>UI_CUSTOMER_GUID, for the GUID-field of the customer which is unique (therefore... | 18,458 |
<p>I am currently trying to create an Exception handler built into my windows service that, on an unhandled exception, sends a message to another program. I have built the method and gotten the communication working, but it seems that every time my program throws the error, (I have a raise call in the code to force it... | <p>You are missing a call to <a href="http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx" rel="noreferrer">SetErrorMode()</a>:</p>
<pre><code>SetErrorMode(SEM_NOGPFAULTERRORBOX);
</code></pre>
<p>This is needed to prevent the OS <a href="http://msdn.microsoft.com/en-us/library/ms681401(VS.85).aspx" rel="nor... | <p>Interesting.</p>
<p>Custom exception handler is called if you run the app in Delphi IDE (tried with 2007) but not if you run it from the command prompt.</p>
<p>Another interesting thing - I changed the main program code to </p>
<pre><code>begin
WriteLn('Starting');
try
ExceptProc := @ExceptionHandler;
... | 28,061 |
<p>I recently bought a BigTreeTech SKR V1.3 and uncommented <code>REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER</code> and clicked the upload button but faced an error that says:</p>
<pre><code>Marlin\src\lcd\ultralcd.cpp:767:9: error: 'touch_buttons' was not declared in this scope
if (touch_buttons) {
^~~~~~~~~~~~~
M... | <p>There is a temporary solution which I have found here, on the reprap forums, <a href="https://reprap.org/forum/read.php?13,857852,857876#msg-857876" rel="nofollow noreferrer">Re: Upload to the board failed after LCD enabled</a>:</p>
<blockquote>
<p>An official fix has been posted. Grab the new ultralcd.cpp from [... | <p><a href="http://marlinfw.org/meta/download/" rel="nofollow noreferrer">Marlin 2.0.0 is in an <strong><em>Alpha</em></strong> state.</a> 'Alpha' is a state before <em>Beta</em>, meaning, it's not hot off the presses, it isn't even <em>off the presses</em>. You need to go back to the most recent "stable" version of Ma... | 1,433 |
<p>I need to run some code when my computer resumes from hibernate (even before I logon). The laptop I am using has a bizzare problem. If I have an external monitor connected to it while resuming from hibernate the laptop chooses the external display as the main video device and the laptop screen remains blank. This be... | <p>This <a href="http://www.codeproject.com/KB/system/OSEvents.aspx" rel="nofollow noreferrer">article</a> on CodeProject discusses the various Windows messages that relate to power saving events.</p>
| <p>I think most laptops have issues with that. It is not something they seem to be able to solve in the drivers/ACPI BIOS.</p>
<p>I know Linux allows you to modify the ACPI tables, but I cannot remember if this is possible on Windows. </p>
<p>A Google should provide links to tools you can use to inspect your laptop's... | 43,918 |
<p>.Net's implementation of HTTP is ... problematic. Beyond some issues in compliance with HTTP/1.0, what's bugging me right now is that <code>HttpWebResponse.GetResponse()</code> with ReadTimeout <strong>and</strong> Timeout set to 5000 blocks for about 20 seconds before failing (the problem is it should fail after 5 ... | <p>According to <a href="http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/8e554674-8e4e-4e29-bb77-b9c2b287ed50" rel="nofollow noreferrer">Microsoft</a>, what could be hanging is possibly the DNS resolution, which may take up to 15 seconds.</p>
<p>Solution - do the DNS resolving on your own (Dns.BeginGetHo... | <p><a href="http://www.chilkatsoft.com/HttpDotNet.asp" rel="nofollow noreferrer">Chilkat</a> has a HTTP Component. I've never used it, but I have been impressed with some of their other components.</p>
| 15,694 |
<p>How do you calculate the number of <code><td></code> elements in a particular <code><tr></code>?</p>
<p>I didn't specify id or name to access directly, we have to use the <code>document.getElementsByTagName</code> concept.</p>
| <p>You can use something like the following:</p>
<pre><code>var rowIndex = 0; // rowindex, in this case the first row of your table
var table = document.getElementById('mytable'); // table to perform search on
var row = table.getElementsByTagName('tr')[rowIndex];
var cells = row.getElementsByTagName('td');
var cellCou... | <p>Something like</p>
<pre><code>var tot = 0;
var trs = document.getElementsByTagName("tr");
for (i = 0; i < trs.length; i++) {
tds = trs[i].getElementsByTagName("td");
tot += tds.length;
}
</code></pre>
<p>At the end, <code>tot</code> hold the total number of all td elements "sons" of tr elements.</p>
| 32,674 |
<p>We are trying to decide how to handle object persistence accross postbacks, to avoid getting the data from the database in every request, and I'm leaning towards using Session (it's an intranet application, there won't be thousands of users), but this is due to the fact that I suspect that only the reference to the ... | <p>I have tried this:</p>
<p>I have created a class and store an instance of this in session (session state mode: InProc). Instance lives in aspnet_wp.exe proc.</p>
<p>Then, I changed session state to SQL Server (still without [Serializable] attribute) and I got the following error.</p>
<p><strong>Unable to serializ... | <p>It's important to remember that In-Proc Session data is fairly fragile...meaning it may not be there when you most need it. If the worker process recycles for any reason <em>poof</em> it's gone.</p>
| 43,466 |
<p>I currently use my local web server to allow costumers to preview some applications and also to allow downloads of "nightly builds" of my open source library.</p>
<p>Problem is I changed my ISP and now my port 80 is blocked. </p>
<p>Altough I know I could easily change the port on the Apache server, I'd like to av... | <p>"and back again to the costumer on a transparent way"....will be taken care of by NAT so that shouldn't be a problem.</p>
<p>To handle the request translation from one string to another, well that's an issue since you need to transform the request before it hits the server. Look into some kind of URL forwarding ser... | <p>I think most DynamicDNS services allow port-forwarding.</p>
| 20,630 |
<p>I want to use google chrome as a control.</p>
<p>I think Enso does this because they have a dir in their folder called chrome...</p>
<p>Maybe there is a google chrome toolkit, SDK</p>
| <p>Lots of apps have folders named Chrome. The terms refers to the decorations and arrangments used for all the different GUI widgets.</p>
| <p>Google Chrome browser is based on WebKit as used by Safari. Chrome uses a different JS engine though. I don't think hosting WebKit is going to be a trivial task. <a href="http://webkit.org/" rel="nofollow noreferrer">http://webkit.org/</a></p>
| 25,370 |
<p>I have already extracted the tag from the source document using grep but, now I cant seem to figure out how to easily extract the properties from the string. Also I want to avoid having to use any programs that would not usually be present on a standard installation. </p>
<pre><code>$tag='<img src="http://imgs... | <p>You can use <a href="http://xmlstar.sourceforge.net/" rel="nofollow noreferrer">xmlstarlet</a>. Then, you don't even have to extract the element yourself:</p>
<pre><code>$ echo $tag|xmlstarlet sel -t --value-of '//img/@src'
http://imgs.xkcd.com/comics/barrel_cropped_(1).jpg
</code></pre>
<p>You can even turn this ... | <p>If xmlstarlet is available on a standard installation and the sequence of src-title-alt does not change, you can use the following code as well:</p>
<pre><code>tag='<img src="http://imgs.xkcd.com/comics/barrel_cropped_(1).jpg" title="Don'"'"'t we all." alt="Barrel - Part 1" />'
xmlstarlet sel -T -t -m "/img" ... | 22,989 |
<p>I have a plain text file looking like this:</p>
<pre><code>"some
text
containing
line
breaks"
</code></pre>
<p>I'm trying to talk <code>excel 2004 (Mac, v.11.5)</code> into opening this file correctly. I'd expect to see only one cell (A1) containing all of the above (without the quotes)...</p>
<p>But ... | <p>Looks like I just found the solution myself. I need to save the initial file as ".csv". Excel honors the line breaks properly with CSV files. Opening those via applescript works as well.</p>
<p>Thanks again to those who responded.</p>
<p>Max</p>
| <p>Is it just one file? If so, don\'t import it. Just copy paste the content of your text file into the first cell (hit f2, then paste).</p>
<p>If you absolutely must script this, Excel actually uses only one of those two chars (cr, lf) as the row delimiter, but I'm not sure which. Try first stripping out the lf's wit... | 44,228 |
<p>If I were to use more than one, what order should I use modifier keywords such as:</p>
<p><code>public</code>, <code>private</code>, <code>protected</code>, <code>virtual</code>, <code>abstract</code>, <code>override</code>, <code>new</code>, <code>static</code>, <code>internal</code>, <code>sealed</code>, and any ... | <p>I had a look at Microsoft's <a href="https://msdn.microsoft.com/en-us/library/ms229042%28v=vs.100%29" rel="noreferrer">Framework Design Guidelines</a> and couldn't find any references to what order modifiers should be put on members. Likewise, a look at the <a href="https://www.microsoft.com/en-gb/download/details.a... | <p>In my experience, there's no functional difference in how they are ordered, but just like with grammar, it sounds weird if it is out of order.</p>
<p>I've heard before there is a preferred order but couldn't find a C# guide that indicated it either, but there is this Language Rules code style to refer to: <a href="h... | 23,316 |
<p>I've inherited a legacy application that is supposed to grab an on the fly pdf from a reporting services server. Everything works fine up until the point where you try to open the pdf being returned and adobe acrobat tells you:</p>
<blockquote>
<p>Adobe Reader could not open
'thisStoopidReport'.pdf' because it ... | <p>View the pdf file that you get back in notepad.exe. I suspect that you will see HTML in there. If you call a web page that is a pass through page, that severs up a pdf file. The web request will get back the HTML not the PDF file. </p>
<p>If you call a web site that has a pdf file directly, like <a href="http://www... | <p>Could your problem be caused by declaring your byte array to a length of 2048 rather than basing the length on the length of the stream returned by GetResponseStream()?</p>
| 46,533 |
<p>I have written an HTML Application (hta file) and am wondering if there is a way to embed an icon file into the hta file itself.</p>
<p>I have seen html emails that include embedded graphic files, is there any way to do this with html applications and icons?</p>
<p>HTA files have an HTA:APPLICATION tag that allows... | <p>I've found an hack to set the icon.</p>
<p>Prepare an icon file <em>icon.ico</em> and an hta file <em>source.hta</em> with the following contents:</p>
<pre><code><HTML>
<HEAD>
<SCRIPT>
path = document.URL;
document.write(
'<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="myApp... | <p>Another solution, but not completely compliant with the exact phrasing of the question, is to create a simple shortcut. For 64-bit systems you should enter:</p>
<p>target: C:\Windows\SysWOW64\mshta.exe C:\path+filename.hta</p>
<p>start in: C:\Windows\SysWOW64</p>
<p>You can manually change the icon of the shortcu... | 21,202 |
<p>When I right-click a solution in VS2008 and select Check In... I am presented with a list of changed files with check boxes and a comment area. (This is done against TFS.)</p>
<p>Our check-in process requires that we enter this list of changed files into the bug tracking ticket. This requires typing in the name of ... | <p>I use SnagIt for such things, it is really an amazing application. They have non-free versions and a free version (instructions <a href="http://www.labnol.org/software/download/free-download-snagit-with-serial-number/1841/" rel="nofollow noreferrer">here</a>). I don't know how I lived without it, honestly.</p>
<p... | <p>Why dont you take a screenshot (alt+Prnt Scrn) of the checkin dialog and upload the image to the bug tracking system?</p>
| 33,843 |
<p>I see often (rewritten) URLs without ID in it, like on some wordpress installations. What is the best way of achieve this?</p>
<p>Example: site.com/product/some-product-name/</p>
<p>Maybe to keep an array of page names and IDs in cache, to avoid DB query on every page request?
How to avoid conflicts, and what are ot... | <p>Using an ID presents the same conundrum, really--you're just checking for a different value in your database. The "some-product-name" part of your URL above is also something unique. Some people call them slugs (Wordpress, also permalinks). So instead of querying the database for a row that has the particular ID, yo... | <p>As long as product names are unique it shouldn't be an issue. It won't take any longer (at least not significant) to look up a product by unique name than numeric ID as long as the column is indexed.</p>
| 3,420 |
<p>When using the Net.Sockets.TcpListener, what is the best way to handle incoming connections (.AcceptSocket) in seperate threads?</p>
<p>The idea is to start a new thread when a new incoming connection is accepted, while the tcplistener then stays available for further incoming connections (and for every new incomin... | <p>The code that I've been using looks like this:</p>
<pre><code>class Server
{
private AutoResetEvent connectionWaitHandle = new AutoResetEvent(false);
public void Start()
{
TcpListener listener = new TcpListener(IPAddress.Any, 5555);
listener.Start();
while(true)
{
IAsyncResult result =... | <p>I would use a threadpool, this way you won't have to start a new thread every time (since this is kinda expensive). I would also not wait indefinetely for furhter connections, since clients may not close their connections. How do you plan to route the client to the same thread each time?</p>
<p>Sorry, don't have sa... | 8,789 |
<p>I have a stack panel inside of an expander panel that I programaticaly adds check boxes to. Currently the exanpander stops at the bottom of the form, but the stack panel keeps growing. I would like the stack panel to be bounded by the expander and scroll to display the check boxes. Do I need house the check boxes... | <p>You can nest the StackPanel in a ScrollViewer:</p>
<pre><code> <Grid>
<Expander Header="Expander1" Margin="0,0,0,2" Name="Expander1" VerticalAlignment="Top" Background="Coral">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Name="StackScroll" Margin="0,0,0,2... | <p>Set <strong>ScrollViewer.VerticalScrollBarVisibility="Auto"</strong> in your StackPanel declaration.</p>
| 46,468 |
<p>I have some numeric code that I need to convert to C or C++. I tried using f2c, but it won't work on the Fortran code. f2c complains because the code uses C style preprocessor directives (#include).
The code's readme states that it is Fortran77, that works with the fort77 linker, that would expand those includes.</... | <p>This <del>might be</del> is going out a bit on a limb, but have you considered that since perhaps you're using C-style includes, you could actually run the C preprocessor on the file in order to include those files? Then, you could take <em>that</em> output and run it through f2c.</p>
<p>(I am not an expert on the... | <p>Have you no C pre-processor? On Unix, there might be a separate program, cpp, that would take the Fortran with <code>#include</code> directives and convert that into Fortran without <code>#include</code> directives. Alternatively, you could rename the source from <code>xyz.f77</code> (<code>xyz.f</code>) to <code>... | 41,785 |
<p>I have seen this link: <a href="http://www.developer.com/lang/jscript/article.php/3592016" rel="noreferrer">Implementing Mutual Exclusion in JavaScript</a>.
On the other hand, I have read that there are no threads in javascript, but what exactly does that mean? </p>
<p>When events occur, where in the code can they ... | <p>Javascript is defined as a <i>reentrant</i> language which means there is no threading exposed to the user, there may be threads in the implementation. Functions like <code>setTimeout()</code> and asynchronous callbacks need to wait for the script engine to sleep before they're able to run.</p>
<p>That means that e... | <p>Events are signaled, but JavaScript execution is still single-threaded.</p>
<p>My understanding is that when event is signaled the engine stops what it is executing at the moment to run event handler. After the handler is finished, script execution is resumed. If event handler changed some shared variables then res... | 15,171 |
<p>I've done calibration test with "Concentric circle test" (<a href="https://www.thingiverse.com/thing:11895" rel="nofollow noreferrer">https://www.thingiverse.com/thing:11895</a>) and at specific points there are little bumped points on the print. Also Thingiverse page of the test mentions about these.</p>
<p>How ca... | <p>The 5V is derived from the 12V supply by a linear regulator (L7805CD, DPAK package with 100 C/W thermal resistance). The maximum you can draw from it (without overheating the regulator) is around 200mA. Considering the electronics on the board are already using some power, the maximum would be around a 150mA fan but... | <p>5 V and 3.3 V are both <a href="https://learn.sparkfun.com/tutorials/logic-levels/33-v-cmos-logic-levels" rel="nofollow noreferrer">logic "highs"</a> in computing and measured against GND. If the fan simply has to know the on stance and nothing more, then you could run a fan with the logic 5 V (and probably 3.3 V fo... | 1,380 |
<p>I'm trying to remotely control a Macintosh computer. I know that in the Windows world, you can use Remote Desktop to connect from one Windows computer to another Windows computer. This works relatively well.</p>
<p>I know that you can use a VNC server but this isn't always the most secure or give the best performa... | <p>If you're trying to connect from one (Leopard) Mac to another, you can use the built-in Screen Sharing functionality; turn the server on from the Sharing System Preferences pane, and either use the network browser (on a LAN) or just open a vnc:// URL.</p>
<p>If you're trying to manage a bunch of Macs, try Apple's <... | <p>Yeah, VNC is good, but what about Apple's Remote Desktop?</p>
| 11,564 |
<p>What is the best solution of defaultButton and "Enter key pressed" for ASP.NET 2.0-3.5 forms?</p>
| <p>Just add the "defaultbutton" attribute to the form and set it to the ID of the button you want to be the default. </p>
<pre><form defaultbutton="button1" runat="server">
<asp:textbox id="textbox1" runat="server"/>
<asp:button id="button1" text="Button1" runat="server"/>
</form> </pre... | <p>Just add the "defaultbutton" attribute to the form and set it to the ID of the button you want to be the default. </p>
<pre><form defaultbutton="button1" runat="server">
<asp:textbox id="textbox1" runat="server"/>
<asp:button id="button1" text="Button1" runat="server"/>
</form> </pre... | 9,425 |
<p>When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant be found with my library.lib. Apparently, as a result, the edit and continue feature of the IDE fails to work any project that incorporates library.lib</p>
<p>What magic is needed to tell VS2005 to produce a static lib with... | <p>vc80.pdb is the file that contains the debug information for your lib. In the ide Property pages:configuration properties:c\c++:output files allows you to rename this to something more appropriate, such as the name of your lib. When the linker links your lib into the target exe it looks for this pdb (there is a po... | <p>If you can live without 'edit and continue', try using <a href="http://msdn.microsoft.com/en-us/library/958x11bc(VS.80).aspx" rel="nofollow noreferrer">/Z7</a>.<br>
I use it for all the .lib files that are stored in source control. No .pdb file is created - the debug info is stored inside the .lib file.</p>
| 31,630 |
<p>Long story short, I need to put some text in my Flex application and I don't want users to be able to copy. I was going to use a label, but apparently labels do not support text wrapping. Can I make it so that users cannot select text in a Flex Text control?</p>
<p>Thanks.</p>
| <p>You could use the Text control and set the selectable property to false...</p>
<pre><code> <mx:Text width="175" selectable="false" text="This is an example of a multiline text string in a Text control." />
</code></pre>
| <p>You can set the enabled property to "false" which disables user interaction. You may want to also change the disabledcolor property to your choice.</p>
<pre><code>print("
<mx:Text enabled="false" disabledColor="0x000000" text=Text"/>
");
</code></pre>
| 18,679 |
<p>What techniques or tools are recommended for finding broken links on a website?</p>
<p>I have access to the logfiles, so could conceivably parse these looking for 404 errors, but would like something automated which will follow (or attempt to follow) all links on a site.</p>
| <p>For Chrome Extension there is <a href="https://chrome.google.com/webstore/detail/hexometer-tool/hikinokpbcadaepfkacpnkhbdjfpfcgc" rel="nofollow noreferrer">hexometer</a></p>
<p>See <a href="http://www.kevinfreitas.net/extensions/linkchecker/" rel="nofollow noreferrer">LinkChecker</a> for Firefox.</p>
<p>For Mac OS... | <p>Your best bet is to knock together your own spider in your scripting language of choice, it could be done recursively along the lines of:</p>
<pre><code>// Pseudo-code to recursively check for broken links
// logging all errors centrally
function check_links($page)
{
$html = fetch_page($page);
if(!$html)
... | 9,126 |
<p>We're living in a golden age of databases, with numerous high quality commercial and free databases. This is great, but the downside is there's not a simple obvious choice for someone who needs a database for his next project.</p>
<ul>
<li>What are the constraints/criteria you use for selecting a database?</li>
<l... | <p>I would think first on what the system requirements are for data access, data security, scalability, performance, disconnected scenarios, data transformation, data sizing. </p>
<p>On the other side, consider also the experience and background of developers, operators, platform administrators.</p>
<p>You should als... | <ul>
<li>Linux, Web Hosted - MySQL (PostreSQL maybe)</li>
<li>Mainstream SME - MS SQL</li>
<li>Big Iron (banking etc) - Oracle</li>
</ul>
<p>Thinking about anything other than those three is masturbation - any of the other databases becomes a discussion about niche products to solve particular problems that you probab... | 4,949 |
<p>What is the difference between a function decorated with <a href="http://docs.python.org/library/functions.html#staticmethod" rel="noreferrer"><code>@staticmethod</code></a> and one decorated with <a href="http://docs.python.org/library/functions.html#classmethod" rel="noreferrer"><code>@classmethod</code></a>?</p>
| <p>Maybe a bit of example code will help: Notice the difference in the call signatures of <code>foo</code>, <code>class_foo</code> and <code>static_foo</code>:</p>
<pre><code>class A(object):
def foo(self, x):
print(f"executing foo({self}, {x})")
@classmethod
def class_foo(cls, x):
... | <p>A quick hack-up ofotherwise identical methods in iPython reveals that <code>@staticmethod</code> yields marginal performance gains (in the nanoseconds), but otherwise it seems to serve no function. Also, any performance gains will probably be wiped out by the additional work of processing the method through <code>st... | 16,474 |
<p>Every PHP programmer likely uses at least some form of a template engine and a database abstraction layer, but apart from those what extras do you consider essential or would recommend your fellow programmers try out?</p>
| <ol>
<li><p>A good framework.<br>
PHP has many to choose from: <a href="http://framework.zend.com/" rel="noreferrer">Zend's</a>, <a href="http://solarphp.com/" rel="noreferrer">Solar</a>, <a href="http://cakephp.org/" rel="noreferrer">CakePHP</a>, <a href="http://www.symfony-project.org/" rel="noreferrer">Symfony</a>, ... | <p>IDE : PDT for Eclipse</p>
<p>Source Control : SVN with Tortoise SVN</p>
<p>Other details, like framework, depend of the project.</p>
| 42,516 |
<p>I just noticed that there is a large amount of tag wiki excerpts edits in the review queue, all of which are of the form:</p>
<blockquote>
<p>X is for questions about X</p>
</blockquote>
<p>A tag wiki excerpt should define what a term means <em>to our community</em> specifically and give <em>usage advice</em>. I... | <p>Tag excerpts should at least try and give a concise definition as to the subject, and provided any usage guidance <em>if necessary.</em></p>
<p>Therefore, you need to make sure to address a set of key points:</p>
<ul>
<li>Is the tag name ambiguous? Will an amateur be able to understand the subject without having t... | <p>For reference, I would like to propose a copy-paste solution for tags.</p>
<p><strong>Usage Guidance</strong></p>
<p><code>For questions regarding {insert list of applicable topics} of {Tag Name}.</code></p>
<p><strong>Details</strong></p>
<pre><code>{Tag name, unabbreviated}: {Definition}
Examples:
- What is ... | 22 |
<p>We have an application on Linux that used the <a href="http://linux.die.net/man/3/syslog" rel="noreferrer">syslog</a> mechanism. After a week spent trying to figure out why this application was running slower than expected, we discovered that if we eliminated syslog, and just wrote directly to a log file, performan... | <p>You can configure syslogd (and rsyslog at least) not to sync the log files after a log message by prepending a "-" to the log file path in the configuration file. This speeds up performance at the expense of the danger that log messages could be lost in a crash.</p>
| <p>The syslog-async() implementation may help, at the risk of lost log lines / bounded delays at other times.
<a href="http://thekelleys.org.uk/syslog-async/" rel="nofollow">http://thekelleys.org.uk/syslog-async/</a></p>
<p>Note: 'asynchronous' here refers to queueing log events within your application, and not the as... | 25,524 |
<p>Using CFML (ColdFusion Markup Langauge, aka ColdFusion), how can you compare if two single dimension arrays are the same?</p>
| <p>There's a very simple way of comparing two arrays using CFML's underlying java. According to a recent blog by Rupesh Kumar of Adobe (<a href="http://coldfused.blogspot.com/" rel="nofollow noreferrer">http://coldfused.blogspot.com/</a>), ColdFusion arrays are an implementation of java lists (java.util.List). So all t... | <p>All of these solutions check that two arrays are equal. They don't check that they are the same object. The only way I know to do that in native CF is to change the object in some way and see if both references have the change in. </p>
<p>I also think that you should be wary of relying on CF implementing certain ja... | 5,016 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/26094/most-efficient-implementation-of-a-large-number-class">Most efficient implementation of a large number class</a> </p>
</blockquote>
<p>Suppose I needed to calculate 2^150000. Obviously that number is goin... | <p>See</p>
<p><a href="https://stackoverflow.com/questions/26094/most-efficient-implementation-of-a-large-number-class">Most efficient implementation of a large number class</a></p>
<p>for some leads.</p>
| <p>I don't know C# but I do know the Ruby programming language has the BigDemical class that seems to allow numbers of unlimited size. </p>
| 34,503 |
<p>How can I get an image to stretch the height of a <code>DIV</code> class?</p>
<p>Currently it looks like this:</p>
<p><img src="https://i.stack.imgur.com/DcrXC.png" width="650" /></p>
<p>However, I would like the <code>DIV</code> to be stretched so the <code>image</code> fits properly, but I do not want to resize... | <p>Add <code>overflow:auto;</code> to <code>.product1</code></p>
| <pre><code>display:inline
float:left
</code></pre>
<p>is your problem</p>
<p>Floating makes the parents width not be stretched by the child, try placing the image without the float. If you take the float off, it should give you the desired effect.<br>
Another approach would be to make sure you are clearing your f... | 6,248 |
<p>I know that you can apply CSS in order to style objects in Flex using the StyleManager:<br>
<a href="http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html</a> </p>
<p>You can also load <strong>compile... | <p>In <a href="http://bugs.adobe.com/jira/browse/SDK-11868#action_186925" rel="nofollow noreferrer">this comment</a> to an issue related to this in the Adobe bug tracker <em>T. Busser</em> is describing what might be a viable solution for you:</p>
<blockquote>
<p><em>"I've created a small class that will 'parse' a C... | <p>The application of CSS in Flex is handled on the server side at compilation and not on the client side at run time.</p>
<p>I would see two options then for you (I'm not sure how practical either are):</p>
<ol>
<li>Use a server side script to compile your CSS as a SWF then load them dynamically.</li>
<li>Parse a CS... | 25,100 |
<p>For IronPython there is a project - <a href="http://www.resolversystems.com/documentation/index.php/Ironclad" rel="nofollow noreferrer">IronClad</a>, that aims to transparently run C extensions in it. Is there a similiar project for Jython?</p>
| <p>To answer the first question: It's never too late. Especially when it comes to niche market segments and stuff like that. </p>
<p>Second though, before you start down the path of creating a new OS, you should understand the kind of undertaking it is: it'd be a massive project.</p>
<p>Is it just a normal programmer... | <p>You could also consider going with MINIX which is a good starting point.</p>
| 12,675 |
<p>I have an application with a REST style interface that takes XML documents via POST from clients. This application is written in Java and uses XML beans to process the posted message. </p>
<p>The XML schema definition for a field in the message looks like this:</p>
<pre><code><xs:element name="value" type="xs:s... | <p>What about <code><value xsi:nil="true"></value></code>? That's what's <a href="http://www.w3.org/TR/xmlschema-0/#Nils" rel="noreferrer">in the spec</a>.</p>
| <p>In the past when I've had XML elements that were null I could either not include them or send them empty so, in your case it'd be:
<code><value /></code></p>
<p>Have you tried that?</p>
| 13,120 |
<p>What is the optimum number of projects in a Visual Studio 2008 solution?</p>
<p>We have one Visual Studio 2008 solution that is around 50 projects right now. It will likely continue to grow as the bulk of the projects within the solution consist of plugin assemblies for the main application.</p>
<p>If it seems li... | <p>This is akin to discussions such as "how many functions should I have in a class?" and "should each enum be defined in its own .cs file?".</p>
<p>I would be interested to know how many classes each of your projects has. You can think of your classes, projects and solutions as organisational units. They are there to... | <p>Obviously when you get to 500 then you're starting to look at "too many" it becomes impractical even to manage it.</p>
<p>I might suggest that you analyse "what really constitutes my application" and package that as a single solution. Plugins are rarely considered part of the base application but add-ons to the ba... | 43,878 |
<p>I'm considering using Django for a project I'm starting (fyi, a browser-based game) and one of the features I'm liking the most is using <code>syncdb</code> to automatically create the database tables based on the Django models I define (a feature that I can't seem to find in any other framework).
I was already thin... | <p>Manually doing the SQL changes and dump/reload are both options, but you may also want to check out some of the schema-evolution packages for Django. The most mature options are <a href="http://code.google.com/p/django-evolution/" rel="noreferrer">django-evolution</a> and <a href="http://south.aeracode.org/" rel="n... | <p>I've been using django-evolution. Caveats include: </p>
<ul>
<li>Its automatic suggestions have been uniformly rotten; and</li>
<li>Its fingerprint function returns different values for the same database on different platforms. </li>
</ul>
<p>That said, I find the custom <code>schema_evolution.py</code> approach h... | 5,661 |
<p>I have inherited a large legacy ColdFusion app. There are hundreds of <cfquery>some sql here #variable#</cfquery> statements that need to be parameterized along the lines of: <cfquery> some sql here <cfqueryparam value="#variable#"/> </cfquery></p>
<p>How can I go about adding paramet... | <p>There's a queryparam scanner that will find them for you on RIAForge: <a href="http://qpscanner.riaforge.org/" rel="nofollow noreferrer">http://qpscanner.riaforge.org/</a></p>
| <p>I doubt that there is a solution that will fit your needs exactly. The only option I see is to write your own recursive search that builds a report for you or use one of the apps/scripts that people have listed above. Basically, you are going to have to edit each page or approve all of the automated changes.</p>
| 8,997 |
<p>Given either the binary or string representation of an IPv6 address and its prefix length, what's the best way to extract the prefix in Python?</p>
<p>Is there a library that would do this for me, or would I have to:</p>
<ol>
<li>convert the address from string to an int (inet_ntop)</li>
<li>Mask out the prefix</l... | <p>See <a href="http://code.google.com/p/ipaddr-py/" rel="nofollow noreferrer">http://code.google.com/p/ipaddr-py/</a></p>
<p>With this, you can do</p>
<pre><code>py> p=ipaddr.IPv6("2001:888:2000:d::a2")
py> p.SetPrefix(64)
py> p
IPv6('2001:888:2000:d::a2/64')
py> p.network_ext
'2001:888:2000:d::'
</code>... | <p>Using the python <a href="https://github.com/drkjam/netaddr" rel="nofollow">netaddr</a> library:</p>
<pre><code>>>> from netaddr.ip import IPNetwork, IPAddress
>>> IPNetwork('2001:888:2000:d::a2/64').network
2001:888:2000:d::
</code></pre>
| 47,083 |
<p>I am trying to set up dynamic per-item menus (Edit Control Block) in SharePoint 2007. My goal is to have certain features that are available based on the current user's group membership.</p>
<p>I know that the CustomAction tag that controls the creation of this menu item has a Rights attribute. The problem that I... | <p>A short list might be:</p>
<ul>
<li>Avoid memory leaks through use shared pointers to manage memory allocation and cleanup</li>
<li>Use the <a href="https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" rel="noreferrer">Resource Acquisition Is Initialization</a> (RAII) idiom to manage resource clean... | <pre><code>#include <boost/shared_ptr.hpp>
class A {
public:
void nuke() {
boost::shared_ptr<A> (this);
}
};
int main(int argc, char** argv) {
A a;
a.nuke();
return(0);
}
</code></pre>
| 5,031 |
<p>i am writing a game in C++ and have a level consisting of many seperate meshes, each with their own vertex buffer. i am using vmmlib ( brilliant free gl compat. vector/matrix library ) to create my frustum culler and testing it against the bounding sphere of every mesh in the level. sadly my level can consist of up ... | <p>Yes bounding object is the way to go, you should take care in choosing an adequate bounding volume, for example for meshes that move about the scene like bots and dont lie down a cylinder is the best volume, other are better represented by cubes (axis aligned or not).</p>
<p>Then you create a quadtree or octree to ... | <p><a href="http://en.wikipedia.org/wiki/Binary_space_partitioning" rel="nofollow noreferrer">Binary space partitioning</a> or its cousin <a href="http://en.wikipedia.org/wiki/Quadtree" rel="nofollow noreferrer">Quadtree</a>.</p>
| 21,668 |
<p>I am moving from classic ASP to ASP.NET and have encountered what many of you already know as "viewstate". I might be jumping the gun with my assumption, but it looks highly cumbersome. I have developed many ASP forms in the past and never had issues with keeping state. Is there another way OR am I going to have ... | <p>You don't have to. Check out <a href="http://www.asp.net/mvc/" rel="nofollow noreferrer">MVC framework</a>. It eliminates ViewState and works as old ASP (at least from this point of view).</p>
| <pre><code>'<%@ Control Language="C#" AutoEventWireup="true" CodeFile="HomePage.ascx.cs" Inherits="HomePage" %>
<script runat="server">
void testHF_ValueChanged(object sender, EventArgs e)
{
this.HFvalue.Text = this.testHF.Value ;
}
</script>
<asp:Label ID="UserNamelbl" runat="ser... | 16,133 |
<p>I'm wondering if it's possible to sandbox JavaScript running in the browser to prevent access to features that are normally available to JavaScript code running in an HTML page.</p>
<p>For example, let's say I want to provide a JavaScript API for end users to let them define event handlers to be run when "inter... | <p><a href="https://github.com/google/caja" rel="noreferrer">Google Caja</a> is a source-to-source translator that "allows you to put untrusted third-party HTML and JavaScript inline in your page and still be secure."</p>
| <p>You can wrap the user's code in a function that redefines forbidden objects as parameters -- these would then be <code>undefined</code> when called:</p>
<pre><code>(function (alert) {
alert ("uh oh!"); // User code
}) ();
</code></pre>
<p>Of course, clever attackers can get around this by inspecting the ... | 23,705 |
<p>How to parse the DOM and determine what row is selected in an ASP.NET <code>ListView</code>? I'm able to interact with the DOM via the <code>HtmlElement</code> in Silverlight, but I have not been able to locate a property indicating the row is selected.</p>
<p>For reference, this managed method works fine for an ASP... | <p>If your listview has a specific css class for selected row, you can try to filter on it</p>
| <p>I don't have my dev environment up to test this, but could you call GetProperty('selectedIndex') on the ListBoxID element? Then from that you figure out which child is selected and return that child using the elm.Children. </p>
<p><strong>Edit:</strong> Got my dev environment up this morning and did some testing. H... | 22,464 |
<p>Can anyone recommend an efficient method to execute XSLT transforms of XML data within a Ruby application? The XSL gem (REXSL) is not available yet, and while I have seen a project or two that implement it, I'm wary of using them so early on. A friend had recommended a shell out call to Perl, but I'm worried about r... | <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,097 |
<p>Using <a href="http://pyobjc.sourceforge.net/" rel="noreferrer">PyObjC</a>, you can use Python to write Cocoa applications for OS X. Can I write native iPhone apps using Python and if so, how?</p>
| <p>Not currently, currently the only languages available to access the iPhone SDK are C/C++, Objective C and Swift.</p>
<p>There is no technical reason why this could not change in the future but I wouldn't hold your breath for this happening in the short term.</p>
<p>That said, Objective-C and Swift really are not t... | <p>The only significant "external" language for iPhone development that I'm aware of with semi-significant support in terms of frameworks and compatibility is <a href="http://monotouch.net/" rel="nofollow noreferrer">MonoTouch</a>, a C#/.NET environment for developing on the iPhone.</p>
| 6,491 |
<p>I want to open a ZIP-file, that have no entries with java.util.zip.ZipFile. But on the constructor I get the following exception: 'java.util.zip.ZipException: error in opening zip file'. How can I open the empty ZIP?</p>
<p>That ZIP-file is created by the commandline zip-program under linux. I simply deleted all en... | <p>hack: you can assume that all empty ZIPs are the same and just hardcode it's length/chechsum to validate against.</p>
| <p>Use a <code>ZipOutputStream</code>. </p>
| 47,389 |
<p>How do you determine what to put in .rhosts file in an VAX openvms system when trying to remotely access the server using a remote shell from Cygwin on windows XP ? .rlogin and rsh are the only methods that can be used to access the VAX server and it must be using Cygwin to remote in to the VAX server. SSH is not an... | <p>From Python 2.7 onwards you can specify the time to be used in the gzip header. N.B. filename is also included in the header and can also be specified manually.</p>
<pre><code>import gzip
content = b"Some content"
f = open("/tmp/f.gz", "wb")
gz = gzip.GzipFile(fileobj=f,mode="wb",filename="",mtime=0)
gz.write(cont... | <p>In lib/gzip.py, we find the method that builds the header, including the part that does indeed contain a timestamp. In Python 2.5, this begins on line 143:</p>
<pre><code>def _write_gzip_header(self):
self.fileobj.write('\037\213') # magic header
self.fileobj.write('\010') # comp... | 33,089 |
<p>Is there a way to determine how many cores a machine has from C/C++ in a platform-independent way? If no such thing exists, what about determining it per-platform (Windows/*nix/Mac)?</p>
| <h1>C++11</h1>
<pre><code>#include <thread>
//may return 0 when not able to detect
const auto processor_count = std::thread::hardware_concurrency();
</code></pre>
<p>Reference: <a href="http://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency" rel="noreferrer">std::thread::hardware_concurrency</a></... | <p>you can use WMI in .net too but you're then dependent on the wmi service running
etc. Sometimes it works locally, but then fail when the same code is run on servers.
I believe that's a namespace issue, related to the "names" whose values you're reading.</p>
| 18,118 |
<p>I need to configure a website to access a webservice on another machine, via a proxy. I can configure the website to use a proxy, but I can't find a way of specifying the credentials that the proxy requires, is that possible? Here is my current configuration:</p>
<pre><code><defaultProxy useDefaultCredentials=... | <p>Yes, it is possible to specify your own credentials without modifying the current code. It requires a small piece of code from your part though.</p>
<p>Create an assembly called <em>SomeAssembly.dll</em> with this class :</p>
<pre><code>namespace SomeNameSpace
{
public class MyProxy : IWebProxy
{
p... | <p>Though its very late but it might be helpful for someone looking for solution to the same problem. I came across this question after having same problem. I am giving my solution to the problem, how I made it work.
I created the proxy using using credentials like this,</p>
<pre><code>public class MyProxy : IWebProxy
... | 22,609 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.