instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac.</p>
<p>P... | <p>did you find a good solution for that problem?</p>
<p>I have the same problem and the only solution I found is the following:
The environment variable JAVA_TOOL_OPTIONS can be used to provide parameters for the JVM.</p>
<p><a href="http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#tooloptions" rel="noref... | <p>Have a look at <a href="http://javahowto.blogspot.com/2006/06/fix-javac-java-lang-outofmemoryerror.html" rel="nofollow noreferrer">http://javahowto.blogspot.com/2006/06/fix-javac-java-lang-outofmemoryerror.html</a></p>
<p>The arguments that you need to pass to JBuilder's javac is "-J-Xms256m -J-Xmx256m". Replace th... | 12,969 |
<p>Hosting a WCF Service Host in a Windows Service really seems to be quite a simple way to go to communicate with a running Windows Service...if you're running 3.0/3.5.</p>
<p>What the easiest way to get the same sorts of things out of the 2.0 Framework if that's what you're stuck with?</p>
| <p>You could host a <a href="http://msdn.microsoft.com/en-us/library/kwdt6w2k(VS.80).aspx" rel="nofollow noreferrer">Remoting</a> service.</p>
| <p><a href="http://support.microsoft.com/default.aspx/kb/308359" rel="nofollow noreferrer">ASMX</a> Web Service Hosted in IIS</p>
| 39,608 |
<p>I am creating a website that has 5 different sub-sites each with the same overall look, but each has a different logo and added navigation.</p>
<p>What do you feel is a better approach:</p>
<ul>
<li>Use the new nested master page capabilities to create 5 sub-master pages.</li>
<li>Use a single master page and dyna... | <p>Nested Master is much better than loading a user control dynamically. Dynamically loading a control is slow.</p>
| <p>A MasterPage is a control, which could also be loaded dynamically. However, to answer your question, it sounds like different masterpages are the way to go. It will give you much more flexibility, especially if say, one client wants their logo running down the side or something that a user control would not be abl... | 32,891 |
<p>I have a variety of time-series data stored on a more-or-less georeferenced grid, e.g. one value per 0.2 degrees of latitude and longitude. Currently the data are stored in text files, so at day-of-year 251 you might see:</p>
<pre><code>251
12.76 12.55 12.55 12.34 [etc., 200 more values...]
13.02 12.95 12.70 12.4... | <p>I've assembled your comments here:</p>
<ol>
<li>I'd like to do all this "w/o writing my own file I/O code"</li>
<li>I need access from "Java Ruby MATLAB" and "FORTRAN routines"</li>
</ol>
<p>When you add these up, you definitely don't want a new file format. <strong>Stick with the one you've got.</strong></p>
<p... | <p>I'd definitely change from text to binary but keep each day in a separate file still. You could name them in such a way that insertions in between don't cause any strangeness with indices, such as by including the date and possible time in the filename. You could also consider the file structure if you have several ... | 11,243 |
<p>I've a form and I'm doing databinding of my datagridview in the event "form load", the problem is, that the form takes a little (or a lot depends on the size of information) to load, because my data has a lot of binary information (photos) to binding there.</p>
<p>In some sites, we can see a picture saying "loading... | <p>You can't do much about the actual binding itself, since forms have thread affinity. However, you can load the data (from the database or where-ever) on a separate thread - look at <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker... | <p>You could show the 'loading' form in a different thread.</p>
<p>Also consider hard whether you need <em>all</em> of the data loaded with the form - could any of this data be loaded after the form load?</p>
<p>Try and give your application a feeling of <em>perceived</em> speed.</p>
| 37,714 |
<p>I'd like to run some small private/home applications on a local machine, but I dislike the idea to set up a full Win2003 Server with IIS for this. </p>
<p>Is there a easy and cheap way to get an ASP.Net application running at home?</p>
| <p>Windows 2000 has ASP, Windows XP Professional also can run it. Look up how to turn on IIS, the built in webserver. Sure Win2k3 Server would be a nicer implementation, but for personal stuff, any of them work.</p>
| <p>Depending on what kind of app and what version of .Net you could run Cassini. It's the free, open source web server that supports .Net. I'm not sure if it's been updated to handle 3.5, but I used to use at home to run some pretty serioud 2.0 apps that I had written.</p>
<p>Here's the Ultidev version which has been ... | 42,707 |
<p>Prints are generally successful, but I always get a herringbone pattern on the top and bottom surfaces and striations on the sides. The herringbone is finer with finer print qualities, but it is always there. Ditto the sides. See photos.</p>
<p>Always there, regardless of temperature (using a heat tower), speed (eve... | <p>The top image looks as if the (top) layer(s) are <strong>under-extruding</strong>, the walls don't appear to be suffering from the same problem.</p>
<p>The following image from a recent PETG print is typical for an FDM product. The deposited lines need to touch (actually, slightly overlapping, but the slicer will ta... | <p>With a replaced Bowden tube and better PLA, the herringbone is a little better, and the layering on the sides is more regular, but still there. So, based on this and photos from others here (especially @Oscar), I think the answer to my question is YES: These ARE normal surfaces from this printer.</p>
| 2,022 |
<p>A Bowden tube extruder (like the stock one on an Ender 3) is known to have issues with printing the most flexible TPU, and with filaments that (either due to composition or condition) don't take well to too much retraction -- though the latter can be ameliorated somewhat with slicer settings. Direct drive extruders... | <p>There are really no reasons not to convert to direct drive, <em>provided you use a good one</em>. Many of the direct drive kits, especially the ones that reuse the existing giant NEMA-17 stepper, are not very good and have tradeoffs due to excessive mass on the toolhead, imbalanced mass, interference with frame redu... | <p>Other than higher carriage mass as you already noted, the only other reason to not go with Direct Drive over Bowden is the higher level of maintenance required. In most cases Direct Drive will provide advantages such as increasing the maximum flow speed, enabling the use of Linear/Pressure Advance, shortening Retrac... | 1,977 |
<p>They are specially annoying when I need to upload to the server a web solution.</p>
<p>Is there a way of configuring SVN to create the _svn folders outside my working directory?
If not, what is the best way to deal with them when you need to copy only the code?</p>
<p><strong>Update:</strong> Using "svn export" co... | <p>It's not (currently) possible to configure SVN (or TortoiseSVN) to create the .svn (or _svn) directories outside the working copy. I believe that the SVN 1.6 roadmap includes revisiting the working-copy library. The ability to put the administrative directories somewhere else might come out of this work, but I'm spe... | <p>We use CruiseControl with robocopy in order to create a clean copy of your repository.</p>
<pre><code> <exec>
<executable>C:\Archivos de programa\Windows Resource Kits\Tools\robocopy.exe</executable>
<buildArgs>E:\CruiseControl\yourproject\Code\trunk\ E:\wwwroot\yourproject *... | 27,407 |
<p>Anyone know of a free xls to text converter that can be run from the unix command line?</p>
| <p>There is also the package <a href="http://packages.ubuntu.com/intrepid/catdoc" rel="nofollow noreferrer">catdoc</a> (Ubuntu link) that includes a xls2csv utility.</p>
| <p>A quick search of <code>apt-cache</code> turned up the <a href="http://packages.ubuntu.com/intrepid/python-excelerator" rel="nofollow noreferrer">Ubuntu package python-excelerator</a> for <a href="http://pypi.python.org/pypi/pyExcelerator/0.6.0a" rel="nofollow noreferrer">excelerator</a>, which includes <code>py_xls... | 41,633 |
<p>I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that?
I'm using Python and Apache, though I suppose the answer will remain the same for most languages.</p>
| <p>Set the cookie again, as if you hadn't set it the first time, but specify an expiration date that is in the past.</p>
| <p>Return the header</p>
<pre>
Set-Cookie: token=opaque; Domain=.your.domain; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
</pre>
<p>The Domain and Path must match the original attributes that the cookie was issued under.</p>
| 24,422 |
<p>When in Outlook 2003, open the Address Book, select Tools->Options. You get the address dialog showing the option "When sending mail, check names using these address lists in the following order:"</p>
<p><img src="https://i.stack.imgur.com/wa79y.jpg" alt="Address dialog"></p>
<p>For most people, this will contain... | <p>I have done this for a company in the past. It was a .NET application, that ran on every PC and reordered this listing. </p>
<p>This is where you need to start:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb820991.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb820991.aspx</a>... | <p>On the Extended MAPI level, you can use <code>IAddrBook.SetSearchPath</code> (C++ or Delphi only)</p>
<p>If using Redemption (I am its author) is an option (which supports just about every language, including all .Net languages), you can use <code>RDOSession.AddressBook.SearchPath</code> to access or manipulate the ... | 23,447 |
<p>I work in a very small shop (2 people), and since I started a few months back we have been relying on Windows Scheduled tasks. Finally, I've decided I've had enough grief with some of its inabilities such as</p>
<ol>
<li>No logs that I can find except on a domain level (inaccessible to machine admins who aren't do... | <p>I think you can look at :</p>
<p><a href="http://www.visualcron.com/" rel="noreferrer">http://www.visualcron.com/</a></p>
| <p>If you're looking for a free tool there is plenty of implementations for the popular Cron tool for Windows, for example <a href="http://cronw.sourceforge.net/" rel="nofollow noreferrer">CRONw</a>. It's pretty easy to configure and maintain. You could easily write add custom WSH scripts to send your emails and add lo... | 11,897 |
<p>I'm trying to create a ImageIcon from a animated gif stored in a jar file.</p>
<pre><code>ImageIcon imageIcon = new ImageIcon(ImageIO.read(MyClass.class.getClassLoader().getResourceAsStream("animated.gif")));
</code></pre>
<p>The image loads, but only the first frame of the animated gif. The animation does not pl... | <p>This reads gif animation from inputStream</p>
<pre><code>InputStream in = ...;
Image image = Toolkit.getDefaultToolkit().createImage(org.apache.commons.io.IOUtils.toByteArray(in));
</code></pre>
| <p>Hopefully it's not too late for this.</p>
<p>I managed to get the animated gif inside my JPanel this way:</p>
<pre><code>private JPanel loadingPanel() {
JPanel panel = new JPanel();
BoxLayout layoutMgr = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
panel.setLayout(layoutMgr);
ClassLoader cldr = this... | 17,977 |
<p>I need help with finding what properties or designs I need to look for. I know that I will need these characteristics to work with the material of my choice: </p>
<ul>
<li>Can reach 300 °C or up</li>
<li>Can handle nozzle size larger than 1 mm</li>
<li>Can be used with polycarbonate filament</li>
</ul>
... | <p>By interpreting your question as <em>"Can most hotends print polycarbonate at 300°C+?"</em>, and taking into consideration the answers to <a href="https://3dprinting.stackexchange.com/questions/4209/can-cheap-hotend-parts-sourced-from-china-actually-produce-good-prints">Can cheap hotend parts sourced from... | <p>By interpreting your question as <em>"Can most hotends print polycarbonate at 300°C+?"</em>, and taking into consideration the answers to <a href="https://3dprinting.stackexchange.com/questions/4209/can-cheap-hotend-parts-sourced-from-china-actually-produce-good-prints">Can cheap hotend parts sourced from... | 1,025 |
<p>We are working on a legacy system (7 years old), with lots of java/jsp files that have never been formatted before, <strong>not reader at all</strong>. Because we have many old versions, we are afraid that we won't be able to effectively diff unformatted and formatted files anymore if we format them.</p>
<p>Are the... | <p>It's been a while, but we used to use <a href="http://jalopy.sourceforge.net/" rel="nofollow noreferrer">Jalopy</a>. I'm fairly certain you can run it from the command line.</p>
| <p><a href="http://checkstyle.sourceforge.net/cmdline.html" rel="nofollow noreferrer">http://checkstyle.sourceforge.net/cmdline.html</a> has commanline tool.</p>
| 36,149 |
<p>A long time ago I had an apple ][ . </p>
<p>I remember the command call – 151
But I can not remember what it did ? </p>
| <p>CALL -151</p>
<p>Enter the machine code monitor -</p>
<p><a href="http://www.skepticfiles.org/cowtext/apple/memorytx.htm" rel="noreferrer">http://www.skepticfiles.org/cowtext/apple/memorytx.htm</a></p>
<p><strong>Update:</strong></p>
<p>That link appears to be dead, here's a Wayback Machine alternative:</p>
<bl... | <p>Crikey, that's a blast from the past. I think it entered the monitor ROM (I was torn between this and Integer BASIC but I'm pretty certain it was the monitor).</p>
<p>You could download an Apple II emulator and find out.</p>
| 17,314 |
<p>Does anybody have links to site or pre built report running on the SQL Analysis Service provided by TFS2008?</p>
<p>Creating a meaningful Excel report or a new report sometime is a very boring and difficult taks, maybe finding a way to share reports could be a good idea?</p>
| <p>Try this download: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=a74486b2-f7db-4a85-97bd-46bf478bda60&displaylang=en" rel="nofollow noreferrer">Creating and Customizing TFS Reports</a>, it includes a few samples and some guidance. <a href="http://msdn.microsoft.com/en-us/library/cc487893.aspx... | <p>If you are using SCRUM, this has Sprint reports and Product Burndown reports:</p>
<p><a href="http://www.scrumforteamsystem.com/en/default.aspx" rel="nofollow noreferrer">http://www.scrumforteamsystem.com/en/default.aspx</a></p>
| 9,873 |
<p>This might be a dumb question, but can a 60 watt heater be used on a 40 watt unit?</p>
<p>Simply put, I was wrong in thinking that more power was simply stuffed into the same dimensions.</p>
<p>It extends about 5 millimeters beyond my heating block. Can it be used in general or will it lead to some consequences?</p>... | <p>I'd expect the heater sticking out as pictured to cause problems -- the exposed part of the heater will tend to overheat (it's not conducting heat away into the heat block) and isn't protected by the thermistor and software PID acting as a smart thermostat.</p>
<p>It <em>might</em> be possible to install the heater ... | <p>One simple consequence is that you're going to have a hard time finding a sock that fits properly. If you cut one, or have one that has a hole where the heater protrudes, it will physically fit but then not do its job preventing radiative/convective heat loss and transfer to your printed part, or preventing stray ma... | 2,093 |
<p>Anyone knows a good way to resize any window to for example 640x480?</p>
<p>Reason is, of course, screencasting.</p>
<p>Under windows I've used ZoneSize from donationcoder. (Btw: For Firefox it's easy, just use the web developer toolbar.)</p>
| <p>Use the <a href="http://www.sweb.cz/tripie/utils/wmctrl/" rel="noreferrer">wmctrl</a> command:</p>
<p>To list the windows:</p>
<pre><code>$ wmctrl -l
0x00c00003 -1 rgamble-desktop Bottom Expanded Edge Panel
0x00c00031 -1 rgamble-desktop Top Expanded Edge Panel
0x00e00022 -1 rgamble-desktop Desktop
0x0260007c 0 rg... | <p>sh script that uses wmctrl to resize windows:</p>
<pre><code>#!/usr/bin/sh
wmctrl -l
echo ""
read -p "window id -> " wid
read -p "width -> " ww
read -p "height -> " wh
wmctrl -i -r $wid -e 0,0,0,$ww,$wh
echo "Done!"
</code></pre>
| 36,728 |
<p>Using OpenXML SDK, I want to insert basic HTML snippets into a Word document.</p>
<p>How would you do this:</p>
<ul>
<li>Manipulating XML directly ?</li>
<li>Using an XSLT ?</li>
<li>using AltChunk ?</li>
</ul>
<p>Moreover, C# or VB examples are more than welcome :)</p>
| <p>Well, hard to give general advice, because it depends strongly on your input what is best. </p>
<p>Here's a simple example inserting a paragraph into a DOCX document for each paragraph in an (X)HTML document using OpenXML SDK v2.0 and an XPathDocument:</p>
<pre><code> void ConvertHTML(string htmlFileName, strin... | <p>I'm not sure, what you actually would like to achieve. The OpenXML documents have an own html-like (WordprocessingML) notation for the formatting elements (like paragraph, bold text, etc.). If you would like to add some text to a doc, with basic formatting, than I rather suggest to use the OpenXML syntax and format ... | 22,697 |
<p>I have a table with a timestamp field of type datetime. I need to aggregate the data between a defined start and end time into x groups representing time intervals of equal length, where x is supplied as function parameter.</p>
<p>What would be the best way to do this with Hibernate?</p>
<p>EDIT: some explanations... | <p>I've tried to solve the same problem. I have to group data by 2-hours interval within one day. In fact, "pure" Hibernate isn't supposed to be used this way. So I added native SQL projection to Hibernate's criteria. For your case it could look like this (I'm using MySQL syntax & functions):</p>
<pre><code>int ho... | <p>Hibernate is for mapping between a graph of objects (entities and value-types) and their representation in a relational database.</p>
<p>From your question description, you don't really mention any entities that you are modelling, so I would suggest dropping down into a native SQL query.</p>
<p><a href="http://www... | 41,640 |
<p>A feature of C++ is the ability to create unnamed (anonymous) namespaces, like so:</p>
<pre><code>namespace {
int cannotAccessOutsideThisFile() { ... }
} // namespace
</code></pre>
<p>You would think that such a feature would be useless -- since you can't specify the name of the namespace, it's impossible to a... | <p><s>The C++ Standard reads in section 7.3.1.1 Unnamed namespaces, paragraph 2:</s>
<s></p>
<blockquote>
<p>The use of the static keyword is
deprecated when declaring objects in a
namespace scope, the unnamed-namespace
provides a superior alternative.
</s></p>
</blockquote>
<p>Static only applies to names of objects, ... | <p>Having learned of this feature only just now while reading your question, I can only speculate. This seems to provide several advantages over a file-level static variable:</p>
<ul>
<li>Anonymous namespaces can be nested within one another, providing multiple levels of protection from which symbols can not escape.</... | 18,669 |
<p>Im currently using ie as an active x com thing on wxWidgets and was wanting to know if there is any easy way to change the user agent that will always work.</p>
<p>Atm im changing the header but this only works when i manually load the link (i.e. call setUrl)</p>
| <p>The only way that will "always work," so far as I've been able to find, is <a href="http://www.walkernews.net/2007/07/05/how-to-change-user-agent-string/" rel="nofollow noreferrer">changing the user-agent string in the registry</a>. That will, of course, affect <em>every</em> web browser instance running on that mac... | <p>Head Geek already told you where in the registy IE will look by default.</p>
<p>This is just a default, though. If you implement [IDocHostUIHandler::GetOptionKeyPath](<a href="http://msdn.microsoft.com/en-us/library/aa753258(VS.85%29.aspx)" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa753258(... | 28,955 |
<p>What do you insert into Python source code to have it break into pdb (when execution gets to that spot)? </p>
| <pre><code>import pdb; pdb.set_trace()
</code></pre>
<p>See <a href="http://jjinux.blogspot.com/2007/08/python-coding-in-debugger-for-beginners.html" rel="noreferrer">Python: Coding in the Debugger for Beginners</a> for this and more helpful hints.</p>
| <p>As of Python 3.7, you can use <code>breakpoint()</code> - <a href="https://docs.python.org/3/library/functions.html#breakpoint" rel="noreferrer">https://docs.python.org/3/library/functions.html#breakpoint</a></p>
| 18,120 |
<p>This is the SQL that I want to accomplish:</p>
<pre><code>WHERE domain_nm + '\' + group_nm in ('DOMAINNAME\USERNAME1','DOMAINNAME2\USERNAME2')
</code></pre>
<p>I can't for the life of me find an appropriate Expression for this. And I don't think I can use two expressions as the domain name and the group name need... | <p>Can you not use two Expressions?</p>
<pre><code>criteria
.Add(Expression.In("DomainName", new string[] { "DOMAINNAME", "DOMAINNAME2" }))
.Add(Expression.In("GroupName", new string[] { "USERNAME1", "USERNAME2" })
</code></pre>
<p>The other option is to use Expression.Sql.</p>
| <p>I would just like to point out that two expressions will NOT work as I need a single expression.</p>
<p>DomainName and GroupName need to be concatenated before the in occurs. Think user names on a domain account. The DomainName and GroupName together are unique, not each separately.</p>
| 23,360 |
<p>I've seen the word "spike" used in relation to source-control.</p>
<p>For example, a project I'm working with has three top-level folders: trunk, branches and spikes.</p>
<p>What's the meaning of this term?</p>
| <p>"Spike" is a synonym for "Tag". It is a "spike" in the ground meaning it doesn't move versus a branch, which grows.</p>
<p>For further clarification, a 'tag' or 'spike' represents a release version of your project. Tags are snapshots of that release and as such are not actively developed on though branches can be c... | <p>"Spike" is a synonym for "Tag". It is a "spike" in the ground meaning it doesn't move versus a branch, which grows.</p>
<p>For further clarification, a 'tag' or 'spike' represents a release version of your project. Tags are snapshots of that release and as such are not actively developed on though branches can be c... | 35,765 |
<p>Here is my sample code:</p>
<pre><code>from xml.dom.minidom import *
def make_xml():
doc = Document()
node = doc.createElement('foo')
node.innerText = 'bar'
doc.appendChild(node)
return doc
if __name__ == '__main__':
make_xml().writexml(sys.stdout)
</code></pre>
<p>when I run the above code... | <p>Setting an attribute on an object won't give a compile-time or a run-time error, it will just do nothing useful if the object doesn't access it (i.e. "<code>node.noSuchAttr = 'bar'</code>" would also not give an error).</p>
<p>Unless you need a specific feature of <code>minidom</code>, I would look at <code>Element... | <p>Setting an attribute on an object won't give a compile-time or a run-time error, it will just do nothing useful if the object doesn't access it (i.e. "<code>node.noSuchAttr = 'bar'</code>" would also not give an error).</p>
<p>Unless you need a specific feature of <code>minidom</code>, I would look at <code>Element... | 4,890 |
<p>I'm writing a simple time tracking program to manage my own projects. I'm a big fan of keeping reporting code in the database, so I've been attempting to create a few sprocs that generate the invoices and timesheets etc.</p>
<p>I have a table that contains Clock Actions, IE "Punch In", and "Punch Out". It also cont... | <p>I agree that the design isn't the greatest--an event based structure with a single row for start-end will probably save you a lot of time. In that case, you could create a record with a null end-date when someone clocks in. Then, fill in the end date when they clock out.</p>
<p>But, that's not what you asked. This ... | <p>Have you thought about things like:</p>
<ul>
<li>someone forgets to clock out, and thus it appears they clocked in twice?</li>
<li>someone forgets to clock in, and thus it appears they clocked out twice?</li>
</ul>
<p>In the first case, is it correct to simply ignore the second clock-in? The accepted answer will b... | 34,737 |
<p><strong>Question</strong></p>
<p>I have an application written in Java. It is designed to run on a Linux box standalone. I am trying to spawn a new <em>firefox</em> window. However, <em>firefox</em> never opens. It always has a shell exit code of 1. I can run this same code with <em>gnome-terminal</em> and it ... | <p>If you can narrow it down to Java 6, you can use the desktop API:</p>
<p><a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/" rel="noreferrer">http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/</a></p>
<p>Should look something like:</p>
<pre><c... | <p>You might have better luck if you read and display the standard output/error streams, so you can catch any error message firefox may print.</p>
| 30,883 |
<p>I'm running Oracle 10g and have columns with Type_Name </p>
<pre>TIMESTAMP(6) WITH TIME ZONE</pre>
<p>When inflated into java classes they come out as</p>
<pre>oracle.sql.TIMESTAMPTZ </pre>
<p>But DbUnit can't handle converting Oracle specific classes to Strings for writing to XML. I'm wondering if there's any ... | <p>Try messing with the device information settings, in particular the HumanReadiblePdf attribute.
<a href="http://msdn.microsoft.com/en-us/library/ms154682.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms154682.aspx</a><br>
IIRC the setting is actually the opposite of what the documentation ... | <p>It seems that this is still an issue in <strong>SSRS 2008 R2</strong>. The fix was to change my images from <strong>PNG</strong> to <strong>JPEG</strong>. <strong>@DanielAuger</strong> was heading in the right direction with his last link. I've included it again here with its title:</p>
<h2><a href="http://blogs.m... | 27,539 |
<p>I am trying to use the <code>import random</code> statement in python, but it doesn't appear to have any methods in it to use.</p>
<p>Am I missing something?</p>
| <p>You probably have a file named random.py or random.pyc in your working directory. That's shadowing the built-in random module. You need to rename random.py to something like my_random.py and/or remove the random.pyc file.</p>
<p>To tell for sure what's going on, do this:</p>
<pre><code>>>> import random... | <p>Can you post an example of what you're trying to do? It's not clear from your question what the actual problem is.</p>
<p>Here's an example of how to use the random module:</p>
<pre><code>import random
print random.randint(0,10)
</code></pre>
| 10,007 |
<p>I've got 2 Questions:</p>
<p>1.
I've sarted working around with Linq to XML and i'm wondering if it is possible to change an XML document via Linq. I mean, is there someting like </p>
<pre><code>XDocument xmlDoc = XDocument.Load("sample.xml");
update item in xmlDoc.Descendants("item")
where (int)item .Attribute("... | <p>thank you for your answer. everything works fine.</p>
<p>just as completition to my questions the code below shows how to modify a single entry:</p>
<pre><code>string xml = @"<data><record id='1' info='sample Info'/><record id='2' info='sample Info'/><record id='3' info='sample Info'/></... | <pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
namespace LinqToXmlTest
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
... | 42,951 |
<p>Okay so im working on this php image upload system but for some reason internet explorer turns my basepath into the same path, but with double backslashes instead of one; ie:</p>
<pre><code>C:\\Documents and Settings\\kasper\\Bureaublad\\24.jpg
</code></pre>
<p>This needs to become C:\Documents and Settings\kaspe... | <p>Use the <a href="http://us.php.net/manual/en/function.stripslashes.php" rel="nofollow noreferrer"><code>stripslashes</code></a> function.</p>
<p>That should make them all single slashes.</p>
| <p>Have you considered the stripslashes() function?</p>
<p><a href="http://www.php.net/stripslashes" rel="nofollow noreferrer">http://www.php.net/stripslashes</a></p>
| 13,473 |
<p>I have some styles applied to html for example </p>
<pre><code><body style="background: #C3DAF9;">
</code></pre>
<p>and when I use forms authentication it is ignored. If I put the style into an external .css file then it works. </p>
<p>This doesn't seem like normal behaviour to me. </p>
| <p>Solved the problem. I'm not sure I understand why it happened but here is the offending code;</p>
<pre><code>if (User.Identity.IsAuthenticated) {
if (User.Identity is BookingIdentity) {
BookingIdentity id = (BookingIdentity) User.Identity;
Response.Write("<p/>UserName: " + id.Name);
}... | <p>Yes you should check the output html, and your browser.</p>
<p>If there is no style tag in your html output you could use and try:</p>
<pre><code><body bgcolor="#C3DAF9">
</code></pre>
| 19,460 |
<p>I'd like to receive error logs via email. For example, if a <code>Warning-level</code> error message should occur, I'd like to get an email about it.</p>
<p>How can I get that working in CodeIgniter?</p>
| <p>You could extend the Exception core class to do it.</p>
<p>Might have to adjust the reference to CI's email class, not sure if you can instantiate it from a library like this. I don't use CI's email class myself, I've been using the Swift Mailer library. But this should get you on the right path.</p>
<p>Make a fil... | <p>Oh, another option is to get a logrotation application that supports emailing digests. Not sure what platform you are on, but you could just have something monitor the error_log file and send you updates, might not be as neat and certainly you would be limited to only information in the error_log. (error_log is Apac... | 32,581 |
<p>The minimum spanning tree problem is to take a connected weighted graph and find the subset of its edges with the lowest total weight while keeping the graph connected (and as a consequence resulting in an acyclic graph).</p>
<p>The algorithm I am considering is:</p>
<ul>
<li>Find all cycles.</li>
<li>remove the l... | <p>What happens if two cycles overlap? Which one has its longest edge removed first? Does it matter if the longest edge of each is shared between the two cycles or not?</p>
<p>For example:</p>
<pre><code>V = { a, b, c, d }
E = { (a,b,1), (b,c,2), (c,a,4), (b,d,9), (d,a,3) }
</code></pre>
<p>There's an a -> b -> c ... | <p>@Tynan The system can be described (somewhat over simplified) as a systems of rules describing categorizations. "Things are in category A if they are in B but not in C", "Nodes connected to nodes in Z are also in Z", "Every category in M is connected to a node N and has 'child' categories, also in M for every node c... | 5,815 |
<p>I have two vb.net class:</p>
<pre><code>Public MustInherit Class Class1
Private m_sProperty1 As String = ""
Public Property sProperty1() As String
Get
Return m_sProperty1
End Get
Set(ByVal value As String)
m_sProperty1 = value
End Set
End Property
... | <p>This seems to answer your question:</p>
<p><strong>Exporting Inheritance Hierarchies</strong></p>
<p>Managed class hierarchies flatten out when exposed as COM objects. For example, if you define a base class with a member, and then inherit the base class in a derived class that is exposed as a COM object, clients th... | <p>I'll take a guess as I'm not up to speed on .NET</p>
<p>I would imagine your declaration is taking your public methods of Class2 and creating a COM interface out of them. It will only take methods (and properties) on Class2 and not inherited ones (otherwise you would get all public methods all the way down to your... | 32,454 |
<p>What version of java, eclipse and WPT should I be using?</p>
| <p>Java 2 SDK 5.0 or higher
The Release notes tell you all at this site</p>
<p><a href="http://wso2.org/project/wsas/java/2.3/docs/tools/ide.html" rel="nofollow noreferrer">http://wso2.org/project/wsas/java/2.3/docs/tools/ide.html</a></p>
| <p>WSO2 WSAS is now called WSO2 Application Server and is now in version 4.0.0</p>
<p>If you are to run the latest WSO2 Application Server, it is recommended that you run it with JDK 1.6</p>
<p>If you want to develop services to be hosted, you can use WSO2 Carbon Studio for this purpose. Note that Carbon Studio is Ec... | 14,205 |
<p>I want to save a set of email addresses collected from a text field (separated by commas) into a single field in a table. I am trying to use serialize but I'm getting SerializationTypeMismatch error. How can I do this?</p>
<p>This is my model:</p>
<p>class Crew < ActiveRecord::Base</p>
<p>class Recipients <... | <p>I would really reccomend that you parse (e.g. split on comma) the email list and put each in a row in a separate table (I assume you're talkin about a database table?). If you want to use the email addresses for something it's better to store them individually, and since you're talking about serialization I guess yo... | <p>If you are given a comma separated list of email addresses, and if when you need to use that information, a comma separated list is useful, then just put it in a text column in your model, without serialization.</p>
<p>If you need to serialize the list, wouldn't it be an array? Can you explain the choice of a hash... | 37,744 |
<p>How can I create a custom property for my .Net assembly which would then be visible under the Details tab in Windows explorer?</p>
<p>Something to sit parallel with "File Description", "Type", "Product Version"... etc</p>
<p>Update: To quote my comment to Lars ... "Whilst I would have liked to do this from within ... | <p>Your compiler does not support it. AssemblyFileVersionAttribute and all work because the compiler generates a win32 resource in your assembly called <a href="http://msdn.microsoft.com/en-us/library/aa381058.aspx" rel="noreferrer">VERSIONINFO</a> with that information in it. That is what windows is reading. Other att... | <p>The only tool that can control any field of VERSIONINFO structure from the command line and hence is able to add an additional property during a build process is Resource Tuner Console:<br>
<a href="http://www.reseditor.com/rtc-solution-version-info.htm" rel="nofollow noreferrer">http://www.reseditor.com/rtc-solutio... | 23,297 |
<p>I have heard that the Java implementation of Generics is not as good as the C# implementation. In that the syntax looks similar, what is it that is substandard about the Java implementation, or is it a religious point of view?</p>
| <p><a href="http://www.jprl.com/Blog/archive/development/2007/Aug-31.html" rel="noreferrer">streloksi's link</a> does a great job of breaking down the differences. The quick and dirty summary though is ...</p>
<p>In terms of syntax and usage. The syntax is roughly the same between the languages. A few quirks here a... | <p>Also found <a href="http://www.artima.com/intv/generics.html" rel="noreferrer">this</a> conversation with Anders Hejlsberg that may be interesting too. To summarize points that Anders Hejlsberg made with some additional notes: <strong>Java generics were made for maximum compatibility with existing JVM</strong> that ... | 46,272 |
<p>In layman's terms, what's a RDF triple?</p>
| <p>I think the question needs to be split into two parts - what is a triple and what makes an "RDF triple" so special?</p>
<p>Firstly, a triple is, as most of the other commenters here have already pointed out, a statement in "subject/predicate/object" form - i.e. a statement linking one object (subject) to another ob... | <p>See:
<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple" rel="nofollow noreferrer">http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple</a></p>
<p>An RDF triple contains three components:</p>
<ul>
<li>the subject, which is an RDF URI reference or a blank node</li>
<li>the p... | 34,414 |
<p>I want to change the standard "3D" look of the standard asp.net checkbox to say solid 1px. If I try to apply the styling to the Border for example it does just that - draws the standard checkbox with a border around it - which is valid I guess.</p>
<p>Anyway, is there a way to change how the actual textbox is style... | <p>I think the best way to make CheckBox looks really different is not to use checkbox control at all. Better use your own images for checked/unchecked state on-top of hyperlink or image element. Cheers.</p>
| <p>They're dependent on the browser really.</p>
<p>Maybe you could do something similar to the answer in <a href="https://stackoverflow.com/questions/108149/what-is-the-best-way-to-replace-the-file-browse-button-in-html#108157">this</a> question about changing the file browse button.</p>
| 13,797 |
<p>I have a C# console app "App1" that reads a row of data from a table in a SQL Server 2005 DB. I want App1 to pass all the data in this row to App2, another C# console app. What is the best way to do this?</p>
<p>My first (naive) attempt was to do this:</p>
<pre><code>object[] o = myrow.ItemArray;
// make a strin... | <p>One approach would be to serialize the row to XML and use that, except that DataRow (lacking a default constructor) can't be serialized. Instead you'd have to create a new DataTable and add that row to it.</p>
<p>Then you could simply serialize the entire DataTable to XML and pass it to the other application, eithe... | <p>The space-separated approach is fine if you are using Process.Start - you just need to wrap items containing spaces with quotes - same as at the command line: cd "c:\program files"</p>
<p>If the data is more complex than a few values, then IPC approaches such as remoting, sockets, WCF, etc might help. Or simpler: w... | 21,271 |
<p>Maybe the need to do this is a 'design smell' but thinking about another question, I was wondering what the cleanest way to implement the <strong>inverse</strong> of this:</p>
<pre><code>foreach(ISomethingable somethingableClass in collectionOfRelatedObjects)
{
somethingableClass.DoSomething();
}
</code></pre>
<... | <p>Something like this?</p>
<pre><code>foreach (ParentType parentType in collectionOfRelatedObjects) {
if (!(parentType is ISomethingable)) {
}
}
</code></pre>
| <p>J D OConal's is the best way to do this but as a side note, you can use the as keyword to cast an object, and it'll return null if its not of that type.</p>
<p>So something like:</p>
<pre><code>foreach (ParentType parentType in collectionOfRelatedObjects) {
var obj = (parentType as ISomethingable);
if (obj... | 11,534 |
<p>I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file.</p>
<p>I have the e-mailing of the link, MySQL query, etc. covered.</p>
<p>How can I, when they click the link, have a pop-up to download a CVS with the record from MySQL? </p>
<p>I have all the information to get th... | <p>Try:</p>
<pre><code>header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "record1,record2,record3\n";
die;
</code></pre>
<p>etc</p>
<p>Edit: Here's a snippet of code I use to optionally encode CSV fields:</p>
<pre>... | <p>Put in the <code>$output</code> variable the CSV data and echo with the correct headers</p>
<pre><code>header("Content-type: application/download\r\n");
header("Content-disposition: filename=filename.csv\r\n\r\n");
header("Content-Transfer-Encoding: ASCII\r\n");
header("Content-length: ".strlen($output)."\r\n");
ec... | 26,720 |
<p>Take a .Net Winforms App.. mix in a flakey wireless network connection, stir with a few users who like to simply pull the blue plug out occasionally and for good measure, add a Systems Admin that decides to reboot the SQL server box without warning now and again just to keep everyone on their toes.</p>
<p>What are ... | <p>Answer depends on type of your application. There are applications that can work offline - Microsoft Outlook for example. Such applications doesn't treat connectivity exceptions as critical, they can save your work locally and synchronize it later. Another applications such as online games will treat communication p... | <p>In our application, we give the user the option to connect to another server, e.g., if the database connection fails, a dialog box displays saying that the server is unavailable, and they could input another IP address to try.</p>
| 7,197 |
<p>We have been designing our reports around Crystal Reports in VS2008 for our web application and I just discovered the Microsoft provided ReportViewer control. I've searched around a bit but cannot find a good breakdown of the pros and cons of each method of producing reports.</p>
<p>I'm looking for pros and cons r... | <p>Well, I can answer for one side. I have used <strong>ReportViewer</strong> aka Client Side Reporting. I can tell you its easy to use, easy to deploy and easy to develop. If you can create SQL Reporting Services reports, you can create these. They can take any kind of datasource so you have full control.</p>
<p><a h... | <p>We've been using crystal report for our reporting, there is always the issue of portability since you have to package the crystal runtime with your application. also, with client side reporting much of its power is not utilized. reportviewer is simple and easy and full of features you'll need.</p>
| 17,971 |
<p>How do I properly convert two columns from SQL (2008) using Linq into a <code>Dictionary</code> (for caching)?</p>
<p>I currently loop through the <code>IQueryable</code> b/c I can't get the <code>ToDictionary</code> method to work. Any ideas?
This works:</p>
<pre><code>var query = from p in db.Table
sel... | <pre><code>var dictionary = db
.Table
.Select(p => new { p.Key, p.Value })
.AsEnumerable()
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)
;
</code></pre>
| <p>Why would you create an anonymous object for every item in the table just to convert it?</p>
<p>You could simply use something like:
<code>IDictionary<string, string> dic = db.Table.ToDictionary(row => row.Key, row => row.Value);</code>
You may need to include an AsEnumerable() call between Table and To... | 30,411 |
<p>I have a DataTrigger defined in my XAML which I want to use in several places. Is it possible to define it as a resource and then share it?</p>
<p>Here's my trigger:</p>
<pre><code><TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding HasCurrentTest}... | <p>As a comment on my own post, I've just seen a much better way to do this anyway - I should be using the built-in BooleanToVisibilityConverter, then I can just do this:</p>
<pre><code><Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
</Window.Resources>
</code></pre>
<p>the... | <p>If the style is in the Windows.Resources with a key, each element can add it to their own style like this.</p>
<pre><code><Window.Resources>
<Style x:Key="YourStyleKey">
<!-- Your Style -->
</Style>
</Window.Resources>
<TextBox Text="SomeText" Style="{StaticResource... | 34,052 |
<p>What's the easiest way to checkout a file from our TFS with MSBUILD. </p>
<p>From what I can see it's to shell out to TF.EXE and manually call the checkout command. Is there really no built in command?!</p>
| <p>There really is no built in command. Even worse, the tf checkout command only accepts a single filespec. </p>
<p>The recently released <a href="http://www.codeplex.com/MSBuildExtensionPack" rel="noreferrer">MSBuildExtensionPack</a> has some msbuild commands for TFS, but no perf gain there. Under the hood, they shel... | <p>the 'itemspec' can be a list of space-delimited items and can use wildcards. </p>
| 27,727 |
<p>I'm looking at all the CSS Drop shadow tutorials, which are great. Unfortunately, I need to put a shadow on three sides of a block element (left, bottom, right). All the tutorials talk about shifting your block element up and to the left. Anyone have insights into putting a shadow on three or even four sides?</p>... | <p>make your block element larger/higher, so that it exceeds the sides you want.</p>
| <p>Here's one way to do it:</p>
<pre><code><div style='position:relative;'>
<div style='position:absolute;top:10px;left:10px;width:300px;height:100px;z-index:1;background-color:#CCCCCC'></div>
<div style='position:absolute;top:0px;left:0px;width:300px;height:100px;z-index:2;background-colo... | 31,652 |
<p>I'm trying to make a setup program for an ASP.NET web site. I need to make sure the target machine has sqlxml installed.</p>
<p>I must verify the target machine has the software installed, and if not, launch a .msi file either before or after the main installation.</p>
<p>I'm a complete newbie with setup projects,... | <p>Unfortunately, you can't run one installer from another, since only one can be running at a time. You need to chain them together and run one after the other. Google "msi chaining". This is often the reason why products like Visual Studio use an external setup.exe which then runs the installers one after the othe... | <p>Brent's answer is correct. I would just add that, sometimes, you can find a "merge module" for the bits you depend on. That's a .msm file. You can certainly include 1 or more of those in your .msi file. I have no idea whether a merge module is available for SQLXML. Sorry.</p>
| 36,005 |
<p>I work for a large website. Our marketing department asks us to add ever more web ad tracking pixels to our pages. I have no problem with tracking the effectiveness of ad campaigns, but the servers serving those pixels can be unreliable. I'm sure most of you have seen web pages that refuse to finish loading because ... | <p>jQuery and other JavaScript frameworks can help handle the problem by using a method such as the" document ready" function, which fire when the document is ready and don't need to wait for all the images.</p>
<p>I'll quote direct from the jQuery tutorial:</p>
<blockquote>
<p>The first thing that most Javascript ... | <p>I also work for a large website and here is what we did:</p>
<ol>
<li><p>Moved the ad calls to the bottom of
the page, so the content would show
up first (because JS is
synchronous).</p></li>
<li><p>Loaded the ads using Ajax Calls (to
allow the page to be usable while
the ads are loading) into a hidden
element.</p>... | 44,756 |
<p>I want to override the bad default tabbing scheme in emacs so that it will work like most other editors (eclipse, notepad++). I want to set it so that regardless of mode, tab will insert a tab, and pressing enter will keep me at my current tab depth.</p>
<p>I tried this, but it does nothing:</p>
<pre><code>(global... | <p>To make the Enter key take you to the next line and indent it automatically, you can put</p>
<pre><code>(global-set-key (kbd "RET") 'newline-and-indent)
</code></pre>
<p>in your <code>.emacs</code>. [Or you can hit <code>C-j</code> instead of Enter.] Once you have that, you'll never need to insert tabs manually, b... | <p><code>C-j</code> does the newline + indent functionality that you want out of pressing Enter.</p>
| 44,880 |
<p>I have been asked to find training resources to bring engineers up to speed on VBA programming.</p>
<p>The target trainee will have some systems engineering experience but little to no non-systems programming experience. </p>
<p>I'm hoping for a computer-based training course or DVD that we can purchase and give t... | <p>Remove keys and values by using the minus sign (-).</p>
<pre><code>REGEDIT4
[-HKEY_CURRENT_USER\RemoveThisTree]
[HKEY_CURRENT_USER\RemoveValue]
"valueName"=-
</code></pre>
<h3>References</h3>
<ul>
<li><p>Minus sign to delete mentioned here: <a href="https://support.microsoft.com/en-us/kb/310516" rel="noreferrer">... | <p>Documenting the .reg file format is really more <a href="http://support.microsoft.com/kb/310516" rel="noreferrer">Microsoft's job</a>.</p>
| 43,330 |
<p>This piece of T-SQL is deprecated in 2005:</p>
<pre><code>BACKUP LOG [DB_NAME] WITH TRUNCATE_ONLY
</code></pre>
<p>I don't need to keep a backup the log for my db - but I do not want the piece of code to stop working if we port to SQL2008 or successive versions in future.</p>
<p>Cheers</p>
| <p>Switch the database recovery mode to SIMPLE, and then use DBCC SHRINKFILE. Then restore your original recovery mode. If your LOG file does not shrink, you might have uncommitted transactions. For more details, see Tibor's Karaszi's article on <a href="http://www.karaszi.com/SQLServer/info_dont_shrink.asp" rel="nofol... | <p>As Andy Jones answered, the log file is mandatory. It is not simply a log of events for your sake, but a vital part of the way the database handles transaction rollbacks as well as memory commits.</p>
| 34,265 |
<p>I'm hosting my first WCF service in IIS. I have two methods, 1 to set a string variable on the WCF Service, and the other to retrieve it. The interface used is:</p>
<pre><code>[OperationContract]
string ReturnText();
[OperationContract]
void SetText(string s);
</code></pre>
<p>BasicHttpBinding is used. Stepping t... | <p>By default things are session-less and instances are per-call. See</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms731193.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms731193.aspx</a></p>
<p>for some starter information, but in order to have state across the calls, you'll eit... | <p>Thanks Brian, that link holds the information I need. I've added</p>
<p>[ServiceContract (SessionMode=SessionMode.Required)]</p>
<p>to my interface/contract and it automagically now works!</p>
| 29,476 |
<p>Briefly: Does anyone know of a GUI for gdb that brings it on par or close to the feature set you get in the more recent version of Visual C++?</p>
<p>In detail: As someone who has spent a lot of time programming in Windows, one of the larger stumbling blocks I've found whenever I have to code C++ in Linux is that ... | <p>You won't find <em>anything</em> overlaying GDB which can compete with the raw power of the Visual Studio debugger. It's just too powerful, and it's just too well integrated inside the IDE. </p>
<p>For a Linux alternative, try DDD if free software is your thing.</p>
| <p>Latest version of Geany supports it (only on Linux, though)</p>
| 10,443 |
<p>It's helpful to name threads so one can sort out which threads are doing what for diagnostic and debugging purposes.</p>
<p>Is there a particular naming convention for threads in a heavily multi-threaded application that works better than another? Any guidelines? What kind of information should go into the name for... | <p>There's to my knowledge no standard. Over the time I've found these guidelines to be helpful:</p>
<ul>
<li><p>Use short names because they don't make the lines in a log file too long.</p></li>
<li><p>Create names where the important part is at the beginning. Log viewers in a graphical user interface tend to have ta... | <p>I tend to approach naming threads the same as naming methods or variables. Pick something that concisely describes the process that the thread is responsible for. I don't think there's a lot of extra information that you can or should put into a thread-name. Expressive but terse is the primary goal.</p>
<p>The o... | 18,065 |
<p>I'm learning traditional Relational Databases (with <a href="http://www.postgresql.org/" rel="noreferrer">PostgreSQL</a>) and doing some research I've come across some new types of databases. <a href="http://couchdb.apache.org/" rel="noreferrer">CouchDB</a>, <a href="https://launchpad.net/drizzle" rel="noreferrer">D... | <p>I would say next-gen <em>database</em>, not next-gen SQL.</p>
<p>SQL is a language for querying and manipulating relational databases. SQL is dictated by an international standard. While the standard is revised, it seems to always work within the relational database paradigm.</p>
<p>Here are a few new data stora... | <p>SQL has been around since the early 1970s so I don't think that it's going to go away any time soon.</p>
<p>Maybe the 'new(-ish) sql' will oql (see <a href="http://en.wikipedia.org/wiki/ODBMS" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/ODBMS</a>)</p>
| 35,822 |
<p>Is it expensive?</p>
<p>I am developing an HtmlHelper that renders directly to Response.Output in order to save unnecesary string creation and I need to choose between: </p>
<pre><code><% Validator.RenderClient(Response.Output); %>
</code></pre>
<p>and</p>
<pre><code><% Validator.RenderClient(); %>
<... | <p>@Dawkins</p>
<p>100 runs is too few, you need to run about 10000 times several times and repeat it and then take the average of that to get a reliable result. The margin of error is to big in your example, but it's the right way to go.</p>
<p>Here's what i did:</p>
<pre><code>var results1 = new List<long>()... | <p>from reflector </p>
<pre><code>public static HttpContext get_Current()
{
return (ContextBase.Current as HttpContext);
}
</code></pre>
<p>calls ContextBase
which calls</p>
<pre><code>public static object HostContext
{
get
{
object hostContext =
Thread.CurrentThread.GetIllogicalCallCo... | 37,100 |
<p>In the earliest stages of planning the development of a new system, which development model to follow seems paramount. I've always held onto the belief that a classic waterfall (or hybrid waterfall/iterative prototyping) is the best approach for medium to large projects. It seems that once a project gets to be a c... | <p>Scrum can be scaled using "Scrum of Scrums".</p>
<p>From the Scrum alliance comes this <a href="http://www.scrumalliance.org/articles/46-advice-on-conducting-the-scrum-of-scrums-meeting" rel="nofollow noreferrer">advice</a> on conducting Scrum of Scrums meetings:</p>
<blockquote>
<p>The scrum of scrums meeting i... | <p>Agile scales fine. It is not a rocket science. In fact it is all about <strong>modularity</strong>. Software development is a CAS (Complex Adaptive System) and, as almost any CAS, it <strong>has modules to rule the complexity better</strong>. Scrum of Scrums is one of the possible modular approach for development pr... | 20,408 |
<p>In an environment with multiple windows servers what is the best way to ensure patch compliance accross all systems? </p>
<p>Is there a simple tool (some sort of client/server app?) that allows reports to be generated showing the status of all the systems so any that aren't automatically patching themselves can be... | <p>Here's the formula: 2 ^ (32 - netmask) - 2 where netmask is a bit count as you've shown in the Cisco notation above. So a network with a /30 mask has 2 usable addresses.</p>
<p>The lowest network number always represents the network segment itself and the highest is always the broadcast ... this leads to the -2 a... | <p><a href="http://www.unixwiz.net/techtips/netmask-ref.html" rel="nofollow noreferrer">http://www.unixwiz.net/techtips/netmask-ref.html</a></p>
<p>That will provide you with all of the logic you need to determine what you need to do.</p>
| 12,423 |
<p>How do you build and use dynamic sql in a MySQL stored procedure?</p>
| <p>I don't believe MySQL supports dynamic sql. You can do "prepared" statements which is similar, but different.</p>
<p>Here is an example:</p>
<pre><code>mysql> PREPARE stmt FROM
-> 'select count(*)
-> from information_schema.schemata
-> where schema_name = ? or schema_name = ?'
;... | <p><strong>You can pass thru outside the dynamic statement using User-Defined Variables</strong></p>
<pre><code>Server version: 5.6.25-log MySQL Community Server (GPL)
mysql> PREPARE stmt FROM 'select "AAAA" into @a';
Query OK, 0 rows affected (0.01 sec)
Statement prepared
mysql> EXECUTE stmt;
Query OK, 1 row ... | 23,159 |
<p>I create new project in Netbeans, but when I look the library it still using JDK 1.6 (default) I want to change into JDK 6 Update 10 but how? I already instal JDK 6 Update 10 but when I import org.hibernate the neatbeans didn't know which library that org.hibernate.</p>
<p>someone can help me? THX</p>
| <p>In Netbeans you can define a new Java Platform from Tools > Java Platforms. This brings up the platform manager. At this point you can click the "Add Platform" button and browse to the location of the new platform. You will then have multiple platforms set up and you can configure each project to use the appropriate... | <p>JDK 1.6 is the current released version.</p>
<p>I really hope you aren't talking about Java 10 there.</p>
<p>And even worse would be if you wanted to use Java 1.1! Which was out over 10 years ago.</p>
| 42,237 |
<p>We are working on a service that will have website access for stats and other tasks, but the majority of use will be through a client gem and rake tasks. What is the best way to handle authentication for both pieces.</p>
<p>It looks like fiveruns_tuneup, getexceptional, New Relic and others have websites with usern... | <p>I recommend that you use username/password combos for website accounts, and API keys for any web services. Here are the advantages of this technique:</p>
<ol>
<li>By linking API keys to an account, you could have many API keys for the same user. Perhaps this could be used for many remote web servers that consume th... | <p>The github approach is bootstrapping on top of existing git practices, however it's not a bad idea since presumably each user will have their own private key to match a published public one in the central authority. Since key-agent's already furnish a means of safe authentication this seems like a very safe approac... | 44,019 |
<p>I have a sharepoint event handler which I want to activate for a single list, not all the lists in the site. How do I go about this?</p>
| <p>Got the answer. We need to run this code, maybe in a console app. I still didn't get how to remove the event handler once it has been added though...</p>
<pre><code>string siteUrl = Console.ReadLine();
SPSite site = new SPSite(siteUrl);
SPWeb web = site.OpenWeb();
string listName = Console.ReadLine();
SPList list ... | <p>Take a look at the code that comes with the tool from u2u that I posted earlier. It is a convenient tool when you are working with event handlers.</p>
| 37,678 |
<p>Here's a fictitious example of the problem I'm trying to solve. If I'm working in C#, and have XML like this:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<Cars>
<Car>
<StockNumber>1020</StockNumber>
<Make>Nissan</Make>
<Model>Sentra</Model&... | <p>It might be a bit old thread, but i will post anyway. i had the same problem (needed to deserialize like 10kb of data from a file that had more than 1MB). In main object (which has a InnerObject that needs to be deserializer) i implemented a IXmlSerializable interface, then changed the ReadXml method. </p>
<p>We h... | <p>You may control what parts of the Cars class are deserialized by implementing the <strong>IXmlSerializable</strong> interface on the Cars class, and then within the <em>ReadXml(XmlReader)</em> method you would read and deserialize the Car elements but when you reach the SalesPerson element you would read its subtree... | 48,301 |
<p>I am looking for attributes I can use to ensure the best runtime performance for my .Net application by giving hints to the loader, JIT compiler or ngen.</p>
<p>For example we have <a href="http://msdn.microsoft.com/en-us/library/k2wxda47.aspx" rel="noreferrer">DebuggableAttribute</a> which should be set to not deb... | <p>Ecma-335 specifies some more CompilationRelaxations for relaxed exception handling (so-called e-relaxed calls) in Annex F "Imprecise faults", but they have not been exposed by Microsoft.</p>
<p>Specifically CompilationRelaxations.RelaxedArrayExceptions and CompilationRelaxations.RelaxedNullReferenceException are me... | <p>I found another: <a href="http://msdn.microsoft.com/en-us/library/system.resources.neutralresourceslanguageattribute.aspx" rel="nofollow noreferrer">NeutralResourcesLanguageAttribute</a>. According to <a href="http://blogs.msdn.com/bclteam/archive/2005/10/11/479330.aspx" rel="nofollow noreferrer">this</a> blog post ... | 9,555 |
<p>I have an IQueryable and an object of type T.</p>
<p>I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))</p>
<p>so ...</p>
<pre><code>public IQueryable<T> DoWork<T>(string fieldName)
where T : EntityObject
{
...
T objectOfTypeT = ...;
... | <p>Like so:</p>
<pre><code> var param = Expression.Parameter(typeof(T), "o");
var fixedItem = Expression.Constant(objectOfTypeT, typeof(T));
var body = Expression.Equal(
Expression.PropertyOrField(param, fieldName),
Expression.PropertyOrField(fixedItem, fieldName));
var lambda = Expressi... | <p>From what I can see so far it's going to have to be something like ...</p>
<pre><code>IQueryable<T>().Where(t =>
MemberExpression.Property(MemberExpression.Constant(t), fieldName) ==
ParameterExpression.Property(ParameterExpression.Constant(item), fieldName));
</code></pre>
<p>While I can get this to co... | 28,736 |
<p>I would really like to use SpringSource dm Server, but our customer requires us to run our apps on their application server (Websphere). Is there a way to integrate SpringSource dm Server with other application servers? At least dm Server is build on OSGi, and many other application servers (including Websphere) are... | <p>SpringSource dm Server is based on the Eclipse Equinox OSGi framework (and should not be confused with the Spring DM technology, included in dm Server, which can run on Equinox, Apache Felix, and Knopflerfish).</p>
<p>However, embedding dm Server in another application server, such as WebSphere Application Server, ... | <p>I do not think that this is really the case ...</p>
<p>see the following link for this: <a href="http://apsblog.burtongroup.com/2008/11/websphere-7-osgi.html" rel="nofollow noreferrer">http://apsblog.burtongroup.com/2008/11/websphere-7-osgi.html</a></p>
<p>But it seems on the other side, that the trend is clear ..... | 19,470 |
<p>G'day Stackoverflowers,</p>
<p>I'm the author of Perl's <a href="http://search.cpan.org/perldoc?autodie" rel="nofollow noreferrer">autodie</a> pragma, which changes Perl's built-ins to throw exceptions on failure. It's similar to <a href="http://search.cpan.org/perldoc?Fatal" rel="nofollow noreferrer">Fatal</a>, b... | <p>Under Win32 "native" Perl, note that $^E is more descriptive at 33, "The process cannot access the file because another process locked a portion of the file" which is <code>ERROR_LOCK_VIOLATION</code> (available from <a href="http://search.cpan.org/dist/Win32-WinError/" rel="nofollow noreferrer">Win32::WinError</a>)... | <p>For the Windows-specific error code, you want to use <code>$^E</code>. In this case, it's 33: "The process cannot access the file because another process has locked a portion of the file" (<code>ERROR_LOCK_VIOLATION</code> in <code>winerror.h</code>).</p>
<p>Unfortunately, I don't think <a href="http://search.cpan... | 15,954 |
<p>I'm working through <a href="https://rads.stackoverflow.com/amzn/click/com/1590599063" rel="nofollow noreferrer" rel="nofollow noreferrer">Practical Web 2.0 Appications</a> currently and have hit a bit of a roadblock. I'm trying to get PHP, MySQL, Apache, Smarty and the Zend Framework all working correctly so I can... | <p>The problem isn't with the $name variable but rather with the $_engine variable. It's currently empty. You need to verify that the path specification to Smarty.class.php is correct. </p>
<p>You might try this to begin your debugging:</p>
<pre><code>$this->_engine = new Smarty();
print_r($this->_engine);
</co... | <p>Zend has an example of creating a templating system which implements the Zend_View_Interface here: <a href="http://framework.zend.com/manual/en/zend.view.scripts.html#zend.view.scripts.templates.interface" rel="nofollow noreferrer">http://framework.zend.com/manual/en/zend.view.scripts.html#zend.view.scripts.templat... | 31,720 |
<p>I've setup a reverse ssh tunnel, using PuTTY, to allow me to VNC into a home computer without having to enable NAT port forwarding. Works great, no problem.</p>
<p>I would like to set the tunnel up as a "persistent service" that will connect on boot up and reconnect when dropped. PS. this is on Windows.</p>
<p>E... | <p><a href="http://en.wikipedia.org/wiki/Comparison_of_SSH_clients" rel="nofollow noreferrer">wikipedia's comparison of ssh clients</a> has columns for tunnelling, SOCKS etc. may help you find something suitable</p>
| <p>you can just set-up any application to start with windows and auto-connect your tunnel on startup. I personnally use Easytunnel... just checked the option to connect all tunnels on startup, and set-up windows to start Easytunnel on bootup. It works great, tho you'll need to set-up your server's inactivity timeout, o... | 48,689 |
<p>I have an old legacy application around for which I only have the installer. it doesn't do anything more than uncompress and register itself and his library's.</p>
<p>As i don't have the source-code it gives me a lot of headaches in maintenance problems. In some particular computers (Acer Aspire One with Windows) j... | <p>One option is to find a machine that it <strong>does</strong> run on, and then install some "install guard" software (often called things like Acme Uninstaller). Use this to track what actually gets installed and then copy the relevant files and write your own.</p>
<p>It looks like a lot of hassle to me, and you ma... | <p>If it uses a MSI file, you can use Orca or SuperOrca to get at the stuff packed inside.</p>
| 29,078 |
<p>There example on the net and code given in Learn OpenCv,Orielly.</p>
<p>After many attempts the out.avi file is written with 0 bytes.
I wonder where i went wrong.</p>
<p>The following are the code i used...</p>
<pre><code>int main(int argc, char* argv[]) {
CvCapture* input = cvCaptureFromFile(argv[1]);
Ip... | <p>My bet is that cvCreateVideoWriter returns NULL. Just step through it to see if it's true. In that case, the problem is probably with CV_FOURCC(..) which doesnt find the codec and force a return 0;</p>
<p>you can try using -1 instead of CV_FOURCC. There is gonna be a prompt during runtime for you to chose the appro... | <p>Maybe you could try inserting a printf("Frame found\n") inside the for(;;) to see if it is actually capturing frames. Or even better:</p>
<pre><code>if(colourImage == NULL) {
printf("Warning - got NULL colourImage\n");
continue;
}
cvNamedWindow( "test", 1);
cvShowImage( "test", colourImage );
cvWaitKey( 0 )... | 48,180 |
<p>I am doing an e-commerce solution in ASP.NET which uses <a href="https://www.paypal.com/IntegrationCenter/ic_standard_home.html" rel="noreferrer">PayPal's Website Payments Standard</a> service. Together with that I use a service they offer (<a href="https://www.paypal.com/IntegrationCenter/ic_pdt.html" rel="noreferr... | <p>Something like this placed in your onload event.</p>
<pre><code>if (Request.RequestType == "POST")
{
using (StreamReader sr = new StreamReader(Request.InputStream))
{
if (sr.ReadLine() == "SUCCESS")
{
/* Do your parsing here */
}
}
}
</code></pre>
<p>Mind you that th... | <p>If I'm reading your question right, I think you're looking for the <a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.inputstream.aspx" rel="nofollow noreferrer" title="MSDN">InputStream property</a> on the Request object. Keep in mind that this is a firehose stream, so you can't reset it.</p>
| 4,059 |
<p>I've seen many references to a FDM print being weakest in the Z axis, due to poor bonding between layers compared to the extruded walls. </p>
<p>Thinking about optimising this for a specific material (excluding temperature and geometry), is there an optimum layer height? It seems obvious that too thick a layer will... | <p>My3dmatter.com performed a <a href="http://my3dmatter.com/influence-infill-layer-height-pattern//influence-infill-layer-height-pattern/" rel="nofollow noreferrer">series of tests</a> with PLA, using "a universal testing machine". They conclude:</p>
<blockquote>
<p>Layer height influences the strength of a printed... | <p>Just adding another datapoint. CNCKitchen has a new <a href="https://youtu.be/fbSQvJJjw2Q" rel="nofollow noreferrer">video</a> where he analyses this for cross layer and between layer tension. He also references some other research (which is rather inconclusive). He supports the coarse estimate of 'no more than 50% ... | 1,010 |
<p>I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything is OK, until I have these complex queries which may and may not have conditions. <br></p>
<p>It's not hard in Java to put together <code>WHERE</code> clause with conditions, but it's not nice.
And on PL/SQL side I also... | <p><a href="http://openhms.sourceforge.net/sqlbuilder/" rel="nofollow noreferrer">SQLBuilder</a> might be useful to you from the Java side. It allows you to write compile-time checked Java code that dynamically builds sql:</p>
<pre><code>String selectQuery =
(new SelectQuery())
.addColumns(t1Col1, t1Col2, t2Col1)... | <p>In PL/SQL use:</p>
<pre><code>EXECUTE IMMEDIATE lString;
</code></pre>
<p>This lets you build the lString (a VARCHAR2) into most bits of SQL that you'll want to use. e.g.</p>
<pre><code> EXECUTE IMMEDIATE 'SELECT value
FROM TABLE
WHERE '||pWhereClause
INTO lV... | 14,927 |
<p>Good morning,</p>
<p>I am working on a C# winform application that is using validation for the controls. The issue I'm having is that when a user clicks into a textbox and attempts to click out, the validation fires and re-focuses the control, basically the user cannot click out of the control to another control.</... | <p>The form has AutoValidate property, that can be set to allow focus change</p>
| <p>There's a property (I think it's on the form) that allows you to move between fields when validation fails. I can't remember what it's called, but I think it's named pretty descriptively.</p>
| 38,813 |
<p>I am using WPF and I have an image of an 8.5" * 11" piece of paper on a Canvas. I am then rotating the image using a RotateTransform, with the axis being in the middle of the page (that is, RotateTransformOrigin="0.5,0.5"). How can I find the actual location on the canvas of the corners of the image?</p>
| <p><a href="http://au.answers.yahoo.com/question/index?qid=20080607033505AAF75UC" rel="nofollow noreferrer">http://au.answers.yahoo.com/question/index?qid=20080607033505AAF75UC</a></p>
<p>(this is the geometry way)</p>
| <pre><code>_image.TranslatePoint(new Point(0, 0), _canvas);
</code></pre>
<p>Will this do?</p>
| 12,745 |
<p>Is there a way for me to serialize an object in .NET without the XML Namespaces automatically serializing also? It seems that by default .NET believes the XSI and XSD namespaces should be included, but I don't want them there.</p>
| <p>Ahh... nevermind. It's always the search after the question is posed that yields the answer. My object that is being serialized is <code>obj</code> and has already been defined. Adding an XMLSerializerNamespace with a single empty namespace to the collection does the trick.</p>
<p>In VB like this:</p>
<pre><code>... | <pre><code> XmlWriterSettings settings = new XmlWriterSettings
{
OmitXmlDeclaration = true
};
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
StringBuilder sb = new StringBuilder();
XmlSerializer xs = new XmlSerializer(typ... | 32,335 |
<p>I want to define something like this in <em>php</em>:</p>
<pre><code>$EL = "\n<br />\n";
</code></pre>
<p>and then use that variable as an "endline" marker all over my site, like this:</p>
<pre><code>echo "Blah blah blah{$EL}";
</code></pre>
<p>How do I define $EL once (in only 1 file), include it on every... | <p>Most PHP sites should have a file (I call it a header) that you include on every single page of the site. If you put that first line of code in the header file, then include it like this on every page:</p>
<pre><code> include 'header.php';
</code></pre>
<p>you won't have to use the global keyword or anything, the ... | <p>IIRC a common solution is a plain file that contains your declarations, that you include in every source file, something like '<em>constants.inc.php</em>'. There you can define a bunch of application-wide variables that are then imported in every file.</p>
<p>Still, you have to provide the include directive in <str... | 3,405 |
<p>I need a function written in Excel VBA that will hash passwords using a standard algorithm such as SHA-1. Something with a simple interface like:</p>
<pre><code>Public Function CreateHash(Value As String) As String
...
End Function
</code></pre>
<p>The function needs to work on an XP workstation with Excel 2003 i... | <p>Here's a module for calculating SHA1 hashes that is usable for Excel formulas eg. '=SHA1HASH("test")'. To use it, make a new module called 'module_sha1' and copy and paste it all in.
This is based on some VBA code from <a href="http://vb.wikia.com/wiki/SHA-1.bas" rel="noreferrer">http://vb.wikia.com/wiki/SHA-1.bas</... | <p>Here is the MD5 code inserted in an Excel Module with the name "module_md5":</p>
<pre><code> Private Const BITS_TO_A_BYTE = 8
Private Const BYTES_TO_A_WORD = 4
Private Const BITS_TO_A_WORD = 32
Private m_lOnBits(30)
Private m_l2Power(30)
Sub SetUpArrays()
m_lOnBits(0) = CLng(1)
... | 15,293 |
<p>I have a memory buffer corresponding to my screen resolution (1280x800 at 24-bits-per-pixel) that contains my screen contents at 24bpp. I want to convert this to 8-bpp (ie. Halftone color palette in Windows).
I currently do this:
1. Use CreateDIBSection to allocate a new 1280x800 24-bpp buffer and access it as a DC,... | <p>OK, to address the two parts of the problem.</p>
<ol>
<li><p>the following code shows how to get at the pixels inside of a bitmap, change them and put them back into the bitmap. You could always generate a dummy bitmap of the correct size and format, open it up, copy over your data and you then have a bitmap objec... | <p>How did you get the screen contents into this 24bpp memory buffer in the first place?</p>
<p>The obvious route to avoiding a needless memcpy is to subvert the original screengrab by creating the 24bpp DIBSection first, and passing it to the screengrab function as the destination buffer.</p>
<p>If thats not possibl... | 11,693 |
<p>I have an Anet A8, and recently updated the firmware to Marlin 1.1.8.
My only change was replacing the configuration files by the Anet A8 sample files built in with the firmware zip file.</p>
<p>Everything works fine but, sometimes, right after finishing a printing (while doing the "home all"), the LCD shows some w... | <p>This is a known problem of the Anet A8 display, it is caused by electrical interference. Pressing the middle button will refresh the display.</p>
<p>This is prone to happen when doing long prints. </p>
<p>There are some reported successes of people inserting ferrite beads or toroidal rings. </p>
<p>No, this is no... | <p>I have solved completely, I covered the flat cable, with copper tape, this shield should be connected to the 0V of the power supply.
All disorders will disappear.</p>
| 946 |
<p>I'd like to document what high-level (i.e. C++ not inline assembler ) functions or macros are available for Compare And Swap (CAS) atomic primitives... </p>
<p>E.g., WIN32 on x86 has a family of functions <code>_InterlockedCompareExchange</code> in the <code><_intrin.h></code> header.</p>
| <p>I'll let others list the various platform-specific APIs, but for future reference in C++09 you'll get the </p>
<pre><code>atomic_compare_exchange()
</code></pre>
<p>operation in the new "Atomic operations library".</p>
| <p>java has this CAS operation, too</p>
<p>see <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.html#compareAndSet(java.lang.Object,java.lang.Object,java.lang.Object)" rel="nofollow noreferrer">here</a></p>
<p>there are practical uses for this, like a <a href="htt... | 18,302 |
<p>I need to implement some kind of metric space search in Postgres(*) (PL or PL/Python). So, I'm looking for good sources (or papers) with a very clear and crisp explanation of the machinery behind these ideas, in such way that I can implement it myself.</p>
<p>I would prefer clarity over efficiency.</p>
<p>(*) The ... | <p>Especially for geographical data, look at <a href="http://postgis.refractions.net/" rel="nofollow noreferrer">PostGIS</a> first to see if you need to implement anything. If you do, start with the papers listed in the <a href="http://en.wikipedia.org/wiki/GiST" rel="nofollow noreferrer">Wikipedia entry on GiST</a>.</... | <p>Some techniques that involve space search that might help you are Hill-Climbing, Neural Network Training, Genetic Algorithm, and Particle Swarm. </p>
<p>You will also need to define a distance metric over your metric space. Have you done so?(& out of curiosity, what is it, if you have done so)</p>
| 25,272 |
<p>I thought I heard that <a href="http://www.py2exe.org/" rel="noreferrer">py2exe</a> was able to do this, but I never figured it out. Has anyone successfully done this? Can I see your setup.py file, and what command line options you used?</p>
<p>Basically I'm thinking of it giving me a single executable file that ... | <p><a href="http://www.pyinstaller.org/" rel="noreferrer">PyInstaller</a> will create a single .exe file with no dependencies; use the <code>--onefile</code> option. It does this by packing all the needed shared libs into the executable, and unpacking them before it runs, just as you describe (EDIT: py2exe also has thi... | <p>No, it's doesn't give you a single executable in the sense that you only have one file afterwards - but you have a directory which contains everything you need for running your program, including an exe file.</p>
<p>I just wrote <a href="http://hg.diotavelli.net/sta/master/file/542689f50e63/setup.py" rel="nofollow ... | 13,773 |
<p>I know in JavaScript, <em>objects</em> double as hashes, but I have been unable to find a built-in function to get the keys:</p>
<pre><code>var h = {a:'b', c:'d'};
</code></pre>
<p>I want something like</p>
<pre><code>var k = h.keys() ; // k = ['a', 'c'];
</code></pre>
<p>It is simple to write a function myself to i... | <p>There is function in modern JavaScript (ECMAScript 5) called <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/keys" rel="noreferrer"><code>Object.keys</code></a> performing this operation:</p>
<pre><code>var obj = { "a" : 1, "b" : 2, "c" : 3};
alert(Object.keys(obj)); // will out... | <p>If you are trying to get the elements only, but not the functions then this code can help you:</p>
<pre><code>this.getKeys = function() {
var keys = new Array();
for (var key in this) {
if (typeof this[key] !== 'function') {
keys.push(key);
}
}
return keys;
}
</code></p... | 3,941 |
<p>How can I create an Oracle stored procedure which accepts a variable number of parameter values used to feed a IN clause?</p>
<p>This is what I am trying to achieve. I do not know how to declare in PLSQL for passing a variable list of primary keys of the rows I want to update.</p>
<pre><code>FUNCTION EXECUTE_UPDA... | <p>Using CSV is probably the simplest way, assuming you can be 100% certain that your elements won't themselves contain strings.</p>
<p>An alternative, and probably more robust, way of doing this is to create a custom type as a table of strings. Supposing your strings were never longer than 100 characters, then you co... | <p>I've not done it for Oracle, but with SQL Server you can use a function to convert a CSV string into a table, which can then be used in an IN clause. It should be straight-forward to re-write this for Oracle (I think!)</p>
<pre><code>CREATE Function dbo.CsvToInt ( @Array varchar(1000))
returns @IntTable table
... | 30,066 |
<p>How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box.</p>
| <pre><code>// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "YOURBATCHFILE.bat";
p.Start();
// Do not wait for the child process to exit before
// read... | <p>Just for fun, here's my completed solution for getting PYTHON output - under a button click - with error reporting. Just add a button called "butPython" and a label called "llHello"...</p>
<pre><code> private void butPython(object sender, EventArgs e)
{
llHello.Text = "Calling Python...";
thi... | 25,278 |
<p>I am learning to use LabVIEW as part of my honours project, and was wondering what benefits the graphical programming language has over a textual one?</p>
| <p>Its all about the equipment drivers and user capabilities. NI (Labview) has a well supported set of lab equipment drivers that are easily interfaced. A test operator (not a developer) needs a gui with a big green/red pass/fail button. I've implemented complicated automation via python in cygwin. A Labview develope... | <p>To me it comes down to what you are comfortable with, if you're comfortable in text based languages, you'll likely find that Labview just introduces another learning curve. Unless you have a specific goal to learn and use Labview I see no point for your project.</p>
<p>On the other hand, if you aren't particularly... | 27,941 |
<p>I have an ASP.NET linkbutton control on my form. I would like to use it for javascript on the client side and prevent it from posting back to the server. (I'd like to use the linkbutton control so I can skin it and disable it in some cases, so a straight up tag is not preferred).</p>
<p>How do I prevent it from po... | <p>ASPX code:</p>
<pre><code><asp:LinkButton ID="someID" runat="server" Text="clicky"></asp:LinkButton>
</code></pre>
<p>Code behind:</p>
<pre><code>public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
someID.Attributes.Add("onClick"... | <p>You might also want to have the client-side function return false.</p>
<pre><code><asp:LinkButton runat="server" id="button" Text="Click Me" OnClick="myfunction();return false;" AutoPostBack="false" />
</code></pre>
<p>You might also consider:</p>
<pre><code><span runat="server" id="clickableSpan" onclic... | 21,296 |
<p>I specifically want to add the style of <code>background-color</code> to the <code><body></code> tag of a master page, from the code behind (C#) of a content page that uses that master page. </p>
<p>I have different content pages that need to make the master page has different colors depending on which conte... | <p>What I would do for the particular case is:</p>
<p>i. Define the body as a server side control</p>
<pre><code><body runat="server" id="masterpageBody">
</code></pre>
<p>ii. In your content aspx page, register the MasterPage with the register:</p>
<pre><code><% MasterPageFile="..." %>
</code></pre>
<... | <p>I believe you are talking about a content management system. The way I have delt with this situation in the past is to either:</p>
<ol>
<li>Allow a page/content to define an extra custom stylesheet or</li>
<li>Allow a page/content to define inline style tags</li>
</ol>
| 2,438 |
<p>A discussion happened today where a grid containing data, which ultimately had data attached to it, think master-detail type grids, and a question followed, so I thought I'd ask the question here in the hopes someone has an answer or some pointers.</p>
<p>If you have a problem where you're wondering <em>how should ... | <p>The <a href="http://www.welie.com/patterns/" rel="noreferrer">Pattern Library</a> at Welie.com is incredible. It gives you common scenarios, the theory behind it, and examples of live sites that follow the pattern.</p>
<p>I am not a web designer, but appreciate this site immensely.</p>
| <p>I found <a href="http://www.ecommr.com/" rel="nofollow noreferrer">this site</a> the other day, which is more of a reference of how others have done things, but could be useful (especially as it builds up a bit more).</p>
| 44,185 |
<p>This is probably best shown with an example. I have an enum with attributes:</p>
<pre><code>public enum MyEnum {
[CustomInfo("This is a custom attrib")]
None = 0,
[CustomInfo("This is another attrib")]
ValueA,
[CustomInfo("This has an extra flag", AllowSomething = true)]
ValueB,
}
</code>... | <p>This is probably the easiest way.</p>
<p>A quicker way would be to Statically Emit the IL code using Dynamic Method and ILGenerator. Although I've only used this to GetPropertyInfo, but can't see why you couldn't emit CustomAttributeInfo as well. </p>
<p>For example code to emit a getter from a property</p>
<pre>... | <p>I generally find reflection to be quite speedy as long as you don't dynamically invoke methods.<br>
Since you are just reading the Attributes of an enum, your approach should work just fine without any real performance hit.</p>
<p>And remember that you generally should try to keep things simple to understand. Over ... | 3,835 |
<p>I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to:</p>
<ul>
<li>Get and configure Apache, and necessary modules (I know there are other ways to create... | <p>Steps I've taken to make my laptop a Subversion server. Credit must go to <a href="http://alephzarro.com/blog/" rel="noreferrer">AlephZarro</a> for his directions <a href="http://alephzarro.com/blog/2007/01/07/installation-of-subversion-on-ubuntu-with-apache-ssl-and-basicauth/" rel="noreferrer">here</a>. I now have ... | <p>For Apache:</p>
<pre><code>sudo apt-get -yq install apache2
</code></pre>
<p>For SSH:</p>
<pre><code>sudo apt-get -yq install openssh-server
</code></pre>
<p>For Subversion:</p>
<pre><code>sudo apt-get -yq install subversion subversion-tools
</code></pre>
<p>If you'd like you can combine these into one command... | 8,571 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.