instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I've been having a hard time trying to understand PyPy's translation. It looks like something absolutely revolutionary from simply reading the description, however I'm hard-pressed to find good documentation on actually translating a real world piece of code to something such as LLVM. Does such a thing exist? The...
<p>This document seems to go into quite a bit of detail (and I think a complete description is out of scope for a stackoverflow answer):</p> <ul> <li><a href="http://codespeak.net/pypy/dist/pypy/doc/translation.html" rel="noreferrer">http://codespeak.net/pypy/dist/pypy/doc/translation.html</a></li> </ul> <p>The gener...
<blockquote> <p>It looks like something absolutely revolutionary from simply reading the description,</p> </blockquote> <p>As far as I know, PyPy is novel in the sense that it is the first system expressly designed for <em>implementing</em> languages. Other tools exist to help with much of the very front end, such ...
4,716
<p>I would like to shorten very long descriptions to the available table column width. I have the column width information in pixels. Now I would like to convert this measure to the number of characters, so I can shorten the text to the specified number.</p> <p>I doesn't have to be 100% correct, a near assumption will...
<p>Wrap your text in the cell in a DIV. This will tell you whether the text inside the DIV is larger than the cell:</p> <pre><code>&lt;div id='test' style='width:200px;height:100px;overflow:hidden'&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse at felis. Etiam ullamcorper. Aenean fr...
<p>This is for the web? If so, why not use a simpler method like using css to hide the overflow?</p>
44,892
<p>I am about to write junit tests for a XML parsing Java class that outputs directly to an OutputStream. For example <code>xmlWriter.writeString("foo");</code> would produce something like <code>&lt;aTag&gt;foo&lt;/aTag&gt;</code> to be written to the outputstream held inside the XmlWriter instance. The question is ho...
<p>Use a <a href="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html" rel="noreferrer">ByteArrayOutputStream</a> and then get the data out of that using <a href="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html#toByteArray()" rel="noreferrer">toByteArray()</a>. This won't t...
<p>If you can pass a Writer to XmlWriter, I would pass it a <code>StringWriter</code>. You can query the <code>StringWriter</code>'s contents using <code>toString()</code> on it.</p> <p>If you have to pass an <code>OutputStream</code>, you can pass a <code>ByteArrayOutputStream</code> and you can also call <code>toStr...
27,818
<p>Why the FontFamily param of the Font object is a string and not an enum?</p>
<p>FontFamily refers to the name of the Font. While you could use "monospace" or "serif" I wouldn't think it would be supported by .Net.</p> <p>Remember, using a enum would be impossible. A enum is a static compile-time feature, which means that it can't "generate" a enum dynamically from fonts on your system. Indeed,...
<p>Because an Enum is a set of fixed values that forces a re-compile when it changes (and in this case this would ultimately mean: a new release of the framework).</p> <p>Font families are subject to change and available fonts differ from host system to host system.</p>
47,263
<p>I have a business requirement that forces me to store a customer's full credit card details (number, name, expiry date, CVV2) for a short period of time.</p> <p>Rationale: If a customer calls to order a product and their credit card is declined on the spot you are likely to lose the sale. If you take their details,...
<p>Basically avoid by all means taking the responsiblity to save the CC details on your side, however I can assume you are using a thirdparty service to do your transaction such as PayPal/Verisign or whatever, most of them have API's that enables you to save CC credentials at their side, and they give you back a key th...
<p>I have a blog post that deals with this exact situation of storing sensitive data in the database. The blog post uses a String Encryptor class that I built using a Triple DES algorithm but you can plug in your own if you would like.</p> <p>The blog post contains the video and source code that was used. You can chec...
25,290
<p>On the reprap wiki it says using Znnn it sets a new axis position. But then it says &quot;No physical motion will occur&quot;. What would the line <code>G92 E0</code> be used for?</p>
<p>The <code>G92</code> command is used to set the start position (origin) of one of more axes (including the current extruder) to any arbitrary value. The command <code>G92 E0</code> is often used to perform retraction and nozzle priming. For example, the following commands are often used in start-gcode sequences (pro...
<p>To supplement the accepted answer, and answer a question in the answer's comments (which should not be there), consider the E value as another axis - the axis of the filament.</p> <p>If you executed:</p> <pre><code>G92 E0 ; Reset the extruder's origin G1 F200 E3 ; Extrude 3 millimetres of filament at a rate of 2...
717
<p>Could someone explain to me how Any-related annotations (<code>@Any</code>, <code>@AnyMetaDef</code>, <code>@AnyMetaDefs</code> and <code>@ManyToAny</code>) work in practice. I have a hard time finding any useful documentation (JavaDoc alone isn't very helpful) about these.</p> <p>I have thus far gathered that they...
<p>Hope this <a href="http://www.jroller.com/eyallupu/entry/hibernate_the_any_annotation" rel="noreferrer">article</a> brings some light to the subject:</p> <blockquote> <p>Sometimes we need to map an association property to different types of entities that don't have a common ancestor entity - so a plain po...
<p>Have you read <a href="http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#mapping-column-any" rel="nofollow noreferrer">the Hibernate Annotations documentation for @Any</a>? Haven't used that one myself yet, but it looks like some extended way of defining references. The link inc...
26,775
<p>Does anyone have any experience of developing external tools for SSMS 2005. </p> <p>Ideally I would like to be able to interact with the query windows directly, for example, taking the query text from the window to perform some processing on it.</p> <p>Any pointers in the right direction would be great.</p> <p>T...
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f2909f92-3517-49bc-9e86-c136299956bc/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f2909f92-3517-49bc-9e86-c136299956bc/</a></p> <blockquote> <p>As Richard said earlier in this thread, the "document-level"...
<p>Maybe this one will help <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5D3FECE9-74E0-4E19-AF98-AEDE2DF94F87&amp;displaylang=en&amp;displaylang=en" rel="nofollow noreferrer">Microsoft Visual Studio 2005 Tools for Office 2005 Runtime (VSTO 2005 RTM)</a></p> <blockquote> <p>The VSTO 2005 redistri...
35,249
<p>How can you relatively position elements in WPF? The standard model is to use layout managers for everything, but what if you want to position elements (on a Canvas, for example) simply based on the position of other elements?</p> <p>For example, you may want one element (say a button) to be attached the side of an...
<p>Good question. As far as I know, we need to have a different custom panel to get this feature. Since WPF is based on Visual Hierarchy there is no way to have this sort of Flat structure for the elements in the platform.</p> <p><strong>But Here is a trick to do this.</strong> Place your elements in the same positio...
<p>Good question. As far as I know, we need to have a different custom panel to get this feature. Since WPF is based on Visual Hierarchy there is no way to have this sort of Flat structure for the elements in the platform.</p> <p><strong>But Here is a trick to do this.</strong> Place your elements in the same positio...
19,124
<p>I am trying to scrape an html table and save its data in a database. What strategies/solutions have you found to be helpful in approaching this program.</p> <p>I'm most comfortable with Java and PHP but really a solution in any language would be helpful.</p> <p>EDIT: For more detail, the UTA (Salt Lake's Bus syste...
<p>It all depends on how properly your HTML to scrape is? If it's valid XHTML, you can simply use some XPath queries on it to get whatever you want.</p> <p>Example of xpath in php: <a href="http://blogoscoped.com/archive/2004_06_23_index.html#108802750834787821" rel="nofollow noreferrer">http://blogoscoped.com/archive...
<p>I have tried screen-scraping before, but I found it to be very brittle, especially with dynamically-generated code. I found a third-party DOM-parser and used it to navigate the source code with Regex-like matching patterns in order to find the data I needed.</p> <p>I suggested trying to find out if the owners of th...
9,886
<p>I should preface this by saying I'm working on a pocket PC app and the data files live on sd cards. </p> <p>I have an app that has to create an array of size x. malloc is failing every time. </p> <p>I've got a 1 gig file on a 4 gig card. <br> I've got 64 megs of onboard memory (ram/data/application/os)<br> I can'...
<p>You should create a file large enough for the array, suitably padded (according to GetSystemInfo), and the map the file with CreateFileMapping/MapViewOfFile.</p> <p>Atleast, that would be my first try - there might be restrictions on how large a mapped file can be on CE.</p>
<p>You'd need to create a window of n records (that will fit in memory) and move that window so as to keep the record(s) you're doing work on in it. I'm not fluent enough in mfc to give you a code sample, but it wouldn't be all that hard.</p> <p>In c# i'd write a custom IEnumerable&lt;T&gt;</p>
31,946
<p>After hours of debugging, it appears to me that in FireFox, the innerHTML of a DOM reflects what is actually in the markup, but in IE, the innerHTML reflects what's in the markup PLUS any changes made by the user or dynamically (i.e. via Javascript).</p> <p>Has anyone else found this to be true? Any interesting wor...
<p>I use jQuery's <a href="http://docs.jquery.com/Attributes/html" rel="noreferrer">.html()</a> to get a consistent result across browsers.</p>
<p>Using prototype and the $("thisid") syntax instead of document.getElementById("thisid") might do the trick for you. It worked for me.</p>
5,738
<p>I have the following query in iSeries SQL which I output to a file.</p> <pre><code>SELECT SSLOTMAK, SSLOTMDL, SSLOTYER, sum(SSCOUNT) FROM prqhdrss GROUP BY SSLOTMAK, SSLOTMDL, SSLotyer HAVING sum(SSCOUNT) &gt; 4 ORDER BY SSLOTMAK, SSLOTMDL, SSLOTYER ...
<p>Try this</p> <pre><code>SELECT SSLOTMAK, SSLOTMDL, SSLOTYER, cast(sum(SSCOUNT) as integer) FROM prqhdrss GROUP BY SSLOTMAK, SSLOTMDL, SSLotyer HAVING sum(SSCOUNT) &gt; 4 ORDER BY SSLOTMAK, SSLOTMDL, SSLOTYER </code></pre> <p>I've casted to integer because of the name of the column "count". If the column has floati...
<p>How are you trying to bring it to your PC? Most iSeries methods I know will automatically convert that to a PC-readable format.</p>
21,273
<p>We make infrastructure services (data retrieval and storage) and small smart client applications (fancy reporting mostly) for a commercial bank. Our team is large, 40 odd contractual employees that are C# .NET programmers. We support 50 odd applications and systems that we have developed. </p> <p>A few members of t...
<p>WPF UI's are easier to design implement and maintain than the current C# alternatives, so if a lot of your codebase is responsible for handling UI, migrating may serve beneficial-- as in, you'll find your team will save time in dealing with their UI layer. If most of your code is business logic, it won't help all th...
<p>I think the key word from your original question is "fancy". If your customers really expect a lot of glitter in the deliverable, then you probably do have something to gain from switching to WPF.</p>
10,214
<p>I'm using Visual Studio 2008 Team Development Edition and my Project properties page will not display. I right-clicked the project name and selected "Properties" and no page displayed as it normally would. Also, when I double-click the Settings.settings the normal Settings GUI does not display. I only see the XM...
<p>It appears that the uninstallation of an add-on is what caused my problem. Reinstalling Visual Studio did not seem to help, so I took extreme measures and reformatted my machine.</p>
<p>The properties page can be displayed when not doing anything else.</p> <p>Try going to View -> Properties Window and see if its displayed. Or try the keyboard shortcut CTRL-W, P</p>
28,596
<p>I would like to know how do you determine the hardware needed for a server?</p> <p>I have a DB Server running MySQL, and now I want to buy a server, but I don't know what hardware specification that I need. This is a server for a hosting a web page.</p> <p><strong>EDIT:</strong> The software it's just MySQL Server...
<p>It all depends on how much load is expected on the application. But as a minimum, I'd go for 2 x cpu or multi-core single cpu, at least 4GB RAM and a decent RAID controller. Depending on your performance and storage requirements - I'd start off with RAID 1 (Mirror) and extend that to RAID 10 (Mirrored stripes) acr...
<p>It depends entirely on the nature of the application(s) it will be hosting, and the load it'll put the server under (now and in the future).</p> <p>When I'm 'spec'ing a server, I always buy the best spec I can afford.</p> <p>I generally buy quite a standard spec, except for a database server when I try and get the...
46,878
<p>I need to write some Prolog programs for a class.</p> <p>Any recommendations?</p>
<p>Prolog mode for (X)Emacs.</p> <p>See <a href="http://bruda.ca/emacs-prolog/" rel="noreferrer">http://bruda.ca/emacs-prolog/</a></p>
<p>Honestly, I can't see an 'IDE' helping out much on prolog. It'll only aid in finding syntax errors. The rest is in the debugging and the thought process. </p> <p>Get syntax-highlighting with any editor and you're set to go.</p>
35,850
<p>I have tried the following two statements:</p> <ul> <li><code>SELECT col FROM db.tbl WHERE col (LIKE 'str1' OR LIKE 'str2') AND col2 = num</code> results in a syntax error</li> <li><code>SELECT col FROM db.tbl WHERE page LIKE ('str1' OR 'str2') AND col2 = num</code> results in "Truncated incorrect DOUBLE value: str...
<blockquote> <pre><code>SELECT col FROM db.tbl WHERE (col LIKE 'str1' OR col LIKE 'str2') AND col2 = num </code></pre> </blockquote>
<p>In recent versions of SQL you can use the <code>IN</code> operator:</p> <pre><code>SELECT col FROM db.tbl WHERE col IN('str1','str2') AND col2 = num </code></pre>
29,781
<p>EDIT:</p> <p>Is there any other phone systems that allow connecting into the native messaging system to read input in the composer? </p>
<p>There is absolutely no way to do this in standard J2ME.</p> <p>Symbian phones will allow you to write C++ code that comes close to doing what you describe.</p> <p>You may not be able to directly query the text editor GUI control for its content but you can create your own messaging module and have your own message...
<p>5310 is Series 40 based so I would assume that you can't capture input from the native messaging composer. The S40 platform is fairly closed.</p>
29,250
<p>I have this code:</p> <pre><code>chars = #some list try: indx = chars.index(chars) except ValueError: #doSomething else: #doSomethingElse </code></pre> <p>I want to be able to do this because I don't like knowfully causing Exceptions:</p> <pre><code>chars = #some list indx = chars.index(chars) if in...
<p>Note that the latter approach is going against the generally accepted "pythonic" philosophy of <a href="http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Exceptions" rel="nofollow noreferrer">EAFP, or "It is Easier to Ask for Forgiveness than Permission."</a>, while the former follows it.</p>
<p>For the specific case where your list is a sequence of single-character strings you can get what you want by changing the list to be searched to a string in advance (eg. ''.join(chars)).</p> <p>You can then use the .find() method, which does work as you want. However, there's no corresponding method for lists or t...
15,952
<p>Can anyone please let me know the procedure to perform silent installation of SQL Server Express 2005 and the way to specify the installation parameters.</p>
<p>Get the MSI and do</p> <pre><code>string InstallFile = "SSCERuntime-ENU-x86.msi" string LogFile = "C:\Install.log" Process proc; proc = Process.Start("msiexec", "/l " + LogFile + " /quiet /i " + InstallFile); </code></pre>
<p>Thanks for a prompt reply , I would try it , but i am loooking something like this for SQL EXPRESS <a href="http://msdn.microsoft.com/en-us/library/ms144259.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms144259.aspx</a></p>
33,993
<p>Since IronPython doesn't support attributes I am wondering if there is another way to decorate IronPython classes with attributes, perhaps with reflection?</p>
<p>First, try with boost::signal anyway. Don't assume it will not be fast enough until you try in your specific case that is your application</p> <p>If it's not efficient enough, maybe something like <a href="http://www.codeproject.com/KB/cpp/FastDelegate.aspx" rel="nofollow noreferrer">FastDelegate</a> will suit your...
<p>An another option can be <a href="https://github.com/yigityuce/YSignalSlot" rel="nofollow">YSignalSlot</a>. I used it. I think it is pretty good.</p>
46,969
<p>I want to serve a lot of big files in a Plone site. By big files I mean around 5MB (music) and a lot of them. I've already do it straight to the ZODB, not a good idea. I'm running Plone 3.1.1 and Zope 2.10.6.</p>
<p>Zodb blob support is the best, most integrated way to deal with large files. Big files are stored transparently on the filesytem instead of in the zodb object database. "Transparently" in this case means that you won't notice it in your actual programming work after initial configuration.</p> <p>The blob functional...
<p>I have plone.app.blob installed on some low-traffic sites and installable (ready to roll, if you like) for my busier production sites in the same instance.</p> <p>There's the 4.0 milestone but I'll certainly review (and probably click the install button for plone.app.blob on my production sites) around 3.4 time. </...
8,993
<p>What would you consider best practice for organizing JUnit tests in a project, and why? For example, do you keep your tests next to the classes they test? Do you put them in a separate but parallel package structure? Do you use a different organization strategy entirely?</p>
<p>I use a separate but parallel package structure for several reasons.</p> <ol> <li>It keeps tests organized the same way as the application code. <li>I can easily build just the application files for distribution. <li>Test code still has access to my application code. <li>It's not as cluttered as having test code mi...
<p>as Bill the Lizard said,</p> <p>it helps to have a parallel structure so that 1) I can ship a src.zip or src.tar.gz and leave out the unit tests 2) At a version control system level, you can put hooks on who changes source code and who changes only unit tests</p> <p>"Disadvantage"<br> You cannot seal your JAR file...
22,220
<p><em>Edit: <br>My problem is not a problem anymore: I have redo my performances tests and I have do a fatal stupid error: I had forget a x1000 to get seconds from milliseconds :/ Sorry for that guys.<br> For info: <br> - I do some 1900 updates per second from my PC to the DataBase server on local network.<br> -...
<p>This should run a little faster:</p> <pre><code>public void InsertUser(IEnumerable&lt;string&gt; userCodes) { using (SqlConnection sqlConnection = new SqlConnection(this.connectionString), SqlCommand sqlCommand = new SqlCommand("InsertUser", sqlConnection)) { sqlCommand.CommandType = Syste...
<p>Have you considered passing an XML document to a stored procedure, then iterating through that to find the data to insert?</p>
24,537
<p>How do I use <code>RelativeSource</code> with WPF bindings and what are the different use-cases?</p>
<p>If you want to bind to another property on the object:</p> <pre><code>{Binding Path=PathToProperty, RelativeSource={RelativeSource Self}} </code></pre> <p>If you want to get a property on an ancestor:</p> <pre><code>{Binding Path=PathToProperty, RelativeSource={RelativeSource AncestorType={x:Type typeOfAncest...
<p>This is an example of the use of this pattern that worked for me on empty datagrids.</p> <pre><code>&lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding Items.Count, RelativeSource={RelativeSource Self}}" Value="0"&gt; &lt;Setter Property="Background"&gt; &lt;Setter.Value&gt; ...
10,982
<p>Is it better convention to use hyphens or underscores in your URLs?</p> <p>Should it be <code>/about_us</code> or <code>/about-us</code>?</p> <p>From usability point of view, I personally think <strong>/about-us</strong> is much better for end-user yet Google and most other websites (and javascript frameworks) use u...
<p><a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=76329" rel="noreferrer">From Google Webmaster Central</a></p> <blockquote> <p>Consider using punctuation in your URLs. The URL <a href="http://www.example.com/green-dress.html" rel="noreferrer">http://www.example.com/green-dress....
<p>Personally, I'd avoid using about-us or about_us, and just use about.</p>
14,512
<p>Sometimes it feels that my company is the only company in the world using Ruby but not Ruby on Rails, to the point that Rails has almost become synonymous with Ruby.</p> <p>I'm sure this isn't really true, but it'd be fun to hear some stories about non-Rails Ruby usage out there.</p>
<p>One of the huge benefits of Ruby is the ability to create DSLs very easily. Ruby allows you to create "business rules" in a natural language way that is usually easy enough for a business analyst to use. Many Ruby apps outside of web development exist for this purpose. </p> <p>I highly recommend Googling "ruby dsl"...
<p>I haven't done any non-Rails Ruby web dev, but all of my <a href="http://projecteuler.net/" rel="nofollow noreferrer">Project Euler</a> solutions are in Ruby, as well as some other small projects, like my <a href="http://lucasoman.com/files/code/rubot/" rel="nofollow noreferrer">IRC bot</a>.</p>
18,159
<p>I'm trying to add a feature to my AIR app that can listen for (configurable) global keyboard events even when the app is minimized. Ex: CTRL-ALT-SHIFT-F12 to grab a screenshot.</p> <p>I can't find any way to register a keyboard hook, and listening for keyboard events only captures them when the app has focus. Sugge...
<p>I don't think that Adobe Air programs can process keypress events unless the application is in focus.</p> <p><a href="http://forums.adobe.com/thread/420446" rel="nofollow noreferrer">http://forums.adobe.com/thread/420446</a></p> <p>Even <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdeta...
<p>I'm testing my Air application in Flash CS5 and I need to disable keyboard shortcuts so I can test my own shortcuts. I can get ctrl-F to work, but ctrl-C will not.</p> <p>I notice that my keyboard shortcuts WILL work if it's a standard AS3 file that I'm testing.</p>
48,394
<p>I'm having a weird cross-browser flash problem. Please see the screenshot below. I have seen this behaviour before, but I cannot recall what the cause was. Can someone please tell me why this happens, and possible actions I can take to fix it?</p> <p><img src="https://i.stack.imgur.com/KDy17.png" alt="flash problem...
<p>Definately need more info to give a full answer. </p> <p>&lt;begin complete guess&gt;</p> <p>It looks like the IE flash player version is not high enough to properly play the flash file. It looks like it is loading the first frame (which has all of the assets laid out on it to aid with pre-loading). Then, the Acti...
<p>It was due to bad embedding on my part, as 81bronco suggested. I started using SWFObject and all was well!</p>
16,555
<p>How to cancel a keypress event in a textbox after pressing the return key.</p>
<p>Set the Handled property of KeyPressEventArgs handler parameter to true.</p> <p>Example from msdn:</p> <pre><code>private void keypressed(Object o, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { e.Handled = true; } } </code></pre> <p>See <a href="http://msdn.microsoft.com/en-us/l...
<p>Do you mean, you want it to ignore the enter key ?</p> <p>You could add a keydown event and ignore the enter key there...</p> <pre><code>private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; } } </code></...
29,288
<p>I have an immutable class with some private fields that are set during the constructor execution. I want to unit test this constructor but I'm not sure the "best practice" in this case.</p> <p><strong>Simple Example</strong></p> <p>This class is defined in Assembly1:</p> <pre><code>public class Class2Test { ...
<p>Nothing, unless you are using that field. You don't want over-specification via tests. In other words, there is no need to test that the assignment operator works.</p> <p>If you are using that field in a method or something, call that method and assert on that.</p> <p>Edit: </p> <blockquote> <p>assume the con...
<p>I have properly enabled <code>[InternalsVisibleTo]</code> on Assembly1 (code) so that there is a trust relationship with Assembly2 (tests).</p> <pre><code>public class Class2Test { private readonly string _StringProperty; internal string StringProperty { get { return _StringProperty; } } public Class2T...
15,877
<p>I am using VB.Net WinForms. I would like to call the Adobe Reader 9 ActiveX control to print some PDFs. I have added the ActiveX control to the VS toolbox (the dll is AcroPDF.dll, the COM name "Adobe PDF Reader". After some experiment the following code works.</p> <pre><code>Dim files As String() = Directory.Get...
<p>Using this method to print multiple documents is not going to work good as you found.</p> <p>Having it work is quite tricky but here is a general description of the solution.</p> <p>I use System.Diagnostics.Process to print using myProcess.StartInfo.Verb = "Print" Then I check the Status and State of printer queue...
<p>You can use this code to display any file with its appropriate software.</p> <pre><code>Sub Show_Document(ByVal FILENAME As String) Dim p As Process = Nothing Try If My.Computer.FileSystem.FileExists(FILENAME) Then p = Process.Start(FILENAME) p.Dispose() End If C...
28,944
<p>I am currently using MediaWiki as a documentation website, with login authenticated by LDAP.</p> <p>However, we have hit a snag. Certain pages contain sensitive information. For example links that say "click here to log in". I would like to be able to protect certain pages from being edited by just anyone. I wou...
<p>The major security hole I would see anywhere, C/C++ included, would be not using a standard, open CGI library, not reading its documentation, and thinking you're secure anyway.</p> <ul> <li>don't re-invent the wheel. Use a CGI library. Some languages have this built-in (PHP probably does), others have it included...
<p>Many sites are CGI based. Many PHP sites that are located on hosting are run in CGI mode - mod_php is hard to used in shared environment - no suid.</p> <p>In general, running as CGI has lower performance, but better for security - you have no access to webserver internals (as with mod_perl and mod_php) so using vul...
25,836
<p>I have been hearing and reading about Agile for years. I own a book or two on it and I like the idea.</p> <p>I am finally in a position where I could roll something like this out where I work, but I have serious concerns about whether it's the way to go for us:</p> <ul> <li>Isn't there a minimum size for this? Big...
<p>I don't think one methodology can rule them all. I am sorry. I am a firm believer in finding the right model for the right project. For example how would you feel if your were into surgery and you knew the machine which was keeping you alive was developed in a rapid iterative cycle with little design upfront.</p> <...
<p>I would suggest against Agile when developing a new air traffic control system.</p>
45,356
<p>[1] In JDBC, why should we first load drivers using Class.forName("some driver name"). Why SUN didnt take care of loading driver within the getConnection() method itself.If I pass driver name as a parameter to the getConnection() method. </p> <p>[2] I want to understand JBDC internals.Any pointers towards it are ap...
<p>With JDBC 4, you no longer need to use Class.forName(...) see <a href="http://www.artima.com/lejava/articles/jdbc_four.html" rel="nofollow noreferrer">here</a> for one article explaining this:</p> <blockquote> <p>Connection to a database requires that a suitable JDBC database driver be loaded in the client's VM. In ...
<p><em>Toolkit</em> was right. Since JDBC 4.0 there is a mechanism that drivers will automatically register themselves using the <strong>J2SE Service Provider</strong>. Unfortunately not all JDBC vendors did update their drivers to do so. I also think that currently there are not that much JDBC drivers supporting JDBC ...
33,799
<p>I have a rails model that looks something like this:</p> <pre><code>class Recipe &lt; ActiveRecord::Base has_many :ingredients attr_accessor :ingredients_string attr_accessible :title, :directions, :ingredients, :ingredients_string before_save :set_ingredients def ingredients_string ingredien...
<p>While your solution should work, it can be difficult to read depending on the skill level of your fellow programmers. Additionally, it moves functionality away from the call site. Which can make maintenance a little more difficult.</p> <p>I'm not sure if your goal is to get the keys into a vector or print them to ...
<blockquote> <p>(I'm always wondering why std::map does not include a member function for us to do so.)</p> </blockquote> <p>Because it can't do it any better than you can do it. If a method's implementation will be no superior to a free function's implementation then in general you should not write a method; you s...
13,539
<p>Is it possible to display the text in a TextBlock vertically so that all letters are stacked upon each other (not rotated with LayoutTransform)?</p>
<p>Nobody has yet mentioned the obvious and trivial way to stack the letters of an arbitrary string vertically (without rotating them) using pure XAML:</p> <pre class="lang-xml prettyprint-override"><code>&lt;ItemsControl ItemsSource="Text goes here, or you could use a binding to a string" /&gt; </code></pre> <p>Th...
<p>I will offer a solution based on the converter:</p> <pre class="lang-cs prettyprint-override"><code>using System; using System.Collections.Generic; using System.Globalization; using System.Windows.Data; using System.Windows.Markup; namespace Converters { [ValueConversion(typeof(object), typeof(string))] pub...
45,526
<p>I've run on a little problem today: I have a JS drop down menu and when I inserted a GoogleMap... the Menu is rendered behind the Google Map... Any ideas on how to chance the z Index of the Google Map?</p> <p>Thanks!</p>
<p>If your problem happens in Internet Explorer, but it renders the way you'd expect in FireFox or Safari, <a href="http://aplus.rs/lab/z-pos/" rel="nofollow noreferrer">this link</a> was extraordinarily helpful for me with a <a href="https://stackoverflow.com/questions/88883/yui-autocomplete-renders-under-other-page-e...
<p><code>z-index</code> (especially in Internet Explorer 7) really didn't work for me. I tried many different combination's of high vs. low map z-indices but had no joy.</p> <p>By far the simplest/quickest answer for me was to re-arrange my mark-up/css to have my flyouts/rollovers listed in the mark-up <strong>above/b...
11,215
<p>I was having some issues with printing, most noticeably in this picture:</p> <p><img src="https://i.imgur.com/oCKwkBj.jpg" alt="Noticeable layers in print" title="Noticeable layers in print" /></p> <p>The layers are very noticeable and sometimes have gaps, and the overhangs don't print very well (although the former...
<p>The main issue here (the gaps between layers) was solved by reducing combing.</p> <p>Combing was enabled without a limit on the range so a max combing distance of 10&nbsp;mm was introduced. This prevented too much filament from oozing out during travels.</p> <p>The oozing filament was causing nothing to come out o...
<p>These lines could be caused by a mechanical issue with the printer; it looks as if the positioning is not up to par. </p> <p>This can be related to loose belts of the X-axis and Y-axis, or play in your system, e.g. look at the rollers of the carriage.</p> <hr> <p><em>I've experienced an issue with play between th...
1,430
<p>What is an efficient way to implement a singleton design pattern in Java?</p>
<p>Use an enum:</p> <pre><code>public enum Foo { INSTANCE; } </code></pre> <p>Joshua Bloch explained this approach in his <a href="http://sites.google.com/site/io/effective-java-reloaded" rel="noreferrer">Effective Java Reloaded</a> talk at Google I/O 2008: <a href="http://www.youtube.com/watch?v=pi_I7oD_uGI#t=28...
<p>Sometimes a simple "<strong><code>static Foo foo = new Foo();</code></strong>" is not enough. Just think of some basic data insertion you want to do.</p> <p>On the other hand you would have to synchronize any method that instantiates the singleton variable as such. Synchronisation is not bad as such, but it can lea...
9,612
<p>I've read all the marketing speak about how mvc and webforms are complementary etc... </p> <p>However it seems that all the blogs talk about is mvc and the only news coming out is about mvc. </p> <p>Is Microsoft going to continue to IMPROVE webforms as a first class citizen or will it just be a supported technolog...
<p>I was at a conference (Remix 08) and Scott Gu said they will definatly be continuing to support both methods and that MVC was not appropriate for every application. Scott said there were a number of coming improvements for web forms model (although didnt say what they were).</p> <p>The web forms model will not disa...
<p>Before word of the MVC framework started spreading, we spent a good deal of time at my company developing our own .NET MVC framework.</p> <p>This was because we didn't want to be constrained by the limitations of the WebForms abstraction - we wanted to avoid the 'clunky' feel and user interface compromises that Web...
24,423
<p>I have two code bases of an application. I need to copy all the files in all the directories with .java from the newer code base, to the older (so I can commit it to svn).</p> <p>How can I write a batch files to do this?</p>
<p>XCOPY /D ?</p> <pre><code>xcopy c:\olddir\*.java c:\newdir /D /E /Q /Y </code></pre>
<p>If you've lots of different instances of this problem to solve, I've had some success with <a href="http://ant.apache.org/" rel="nofollow noreferrer">Apache Ant</a> for this kind of copy/update/backup kind of thing.</p> <p>There <em>is</em> a bit of a learning curve, though, and it <em>does</em> require you to have...
12,185
<p>I have Windows Server 2008 installed on a Sony laptop and the brightness control doesn't work. I'd like to write a program to allow me to change it.</p> <p>Currently what I have to do is open the Power control panel, click advanced settings, and fight through so many UAC boxes that anybody watching me must think I'...
<p>I looked up <a href="https://stackoverflow.com/questions/373297/what-api-call-would-i-use-to-change-brightness-of-laptop-net/373308#373308">John Rudy</a>'s link to <a href="http://msdn.microsoft.com/en-us/library/aa394549.aspx" rel="nofollow noreferrer">WmiSetBrightness</a> in MSDN and came up with this:</p> <pre><...
<p>To add to DaEagles answer, the <a href="http://www.pinvoke.net/" rel="nofollow noreferrer">http://www.pinvoke.net/</a> site can be a life saver when working with win32-apis in .Net. If the information does not exist there, please add it when you have made a succesful interop for .Net.</p>
48,818
<p>In one of my applications, I am querying active directory to get a list of all users below a given user (using the "Direct Reports" thing). So basically, given the name of the person, it is looked up in AD, then the Direct Reports are read. But then for every direct report, the tool needs to check the direct reports...
<p>In order to take control over the properties that you want to be cached you can call 'RefreshCache()' passing the properties that you want to hang around:</p> <pre class="lang-c# prettyprint-override"><code>System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry(); ...
<p>Active Directory is pretty efficient at storing information and the retrieval shouldn't be that much of a performance hit. If you are really intent on storing the names, you'll probably want to store them in some sort of a tree stucture, so you can see the relationships of all the people. Depending on how the numb...
5,327
<p>I setup my own open id provider on my personal server, and added a redirect to https in my apache config file. When not using a secure connection (when I disable the redirect) I can log in fine, but with the redirect I can't log in with this error message:</p> <p>The underlying connection was closed: Could not est...
<p>The primary benefit of using SSL for your OpenID URL is that it gives the relying party a mechanism to discover if DNS has been tampered with. It's impossible for the relying party to tell if an OpenID URL with a self-signed certificate has been compromised.</p> <p>There are other benefits you get from using SSL o...
<p>It sounds like it. The client of your OpenID server doesn't trust the root certification authority. </p>
15,923
<p>What's the best way to get a list of users that are assigned to a SharePoint portal?</p>
<p>It depends on exactly what list of users you want.</p> <p>All users that exist in a SharePoint web (but don't necessarily have permission):</p> <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.allusers.aspx" rel="noreferrer">SPWeb.AllUsers</a></p> <p>Users that exist in a SharePoint ...
<p>FYI, here's the way that I figured out how to do what I was looking for:</p> <pre><code>Dim Site As New SPSite("SiteURL") Dim AllUsers As SPUserCollection = Site.RootWeb.AllUsers Dim u As SPUser For Each u In AllUsers Response.Write(u.LoginName &amp; " " &amp; u.Name &amp; " " &amp; u.Email &amp; "&lt;br /&gt;"...
42,698
<p>I recently migrated a website to a new CMS (Umbraco). A lot of the links have changed, but they can be easily corrected by searching for patters in the url, so I would like to write something that will redirect to the correct page if the old one is not found. That part isn't a problem. </p> <p>How can I obtain the ...
<p>I do basically the same thing you ask in a custom 404 error handling page. On IIS 6 the original URL is in the query string. The code below shows how to grab the original URL and then forward the user. In my case I switched from old ASP to new ASP.NET, so all the .asp pages had to be forwarded to .aspx pages. Al...
<p>Update, you actually want to pick up:</p> <p>VB.NET:</p> <pre><code>Request.QueryString("aspxerrorpath") </code></pre> <p>C#:</p> <pre><code>Request.QueryString["aspxerrorpath"]; </code></pre>
18,112
<p>How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.</p> <p><em>Edit: These use...
<p>this won't make the taskbar button flash in changing colours, but the title will blink on and off until they move the mouse. This should work cross platform, and even if they just have it in a different tab.</p> <pre><code>newExcitingAlerts = (function () { var oldTitle = document.title; var msg = "New!"; ...
<blockquote> <p><i>These users do want to be distracted when a new message arrives.</i></p> </blockquote> <p>It sounds like you're writing an app for an internal company project. </p> <p>You might want to investigate writing a small windows app in .net which adds a notify icon and can then do fancy popups or balloo...
5,782
<p>I'm looking for a GPS with a good API. I would like to be able to send an address to it, and tell it to navigate to that address. I also need to pull the current location from the GPS. I'd like to be able to do this with the GPS hooked up to a laptop by bluetooth or even just a USB cable.</p> <p>I've looked at t...
<p>If you want to talk to a Garmin GPS, you can check out their <a href="http://developer.garmin.com" rel="nofollow noreferrer">developer website</a>. They've got resources ranging from talking to Web Services all the way to doing low-level Serial &amp; USB I/O to interface directly with the devices.</p>
<p>I presume that by GPS you mean Satellite Navigation? Most GPS units don't offer the turn-by-turn capability required to navigate effectively on roads, or the underlying road map data for that matter.</p> <p><strong><em>updated:</em></strong> OK, since Garmin are by far the biggest dog in the yard, I'd recommend tak...
3,133
<p>I want to compare the current value of an in-memory Hibernate entity with the value in the database:</p> <pre><code>HibernateSession sess = HibernateSessionFactory.getSession(); MyEntity newEntity = (MyEntity)sess.load(MyEntity.class, id); newEntity.setProperty("new value"); MyEntity oldEntity = (MyEntity)sess.load...
<p>Two easy options spring to mind:</p> <ol> <li>Evict oldEntity before saving newEntity</li> <li>Use session.merge() on oldEntity to replace the version in the session cache (newEntity) with the original (oldEntity)</li> </ol> <p><strong>EDIT</strong>: to elaborate a little, the problem here is that Hibernate keeps ...
<p>What about using session.isDirty()? The JavaDoc says that method will answer the question "Would any SQL be executed if we flushed this session?" Of course, that would only work if you had a new clean Session to start with. Another option - just use two different Sessions.</p>
22,116
<p>I am trying to create an XML file based on data fields from a table, and I want to have the nodes named based on the value in a field from the table. The problem is that sometimes values entered in that column contain spaces and other characters not allowed in Node names.</p> <p>Does anyone have any code that will ...
<p>Here's what happened... in ASP.NET 1.1, there was an error in the WebUIValidation.js file (supplied by microsoft and created when you run aspnet_regiis.exe), in function ValidatorCommonOnSubmit. It seems the method was missing a return statement!! If you modify this file and insert "return event.returnValue" at the...
<p>I remember back in the day with 1.1 Visual Studio used to destroy my event handler hookups occasionally.</p> <p>If you are using Visual Studio 2003, make certain that the "generated" code still contains the event handler wireup for your control.</p>
11,034
<p>When your domain layer or business layer (whatever you want to call it) is completely separate from your UI, how does it gather the information it needs to complete a request?</p> <p>For example, suppose the UI issues a request to add a line to a purchase order, and the business rules determine that you need an aut...
<p>"... the business rules determine that you need an authorization code for some reason. How does the domain layer communicate this back?"</p> <p>That's what an API is for. You have several choices.</p> <ol> <li><p>The business rule API simply lists the various things the business rules need. The UI is responsible...
<p>The presenter or the controller, depending if you do MVC or MVP should know about it, not the domain, the domain will assert ( defensive coding ) is as all needed values ok, or throw an exception, not ask for it. </p> <p>So let say you don't supply the number, your model throw a AuthorizationNumberRequiredException...
49,138
<p>I have an Excel table with several items 1, 2, 3..., each of which has subitems 1.1, 1.2, etc. I'm using the list of subitems as my key column and populating the main items using vlookups, but only showing each main item once.</p> <pre><code>/| A | B | C | -+---------+----------+----------+ 1| I...
<p>Extending Jon Fournier's answer, I've changed the range calculation to look for non-blank cells and added code to turn off the warning dialog that Merge throws up. I also changed the function to Public so I could run it from the Macros dialog.</p> <pre><code>Public Sub AutoMerge() Dim LastRowToMergeTo As Long Dim ...
<p>This is possible using VBA, thought I don't know if you can do it without VBA. Basically what you would do is every time your worksheet calculates you run the code to re-merge the cells.</p> <p>I built a simple spreadsheet similar to yours and put the following code in the sheet's code module:</p> <pre><code>Priv...
43,892
<p>I am Attempting to print this, from Blender <a href="https://i.stack.imgur.com/kKdun.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kKdun.jpg" alt="enter image description here"></a> But Cura decides to fill in the middle part of the model. <a href="https://i.stack.imgur.com/1fj3T.png" rel="nofo...
<p>Try disabling the &quot;Union Overlapping Volumes&quot; option on Mesh Fixes section. Worked for me.</p>
<p>I would recommend using an actual CAD/CAM program, such as Autodesk Fusion 360, instead of using a 3d model program. Not only will this be able to directly export you finished model to Cura, and the models are made in a way that works with a 3d printing slicer, there will be more help around 3D printing for it.</p> ...
1,593
<p>We seem to have a few developers here who think creating stored procedures that spit out HTML or Javascript code is a legitimate thing to do. In my mind this is the ultimate abuse of the separation of concerns model. Is doing something like this people have often seen people doing?</p>
<p>Horribly wrong! Just my opinion though. </p>
<p>This is a classic novice error. </p> <p>If you have to put mark up in SP output, you should at least use your own standardized encoding and then have the application process it into HTML/Javascript. </p> <p>For example </p> <pre><code>"&lt;javascriptpopup&gt;[outputuotputoutput]&lt;/javascriptpopup&gt;" </code></...
30,984
<p>I'm working on an online tool for students in my faculty to calculate their final grade for their degrees, and for a while I've had little problems. Students seem to like using the new UI and I've suffered no criticism for a while. Now, I need to add some functionality to the program, meaning the UI will have to cha...
<p>Funny. I'm in that very spot right now. Our web-based system has a UI that was designed around solid usability concepts and the users LOVE it. (over 1000 users and lots and lots of feedback).</p> <p>But the marketers hammer me about once a year to make the system "more sexy" because "they can't sell it". Now I main...
<p>Ideally when you first design your UI you create something flexible enough to add any feature you want in the future. In the real world, this is seldom the case. I would say UI updates should be slow and incremental if at all possible (that was the real problem with the facebook change, one big change all of a sud...
37,108
<p>What are the dangers of giving the Network Service account read/write permissions to your ASP.NET Web application? I have to do this for any directory that my app needs to write to like App_Data for my VistaDb database and some random directories to uplaod images and make changes to text files, etc. What is the da...
<p>The biggest security risk of giving the Network Service Account write permissions to folders is experienced in <strong>Shared Hosting</strong> or when you run multiple websites on the same server.</p> <p>Basically, if you grant modify permissions then every other ASP.NET application that server configured to run as...
<p>Ok, so if I can figure out how to get your application to write a file to the filesystem, because you granted read/write to the <em>entire</em> application's virtual directory, I can now write an aspx file you your website, invoke it and run arbitrary code, including cool things like WMI calls and COM interop.</p> ...
49,160
<p>Well the subject is the question basically. Are there any version control systems out there for 3d models. An open source approach would be preferred of course.</p> <p>I am looking for functionality along the lines of subversion however more basic systems would be of interest as well. Basic operations like branchin...
<p>This is going to be difficult since most 3D CAD programs do not take into account the possibility of revision, so when you load something and then save it again it may completely re-order the points (there are reasons for this, usually done for performance).</p> <p>Further, large models represented in a text format...
<p>I was under the impression that SVN is perfect for any kind of project that uses text files. So if your model is made up of text files, then it would be fine. </p> <p>I don't see how binary data would work, as all version control that I know of makes use of diff management, which uses text comparisons.</p>
6,337
<p>I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, h...
<p>Here's some code I worked up to draw a visual to a bitmap. You may be able to adapt this to your needs, and draw the bitmap by adorning the UIElement that represents a common ancestor of the two list views. Note the use of FrameworkElement.TransformToAncestor to get the coordinates of a nested element in terms of ...
<p>OK, you could try taking a Visual element and setting it's background to a visualbrush of your ListItem and animate that to the other list box. You can wait for the storyboard completed event to actually do the switch. If this were me, I would animate from one box only to the edge of the other. If the switch happ...
49,089
<p>I'm trying to complete the last part of my Haskell homework and I'm stuck, my code so far:</p> <pre><code>data Entry = Entry (String, String) class Lexico a where (&lt;!), (=!), (&gt;!) :: a -&gt; a -&gt; Bool instance Lexico Entry where Entry (a,_) &lt;! Entry (b,_) = a &lt; b Entry (a,_) =! Entry (...
<p>A binary search needs random access, which is not possible on a list. So, the first thing to do would probably be to convert the list to an <code>Array</code> (with <code>listArray</code>), and do the search on it.</p>
<p>An important Prelude operator is:</p> <pre><code>(!!) :: [a] -&gt; Integer -&gt; a -- xs!!n returns the nth element of xs, starting at the left and -- counting from 0. </code></pre> <p>Thus, <code>[14,7,3]!!1</code> ~~> 7.</p>
37,422
<p>I have an automated test running on my program that generates some large MPG files along with other files. After running the test, I have the script clean up after itself. The other files (a mix of binary and text files) are removed with no problems. The MPG files, however, don't get deleted. If I try and manual...
<p>Is it possible that Explorer is holding onto the files to generate thumbs.db and perform its other work? I ask that because I've noticed considerable lag as Explorer evaluates <em>every</em> movie file in my media directories, even when in Details view. (You can tell, because the address bar of that Explorer window ...
<p>It sounds like something is still hanging on to a reference to the file. Is it possilbe that you have shadow copy set up and it is trying to archive the file?</p>
25,181
<p>In C#, what is the difference (if any) between these two lines of code?</p> <pre><code>tmrMain.Elapsed += new ElapsedEventHandler(tmrMain_Tick); </code></pre> <p>and</p> <pre><code>tmrMain.Elapsed += tmrMain_Tick; </code></pre> <p>Both appear to work exactly the same. Does C# just assume you mean the former when...
<p>I did this</p> <pre><code>static void Hook1() { someEvent += new EventHandler( Program_someEvent ); } static void Hook2() { someEvent += Program_someEvent; } </code></pre> <p>And then ran ildasm over the code.<br> The generated MSIL was exactly the same.</p> <p>So to answer your question, yes they are th...
<p>I think the one way to really tell would be to look at the MSIL produced for the code.. Tends to be a good acid test..</p> <p>I have funny concerns that it may somehow mess with GC.. Seems odd that there would be all the overhead of declaring the new delegate type if it never needed to be done this way, you know?</...
4,653
<p>I have a database with a table which is full of conditions and error messages for checking another database.</p> <p>I want to run a loop such that each of these conditions is checked against all the tables in the second database and generae a report which gives the errors.</p> <p>Is this possible in ms access.</p>...
<p>Here is some more sample code. It illustrates the use of two different types of recordsets. You may wish to read <a href="http://allenbrowne.com/ser-29.html" rel="nofollow noreferrer">VBA Traps: Working with Recordsets</a> by Allen Browne and <a href="http://support.microsoft.com/kb/286335" rel="nofollow noreferrer"...
<p>When you say "report", do you mean an Access Report, or would writing to a file or Access Form work?</p> <p>You can create a function or sub in a Module to do this. Open a recordset on your querycrit table and spin through the records dynamically building and running the SQL for the records table. You can write the...
28,840
<p>Whilst refactoring some old code I realised that a particular header file was full of function declarations for functions long since removed from the .cpp file. Does anyone know of a tool that could find (and strip) these automatically?</p>
<p>You could if possible make a test.cpp file to call them all, the linker will flag the ones that have no code as unresolved, this way your test code only need compile and not worry about actually running.</p>
<p>If you index to code with Doxygen you can see from where is each function referenced. However, you would have to browse through each class (1 HTML page per class) and scan for those that don't have anything pointing to them.</p> <p>Alternatively, you could use ctags to generate list of all functions in the code, an...
12,545
<p>I'm having a similar issue to <a href="https://3dprinting.stackexchange.com/questions/1207/how-to-remove-a-pla-print-stack-to-a-buildtak-sheet">this one</a>: I have retrofitted my printer with a BuildTak sticker. I'm printing PLA at 60°C bed temperature - currently using a 0.3 mm nozzle, but I had similar issues wit...
<p>Try printing with the heated printbed off. Heat makes the pla stick more to buildtak</p>
<p>These are more like backups for when the part gets stuck, but you could try spraying that part where it meets the bed with liquid computer duster. The shrinkage from cooling usually helps to release the part from the bed. You could also try heating the bed very hot to save the bed at the expense of the part.</p>
554
<p>I have seen many examples, with many 'no, you missed something' comments. What is the right way to match an e-mail address?</p> <p>For Sanity sake, only fully-qualified domain names, no @localhost allowed. (or, both ways)</p> <p>Subdomains must be allowed (issac@deptartment.company.museum)</p>
<p><a href="http://ex-parrot.com/~pdw/Mail-RFC822-Address.html" rel="noreferrer">This</a> regular expression complies with the grammar described in <a href="http://www.faqs.org/rfcs/rfc2822.html" rel="noreferrer">RFC 2822</a>, it's very long, but the grammar described in the RFC is complex...</p>
<p>I had to recently build some RSS feeds, and part of that included going over the Xml schema, including the items for Webmaster and ManagingEditor, both of which are defined as an e-mail address matching this pattern:</p> <pre><code>([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|...
25,904
<p>There are multiple Ruby implementations in the works right now. Which are you looking forward to and why? Do you actively use a non-MRI implementation in production?</p> <p>Some of the options include:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/Ruby_MRI" rel="nofollow noreferrer">Ruby MRI (original 1.8 branc...
<p><a href="http://ruby.gemstone.com/" rel="noreferrer">Maglev</a>. It will have the speed benefit of all the optimization that has gone into a major Smalltalk VM over many, many year. Plus it will automatically persist all your data pretty much automatically so there is no more need to monkey around with Object-Relati...
<p>What about Enterprise Ruby? This has been out there for a while.</p> <p><a href="https://www.phusionpassenger.com/enterprise" rel="nofollow">https://www.phusionpassenger.com/enterprise</a></p>
9,582
<p>I'm looking for a good, well designed flow of a UK postcode lookup process as part of registration for an eCommerce account.</p> <p>We're redesigning ours and want to see what is out there and how I can make it as friendly as possible.</p> <p>--Update--</p> <p>Basically our current design was a manual entry form ...
<p>Either way, please make sure you include a manual address override (ie allow the user to enter their address without the aid of a look-up). I live at a newly built address and it's not yet showing up on everyone's databases. I'm unable to register with eCommerce sites about 50% of the time. Very annoying.</p> <p...
<p>To do the lookup properly you have to use the Postal Address File (PAF) from the post office. It is expensive and there are restrictions on where you can use it - you can't include it in products. But it does list the correct address for each house.</p>
16,166
<p>How do I fix a broken debugger, one that just won't start, in <a href="http://www.eclipseme.org/" rel="nofollow noreferrer">EclipseME</a> (now Mobile Tools Java)?</p> <p>(This question has an answer which will be transferred from another question soon)</p>
<p>The most annoying issue with EclipseME for me was the "broken" debugger, which just wouldn't start. This is covered in docs, but it took me about an hour to find this tip when I first installed EclipseME, and another hour when I returned to JavaME development a year later, so I decided to share this piece of knowled...
<p>most debuggers are just plug-ins that also have a command-line interface; try running the debugger from the command-line and see if it works. If it does, then check the plug-in configuration; you may have to re-install the plug-in.</p> <p>caveat: I have not used EclipseME, but had similar problems with the Gnu C de...
9,311
<p>I've got a WCF Web Service method whose prototype is:</p> <pre><code>[OperationContract] Response&lt;List&lt;Customer&gt;&gt; GetCustomers(); </code></pre> <p>When I add the service reference to a client, Visual Studio (2005) creates a type called "ResponseOfArrayOfCustomerrleXg3IC" that is a wrapper for "Response...
<p>You can define your own name in the <code>DataContract</code> attribute like this:</p> <pre><code>[DataContract(Name = "ResponseOf{0}")] public class Response&lt;T&gt; </code></pre> <p>Note that in your example the <code>{0}</code> will be replaced and your proxy reference type will be <code>ResponseOfArrayOfCusto...
<p>Yes. The OperationContractAttribute takes a parameter called Name. You could specify it like this:</p> <pre><code>[OperationContract(Name = "NameGoesHere")] Response&lt;List&lt;Customer&gt;&gt; GetCustomers(); </code></pre>
20,763
<p>I have a 3D printer built from generic, scrap parts. It's controlled by a 2+ years old <code>MKS GEN L</code> board running Marlin version <code>1.1.x</code>.</p> <p>I want to do a complete bed assembly replacement, including:</p> <ul> <li>Heated bed</li> <li>Thermistor</li> <li>Y-carriage</li> </ul> <p>All the hard...
<h1>The surface won't work</h1> <p>The only true-metallic surface treatments I know to be actual metal in large enough amounts to conduct electricity would be leafmetal, akin to leaf gold, and electroplating. However, you can't use the procedures for stainless steels, and even then, the thickness is in the tenth of a µ...
<p>No rust but has magnetic properties? You could try varnishing the iron filled PLA.</p>
1,855
<p>For a Silverlight 2 webapp. I added a combobox. I have an IEnumerable as Itemsource to populate the combobox. Works fine.</p> <p>But I would like to add an extra item ("please select a....") to the combobox, anyone an idea how this can be done using the Silverlight 2 combobox.</p> <p>Any more info about using a te...
<p>You can easily insert an item at a desired index location in the Items collection of the ComboBox using the following code.</p> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; TextBlock t = new TextBlock();</p> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; t.Text = "Please select....";</p> &nbsp;&nbsp;&n...
<p>Just add that in Xaml page and make it selected to True....</p>
26,031
<p>I'm researching possible options how to organize data storage for an Erlang application. The data it supposed to use is basically a huge collection of binary blobs indexed by short string ids. Each blob is under 10 Kb but there are many of them. I'd expect that in total they would have size up to 200 Gb so obviously...
<p><a href="http://dukesoferl.blogspot.com/2008/06/tokyocabinet-and-mnesia.html" rel="noreferrer">tcerl</a> came out of facing the same size limit. I'm not using Erlang these days but it sounds like what you're looking for.</p>
<p>Mnesia can store data on disk just fine. There's also dets (disk based term storage) which is roughly analogous to Berkeley DB. It's in the standard lib: <a href="http://www.erlang.org/doc/apps/stdlib/index.html" rel="nofollow noreferrer">http://www.erlang.org/doc/apps/stdlib/index.html</a></p>
36,535
<p>I have been told that there is a performance difference between the following code blocks.</p> <pre><code>foreach (Entity e in entityList) { .... } </code></pre> <p>and </p> <pre><code>for (int i=0; i&lt;entityList.Count; i++) { Entity e = (Entity)entityList[i]; ... } </code></pre> <p>where</p> <pre><cod...
<p>foreach creates an instance of an enumerator (returned from GetEnumerator) and that enumerator also keeps state throughout the course of the foreach loop. It then repeatedly calls for the Next() object on the enumerator and runs your code for each object it returns.</p> <p>They don't boil down to the same code in a...
<p>I think one possible situation where you <em>might</em> get a performance gain is if the enumerable type's size and the loop condition is a constant; for example:</p> <pre><code>const int ArraySize = 10; int[] values = new int[ArraySize]; //... for (int i = 0; i </pre> <p>In this case, depending on the complexit...
6,593
<p>Does anyone know of a sample distributed application (.NET or J2EE) using RMI or Web Services?</p>
<p>As often, Sun has an excellent tutorial on RMI: <a href="http://java.sun.com/docs/books/tutorial/rmi/index.html" rel="nofollow noreferrer">http://java.sun.com/docs/books/tutorial/rmi/index.html</a></p>
<p>Another powerful bare bone working RMI example that loads dynamic objects from the client to server and execute it there then return the results. This can easily expanded for full featured distributed computing environment.</p> <p><a href="http://www.ningzhang.info/example.java.rmi.ComputeEngine" rel="nofollow nore...
21,384
<p>A remote site is supplying a data structure in a js file.</p> <p>I can include this file in my page to access the data and display it in my page.</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript" src="http://www.example.co.uk/includes/js/data.js"&gt;&lt;/script&gt; &lt;/head&gt; </code></pre> <p>D...
<p>You should GET that file directly, via, for example, <a href="http://php.net/curl" rel="nofollow noreferrer">CURL</a>. Then parse it, if it comes in JSON, you can use <a href="http://es.php.net/manual/en/function.json-decode.php" rel="nofollow noreferrer">json-decode</a>.</p> <p>Simple example (slightly modified ve...
<p>You can grab the file via CURL or some other HTTP downloading library/function. Then, parse the data. If you're lucky, the data is in a JSON format and you can use a PHP function to convert it into a PHP array. Then, iterate through the items in the array, inserting each into your database.</p>
42,304
<p>I have two spreadsheets... when one gets modified in a certain way I want to have a macro run that modifies the second in an appropriate manner. I've already isolated the event I need to act on (the modification of any cell in a particular column), I just can't seem to find any concrete information on accessing and...
<p>In Excel, you would likely just write code to open the other worksheet, modify it and then save the data.</p> <p>See <a href="http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=302" rel="noreferrer">this tutorial</a> for more info.</p> <p>I'll have to edit my VBA later, so pretend this is pseudocode, but...
<p>You can open a spreadsheet in a single line:</p> <pre><code>Workbooks.Open FileName:="\\the\share\file.xls" </code></pre> <p>and refer to it as the active workbook:</p> <pre><code>Range("A1").value = "New value" </code></pre>
7,398
<p>Can the performance of this sequential search algorithm (taken from <a href="http://books.google.co.uk/books?id=to6M9_dbjosC&amp;dq=the+practice+of+programming&amp;pg=PP1&amp;ots=3YH6Ggq0_a&amp;sig=F2-ajdO37xA4iRec2sCyQF55Jjc&amp;hl=en&amp;sa=X&amp;oi=book_result&amp;resnum=1&amp;ct=result" rel="noreferrer">The Pra...
<p>Yes, but only very slightly. A much bigger performance improvement can be achieved by using better algorithms (for example keeping the list sorted and doing a binary search).</p> <p>In general optimizing a given algorithm only gets you so far. Choosing a better algorithm (even if it's not completely optimized) can ...
<pre><code>/* there is no more quick */ int lookup(char *word, char*array[]) { int i; for(i=0; *(array++) != NULL;i++) if (strcmp(word, *array) == 0) return i; return -1; } </code></pre>
3,665
<p>We have some Win32 console applications running on Windows Server 2003 Service Pack 2 that regularly fail with this:</p> <blockquote> <p>Error 1450 (<code>ERROR_NO_SYSTEM_RESOURCES</code>): "Insufficient system resources exist to complete the requested service."</p> </blockquote> <p>All the documentation we've f...
<p>Can you try the windbg command "!sysptes" to get System PTE Information? I'm not sure if you can do this with live kernel debug, you may have to get a memory dump.</p>
<p>I'm not sure why you assume that <code>ERROR_NO_SYSTEM_RESOURCES</code> is caused <em>only</em> by running out of free System Page Table Entries ? As far as I know, such generic error codes are used for more than one resource type. And in fact, the first Google hit suggests that running out of file cache memory may ...
8,354
<p>In a <a href="https://stackoverflow.com/questions/168408/c-alternatives-to-void-pointers-that-isnt-templates">related question</a> I asked about creating a generic container. Using polymorphic templates seems like the right way to go.</p> <p>However, I can't for the life of me figure out how a destructor should be ...
<p>I'd recommend if you want to store pointers to complex types, that you use your container as: <code>MyContainer&lt;shared_ptr&lt;SomeComplexType&gt; &gt;</code>, and for primitive types just use <code>MyContainer&lt;float&gt;</code>.</p> <p>The <code>shared_ptr</code> should take care of deleting the complex type a...
<p>It can be done, but this is pretty advanced stuff. You'll need to use something like the boost MPL library (<a href="http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/index.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/index.html</a>) so that you can get MyContainer's destructor t...
20,450
<p><strong>EDIT:</strong> Modified title and added update.<br></p> <p><strong>UPDATE</strong>: <em>We no longer believe this is a 64bit vs 32bit problem. We have found that the only people that were seeing this, were people that were set in the farm policy as "full control." (Not acting as System Account) Once we te...
<p><em>"Word on the street"</em> is you can't mix 32bit and 64bit servers on the same farm (with the exception of the database server).</p> <p><a href="http://technet.microsoft.com/en-us/library/cc261700.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc261700.aspx</a> says:</p> <blockquote...
<p>Peter, thanks much for the additional information. I will be asking the MVP about this.</p> <p>This webpart is the only thing giving us a problem on the 64bit WFE. Everything else is working fine. We have other custom code (webparts, event receivers, content types ... and so on) that have no problems running in ...
26,999
<p>What tools are there that I can test out a WCF service?</p> <p>I am expecting allot of load so I want to have an idea how much a single server can handle.</p>
<p><a href="http://www.codeplex.com/WCFLoadTest" rel="noreferrer">WCFLoadTest</a> all the way. I've even talked to MS guys who swear by this tool.</p> <p>Visual Studio also has some load testing tools available, but I cannot vouch for how well they do their job, nor can I say which versions of VS contain the load test...
<p>Try <a href="http://www.soapui.org/" rel="nofollow">http://www.soapui.org/</a> there's an open source and pro version you will need to tick download loadui, which is your load test bit.</p>
27,370
<p>We have two web servers with load balancing. We need to share some files between those servers. These would be uploaded files, session files, various files that php applications create.</p> <p>We don't want to use a heavyweight, no longer maintained or a commercial solution. We're looking for some lightweight open-...
<p>OCFS may be up to snuff by now; it's worth checkout out at least. It's in the mainline linux kernel tree, <a href="http://oss.oracle.com/projects/ocfs2/" rel="nofollow noreferrer">http://oss.oracle.com/projects/ocfs2/</a> has some info on it. I've set it up before, it was pretty easy to get going.</p>
<p>DRBD is good for syncing over a network (direct crossover connection if at all possible), but EXT3 is not designed to be aware of changes that occur underneath it, at the block device level. For that reason you need a filesystem designed for such purposes such as the Global File System (GFS). To the best of my knowl...
39,244
<p>I'm very early in the iPhone development learning process. I'm trying to get my head around various pieces. Right now I've just taken the basic NavigationController template and I'm trying to create a simple grouped table view with a couple of text fields. What I can't seem to do is to get Interface Builder to al...
<p>You can create the cell with Interface Builder, but you have to make it a top-level object, rather than a child of the table view. Then you can return this cell in your view controller's <strong>tableView:cellForRowAtIndexPath:</strong> function.</p> <p>Make sure to give the cell an <strong>identifier</strong> in I...
<p>Unfortunately, it doesn't really work that way - the cells in the tableview are generated by the delegate at run-time. It turns out to be very straightforward code, though. Check out the tableview example code, it's pretty easy to follow.</p>
16,292
<p>I have an unusual situation in which I need a SharePoint timer job to both have local administrator windows privileges and to have <code>SHAREPOINT\System</code> SharePoint privileges.</p> <p>I can get the windows privileges by simply configuring the timer service to use an account which is a member of local admini...
<p>I'm not at work so this is off the top of my head, but: If you get a reference to the Site, can you try to create a new SPSite with the SYSTEM-UserToken?</p> <pre><code>SPUserToken sut = thisSite.RootWeb.AllUsers["SHAREPOINT\SYSTEM"].UserToken; using (SPSite syssite = new SPSite(thisSite.Url,sut) { // Do what ...
<p>Other applications if run this way (i.e. from a timer job with explicit credentials) are failing the same way with "The application failed to initialize propely". I just worte a simple app which takes a path of another executable and its arguments as parameres and when run from that timer job it fails the same way.<...
2,578
<p>Does any body know what powers Google Charts? I have been using it for a while but not sure what Google used to build it. </p>
<p>Everything at google is done in C++, Java, or Python. I'm guessing the internals is probably done in one of the latter two.</p>
<p>Probably just libraries they have written themselves, it's pretty easy to throw together a chart drawing library, but hard to do it right. So someone hacked together a custom java/C++/python library using already available stuff to be able to update the graphics of his charts easily, and then it extended.</p> <p>Th...
14,663
<p>I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example:</p> <pre><code>foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" if goo =~ /value of foo here dynamically/ puts "success!" end </code></pre>
<p>Same as string insertion.</p> <pre><code>if goo =~ /#{Regexp.quote(foo)}/ #... </code></pre>
<pre><code>foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" puts "success!" if goo =~ /#{foo}/ </code></pre>
18,087
<p>I'm new to developing things on the web. So far, I'm spending a lot of time (50% or so) to try and prevent bad people from putting things like sql injection into my input forms and validating it server side. Is this normal? </p>
<p>To prevent sql injection attacks just do your queries with prepared statements (the exact way will depend on your platform). Once you do that, you'll never have to bother with this particular aspect again. You just need to use this <em>everywhere</em>.</p> <p>As for general input validation, it's always good to rel...
<p>Just a note on prepared statements. First of all, you should try to use stored procedures if you can... they are probably a better solution in most cases.</p> <p>Secondly, they both protect you from SQL injection only as long as you don't use dynamic SQL, that is, SQL that writes more SQL and then executes it. In t...
13,572
<p>I've got this python dictionary "mydict", containing arrays, here's what it looks like :</p> <pre><code>mydict = dict( one=['foo', 'bar', 'foobar', 'barfoo', 'example'], two=['bar', 'example', 'foobar'], three=['foo', 'example']) </code></pre> <p>i'd like to replace all the occurrences of "example" b...
<pre><code>for arr in mydict.values(): for i, s in enumerate(arr): if s == 'example': arr[i] = 'someotherword' </code></pre>
<p>Here's another take:</p> <pre><code>for key, val in mydict.items(): mydict[key] = ["someotherword" if x == "example" else x for x in val] </code></pre> <p>I've found that building lists is <strong>very</strong> fast, but of course profile if performance is important.</p>
33,755
<p>I thought I'd get myself a Subversion setup at home for my hobby projects, and I'm trying to do it right, first time (my work's source control control policies or lack of them are, well, not perfect).</p> <p>The thing I'm struggling with is this: I'd like to version entire Eclipse projects. This will be good from...
<p>There are basically two ways to instruct subversion to ignore files either by name or by pattern.</p> <p>The first way is to find the configuration file (location depends on platform) and add the file name or pattern to the global-ignores list. This applies to all svn operations on the machine or for that user.</p>...
<p>If you on a linux box, you can try these steps, if on windows, pretty the installer shall do things for you. <a href="https://help.ubuntu.com/community/Subversion" rel="nofollow noreferrer">https://help.ubuntu.com/community/Subversion</a> </p> <p>Also the subversion book might help <a href="http://svnbook.red-bean....
40,699
<p>I'm currently using msbuild for a solution of over 600 projects. </p> <p>Imagine I change the code for 1 library that is used by 10 projects. Instead of providing all 600 projects to msbuild and let it compile all of them and figure out the dependencys. I was wondering if there was a program or library I could u...
<p>Have you tried <a href="http://www.drewnoakes.com/code/dependancyanalyser/" rel="noreferrer">.NET assembly dependency analyser</a>?. </p> <p>It is open source, and the graph output in <a href="http://www.graphviz.org/doc/info/lang.html" rel="noreferrer">dot script</a> might be what you need. An example from the sit...
<p><a href="http://msbuildtasks.tigris.org/" rel="nofollow noreferrer">MSBuild Tasks</a> doesn't have what you're looking for, but it will give you an easy entry point for writing your own tasks.</p>
46,456
<p>Is tilde a legitimate character in an XML SOAP message? I get a <code>SAXParseException:Content not allowed in prolog</code>. I included most of the SOAP message just in case I'm barking up the wrong tree.</p> <pre><code>POST /... HTTP/1.0 Content-Type: text/xml; charset=utf-8 Accept: application/soap+xml, applica...
<p>I'm not sure about SOAP messages, but when processing XML files, one other possible reason for this error message is if there is a <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark" rel="nofollow noreferrer">BOM (byte order marker)</a> at the beginning of the file - some XML parsers can't handle that if not conf...
<blockquote> <p>Is tilde a legitimate character in an XML SOAP message?</p> </blockquote> <p>Yes. The error message points to another error source (“prolog”). Is the HTTP header perhaps part of the code sent to the SAX parser, as in your code sample?</p>
39,948
<p>Not sure exactly how to word this question ... so edits are welcomed! Anyway ... here goes.</p> <p>I am currently use Crystal Reports to generated Pdfs and just stream the output to the user. My code looks like the following:</p> <pre><code>System.IO.MemoryStream stream = new System.IO.MemoryStream(); stream = ...
<p>Usually, via the content-disposition header - i.e.</p> <pre><code>Content-Disposition: inline; filename=foo.pdf </code></pre> <p>So just use Headers.Add, or AddHeader, or whatever it is, with:</p> <p>response.Headers.Add("Content-Disposition", "inline; filename=foo.pdf");</p> <p>(inline is "show in browser", att...
<pre><code>System.IO.MemoryStream stream = new System.IO.MemoryStream(); stream = (System.IO.MemoryStream)this.Report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); this.Response.Clear(); this.Response.Buffer = true; this.Response.ContentType = "application/pdf"; this.Response.AddHeader("...
45,091
<p>I'm trying to set up part of a schema that's like a "Sequence" where all child elements are optional, but at least one of the elements <strong>must</strong> be present, and there could be more than one of them.</p> <p>I tried doing the following, but XMLSpy complains that "The content model contains the elements &l...
<p>Try this:</p> <pre><code>&lt;xs:choice&gt; &lt;xs:sequence&gt; &lt;xs:element name="Elem1" /&gt; &lt;xs:element name="Elem2" minOccurs="0" /&gt; &lt;xs:element name="Elem3" minOccurs="0" /&gt; &lt;/xs:sequence&gt; &lt;xs:sequence&gt; &lt;xs:element name="Elem2" /&gt; &lt;xs:element name="E...
<p>@hurst,</p> <p>Unfortunately you have failed to understand the original question. Placing minOccurs="1" on the choice is satisfied automatically when ALL elements that have minOccurs="0" are contained as options.</p> <p>Thus you have failed to account for the "at least one" required by the original poster, because...
12,546
<p>I need to estimate the code coverage of a test set. The tests are run on a J2ME application, on a physical device. MIDP 2.1, CLDC 1.1 and JSR-75 FileConnection are available. As J2ME is (roughly) a subset of J2SE, tools using java.io.File (like those listed in the only answer so far..) can not be used.</p> <p>This ...
<p>There's lots of Java code coverage tools. Many of them work by using JVM features not available in embedded systems due to space limitations.</p> <p>One that uses only an additional boolean array in which to hold the coverage data can be found at</p> <p><a href="http://www.semanticdesigns.com/Products/TestCoverag...
<p>Here's a slew of alternatives.</p> <p><a href="http://java-source.net/open-source/code-coverage" rel="nofollow noreferrer">http://java-source.net/open-source/code-coverage</a></p>
12,032
<p>How to Creat Charts with the Google Chart API in asp.net?</p>
<p>Google is a good place to start...</p> <p><a href="http://pietschsoft.com/post/2007/12/Google-Charts-API-an-ASPNET-20-Server-Control.aspx" rel="nofollow noreferrer">Google Charts API as ASP.NET 2.0 Server Control</a></p> <p><a href="http://www.codeplex.com/GoogleChartNet" rel="nofollow noreferrer">Google Chart Net...
<p>Please refer the article on 4guysfromrolla</p> <p><a href="https://web.archive.org/web/20210612113532/https://aspnet.4guysfromrolla.com/articles/111908-1.aspx" rel="nofollow noreferrer">Creating charts with Google chart API with ASP.NET</a></p> <p><a href="https://web.archive.org/web/20210616113733/https://aspnet....
45,370
<p>Is their a way to access a web server such as windows server 2003 installed on a virtual box such as vmware from the host machine?</p>
<p>If VMware is set to use bridged networking, then each guest OS effectively has its own IP address, like brien said, you just point your browser to that address.</p>
<p>Yes, you should just be able to point to the IP address of the VM. </p> <p>How is your VM networking configured?</p>
12,801
<p>I just lost 50% of my answer on a test because I wrote the code out instead of an algorithm on my midterm, bumping me from an A to a C. Is writing code out still considered an algorithmic representation?</p> <p><a href="http://en.wikipedia.org/wiki/Algorithm#Expressing_algorithms" rel="nofollow noreferrer">Wikipedi...
<p>You may want to give an example. If your code focuses too much on language specifics that are not part of the algorithm, then Understandably, it could be said you had non-algorithm mixed with your algorithm, resulting in an incorrect result. </p> <p>I Feel for the reasoning, the whole point of learning is to show y...
<p>All I know is you shouldn't write any code until after you have an algorithim.</p>
33,039
<p>Is it possible that Microsoft will be able to make F# programs, either at VM execution time, or more likely at compile time, detect that a program was built with a functional language and automatically parallelize it better? </p> <p>Right now I believe there is no such effort to try and execute a program that was ...
<p>I think this is unlikely in the near future. And if it does happen, I think it would be more likely at the IL level (assembly rewriting) rather than language level (e.g. something specific to F#/compiler). It's an interesting question, and I expect that some fine minds have been looking at this and will continue to...
<p>There's active research for autoparallelization and auto vectorization for a variety of languages. And one could hope (since I really like F#) that they would concive a way to determine if a "pure" side-effect free subset was used and then parallelize that. Also since Simon Peyton-Jones the father of Haskell is work...
17,337