instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>How would you solve this problem?</p>
<p>You're scraping HTML of blogs. Some of the HTML of a blog is blog posts, some of it is formatting, sidebars, etc. You want to be able to tell what text in the HTML belongs to which post (i.e. a permalink) if any.</p>
<p>I know what you're thinking: You could just look at th... | <p>I would create a scraper for each of the major blogging engines. Start with the main text for a single post per page.</p>
<p>If you're lucky then the engine will provide reasonable XHTML, so you can come up with a number of useful XPath expressions to get the node which corresponds to the article. If not, then I'm ... | <p><strong>RSS</strong> is actually quite simple to parse using XPath any XML parser (or regexes, but that's not recpmmended), you're going through the <item> tags, looking for <title>, <link>, <description> .</p>
<p>You can then post them as different fields in a database, or direcrtly merge ... | 47,723 |
<p>If I have an issue with my FLSUN printer how can I contact customer support?</p>
| <p>They have a webpage by now <a href="http://www.flsun3d.com" rel="noreferrer">www.flsun3d.com</a></p>
| <p>I have had good luck contacting them via AliExpress <a href="https://flsun.aliexpress.com/store/2383013" rel="nofollow noreferrer">https://flsun.aliexpress.com/store/2383013</a> even though I bought my printer on Amazon. </p>
| 1,681 |
<p>The following code says that passing the map as <code>const</code> into the <code>operator[]</code> method discards qualifiers:</p>
<pre><code>#include <iostream>
#include <map>
#include <string>
using namespace std;
class MapWrapper {
public:
const int &get_value(const int &key) cons... | <p><a href="http://en.cppreference.com/w/cpp/container/map/operator_at" rel="noreferrer"><code>std::map</code>'s <code>operator []</code> is not declared as <code>const</code>, and cannot be due to its behavior:</a></p>
<blockquote>
<p>T& operator[] (const Key& key)</p>
<p>Returns a reference to the val... | <p>First, you should not be using symbols beginning with _ because they are reserved to the language implementation/compiler writer. It would be very easy for _map to be a syntax error on someone's compiler, and you would have no one to blame but yourself.</p>
<p>If you want to use an underscore, put it at the end, n... | 32,904 |
<p>Can I load an stand alone aspx page in another stand alone aspx page using System.Reflection? </p>
<p>I am using the ASP.NET 2.0 Web site project model.</p>
| <p>Try using <a href="http://msdn.microsoft.com/en-us/library/system.web.compilation.buildmanager.createinstancefromvirtualpath.aspx" rel="noreferrer">BuildManager.CreateInstanceFromVirtualPath</a>. Sample usage:</p>
<pre><code>Page p = BuildManager.CreateInstanceFromVirtualPath("~/Default.aspx", typeof(Page))
</code>... | <p>Don't know about doing it using Reflection, which may well be possible, but you can capture the output of an aspx or asp page to a string writer using HttpContext.Server.Execute().<br>
I have used this for rendering some complex email templates, but don't know if that is quite what you are after.</p>
| 49,274 |
<p>I might be missing something really obvious. I'm trying to write a custom Panel where the contents are laid out according to a couple of dependency properties (I'm assuming they <em>have</em> to be DPs because I want to be able to animate them.)</p>
<p>However, when I try to run a storyboard to animate both of thes... | <p>It's a documented bug with Silverlight 2 Beta 2. You can't animate two custom dependancy properties on the same object.</p>
| <p>I would try commenting out the InvalidateArrange in the OnPropertyChanged and see what happens.</p>
| 8,776 |
<p>How do I compare two dates in Lingo? To be specific, I want to know if today's date is after some fixed date. I know I can create the fixed date by using:</p>
<pre><code>date("20090101")
</code></pre>
<p>and I can get the current date using:</p>
<pre><code>_system.date()
</code></pre>
<p>but I can't seem to dire... | <p>Instead of _system.date(), try _movie.systemDate(), it will return a date object that you can safely compare with another one.</p>
<p>if _movie.systemDate() > date("20090101") then</p>
<pre><code>--do something
</code></pre>
<p>end if</p>
<p>regards</p>
| <p>I ended up doing the following. Inelegant, but it works:</p>
<pre><code> if (_system.date().char[1..2] >= 01 and _system.date().char[4..5] >= 01 and _system.date().char[7..10] >= 2010) then
alert("Your license has expired. Please contact the Company to renew your license.")
_player.quit()
end if... | 45,368 |
<p>I am using a class <code>Foo</code> that provides these methods:</p>
<pre><code>String overloadedMethod(Object)
String overloadedMethod(Goo)
</code></pre>
<p>Since Java statically dispatches on the non-receiver argument, I cannot just pass my <code>value</code> (which is an <code>Object</code>, but might have dyna... | <p>Of course you could always use reflection to find the most specific version of the method that applies, but that could get hairy real quick.</p>
<p>But if those two calls result in entirely different behaviour, then Foo is either designed to be used in a visitor pattern (i.e. with double dispatch) or it is broken.<... | <p>You could take a look at <a href="http://www-igm.univ-mlv.fr/~forax/works/jmmf/index.html" rel="nofollow noreferrer">the Java MultiMethod Framework</a>. It's pretty much a layer around what you're proposing, but atleast it's abstracted into a logical module that's not your responsibility?</p>
<p>(As far as I'm awar... | 48,450 |
<p>Lets say on my page I have this function:</p>
<pre><code> function ReturnFoo(bar)
{
return bar.toString() + "foo";
}
</code></pre>
<p>Now, I would like to have this called from ASP .NET, hopefully with the ASP .NET AJAX framework, as I am already using it in this codebase (I have already spent the 100k, might... | <p>Yeah, this is a difficult one. Using MS Ajax will help you out a bit. You'll need to push in code from the server to call this function upon page load and assign the return value to a hidden field that can be accessed by the server on post back.</p>
<p>I must say that this solution sucks, but I don't know another... | <p>I don't see how you expect server-side code to call a client-side function???</p>
<p>AJAX calls are from the client-side to the server-side!</p>
| 21,689 |
<p>Normally, in Delphi one would declare a function with a variable number of arguments using the 'array of const' method. However, for compatibility with code written in C, there's an much-unknown 'varargs' directive that can be added to a function declaration (I learned this while reading Rudy's excellent '<a href="... | <p>OK, I see the clarification in your question to mean that you need to implement a C import in Delphi. In that case, you need to implement varargs yourself.</p>
<p>The basic knowledge needed is the C calling convention on the x86: the stack grows downwards, and C pushes arguments from right to left. Thus, a pointer ... | <p>Delphi doesn't let you implement a varargs routine. It only works for importing external cdecl functions that use this.</p>
<p>Since varargs is based on the cdecl calling convention, you basically need to reimplement it yourself in Delphi, using assembly and/or various kinds of pointer manipulation.</p>
| 38,194 |
<p>I use <a href="http://docs.jquery.com/Plugins/Treeview" rel="nofollow noreferrer">jquery tree plugin</a> to render hierarchical data. </p>
<p>I have coded additional functions which would allow user to interact with this data (like adding/deleting nodes, swapping nodes, etc...)</p>
<p>Currently this plugin support... | <p>I found some workaround as given below,</p>
<p>Once the node is swapped up, virtually add its previous node to its child,</p>
<p>$("#browser").treeview({add:$("#topnd2").insertBefore(previous).next()});</p>
<p>If node is swapped down, virtuall add the current node to its next node.</p>
<p>$("#browser").treeview(... | <p>If you try to refresh the treeview again after node removal, the link will work but not the [+] or [-] icon. Tried this on several browsers..</p>
| 34,121 |
<p>I read everywhere that business logic belongs in the models and not in controller but where is the limit?
I am toying with a personnal accounting application. </p>
<pre><code>Account
Entry
Operation
</code></pre>
<p>When creating an operation it is only valid if the corresponding entries are created and linked to ... | <blockquote>
<p>but then the model will create and store instances of other models which is where my problem is.</p>
</blockquote>
<p>What is wrong with this? </p>
<p>If your 'business logic' states that an Operation must have a valid set of Entries, then surely there is nothing wrong for the Operation class to kno... | <p>It's easier to think in terms of each entity validating itself, and entities which depend on one another delegating their state to the state of their associated entries. In your case, for instance:</p>
<pre><code>class Operation < ActiveRecord::Base
has_many :entries
validates_associated :entries
end
</code>... | 8,974 |
<p>I have an old C library with a function that takes a void**:</p>
<pre><code>oldFunction(void** pStuff);
</code></pre>
<p>I'm trying to call this function from managed C++ (m_pStuff is a member of the parent ref class of type void*):</p>
<pre><code>oldFunction( static_cast<sqlite3**>( &m_pStuff ) );
</c... | <p>EDIT: Fixed answer, see below.</p>
<p>Really you need to know what oldFunction is going to be doing with pStuff. If pStuff is a pointer to some unmanaged data you can try wrapping the definition of m_pStuff with:</p>
<pre><code>#pragma unmanaged
void* m_pStuff
#pragma managed
</code></pre>
<p>This will make th... | <p>Thanks for the advice, the pointer is to an C style abstract structure which I think if I leave that structure exposed to the managed code is going to cause further pain due to its lack of defined structure. So what I think I will do is wrap the C library in C++ and then wrap the C++ wrapper with managed C++, which... | 4,672 |
<p>I bought an ASP.NET script about a year ago to retrieve FedEx shipping values. It builds an XML string that passes to the FedEx server using an HttpWebRequest, then parses the raw XML. The average response time for the script is about 900 milliseconds. </p>
<p>So the other day I was poking around in the FedEx ... | <p>You can find a good article and a library to start with here: <a href="http://www.codeproject.com/KB/COM/opcdotnet.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/COM/opcdotnet.aspx</a></p>
| <p>If buying a comercial toolkit is an option I've used the Northern Dynamics <a href="http://www.nordyn.com/Main/Products/Main.htm" rel="nofollow noreferrer">server toolkit</a> and it worked fine. A toolkit will take away a lot of the issues mentioned in the other questions (or at least you should get support if there... | 9,234 |
<p>When an <code>AutoCompleteExtender</code> is displayed in IE6 it seems to ignore z-index and renders below any select controls (like <strong>dropdownlists</strong>) in IE6.</p>
<pre><code><asp:TextBox ID="TextBox1" runat="server" />
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
... | <p>Nothing renders below select controls in IE6. It's one of the many "features" microsoft bestowed upon us when they gifted IE to the world</p>
<p>You have to hide them, then re-show them.</p>
<p>Observe the <a href="http://code.google.com/p/nucleus-plugins/source/browse/lightbox2/trunk/lightbox2/js/lightbox.js#205"... | <p>Nothing renders below select controls in IE6. It's one of the many "features" microsoft bestowed upon us when they gifted IE to the world</p>
<p>You have to hide them, then re-show them.</p>
<p>Observe the <a href="http://code.google.com/p/nucleus-plugins/source/browse/lightbox2/trunk/lightbox2/js/lightbox.js#205"... | 6,711 |
<p>First, a couple operating parameters:</p>
<ul>
<li>.NET development using Visual Studio 2005/2008</li>
<li>TortoiseSVN client</li>
</ul>
<p>I've only primarily worked with Visual Source Safe and SourceGear Vault source control systems. In each, I map the root of the repository to a local working directory. For e... | <p>The Subversion "check out" operation creates a <em>new</em> working copy. What you probably want to do is check out your whole project (which automatically creates the proper directory structure as it is in the repository), then use the Subversion "update" operation. The update will update everything in the specifie... | <p>Not sure why you want to do what you are asking. Most people just create a working local copy, and work on whatever directory they want. That's because of the way Subversion works. It doesn't lock the source code. I started source control by using SourceSafe, so I have a little bit of an idea of what you are going t... | 30,968 |
<p>What is the difference between </p>
<pre><code>if(null==object)
</code></pre>
<p>and </p>
<pre><code>if(object==null)
</code></pre>
<p>Please give the advantage for using the above.</p>
| <p>The difference comes if you accidentally type <code>=</code> instead of <code>==</code>:</p>
<p><code>if (null = object)</code> - Compiler error<br>
<code>if (object = null)</code> - Bug!</p>
| <p>In many languages == is the comparison operator = is the assignment operator.</p>
<p>It very easy to type = when you really mean ==.</p>
<p>Therefore the convention of typing constant==variable is preferred.</p>
<p>constant=variable will not compile thus showing you, your error.</p>
<p>variable=constant will com... | 38,883 |
<p>I have a simple, real life problem I want to solve using an OO approach. <strong>My harddrive is a mess.</strong> I have 1.500.000 files, duplicates, complete duplicate folders, and so on...</p>
<p>The first step, of course, is parsing all the files into my database. No problems so far, now I got a lot of nice entr... | <p>I don't have a solution (and would love to see one), but I might suggest extracting metadata from your files besides the obvious name, size and timestamps.</p>
<ul>
<li>in-band metadata such as MP3 ID3 tags, version information for EXEs / DLLs, HTML title and keywords, Summary information for Office documents etc. ... | <p>You've got a fever, and the only prescription is Tag Cloud! You're still going to have to clean things up, but with tools like <a href="http://www.taggtool.com/index.php" rel="nofollow noreferrer">TaggCloud</a> or <a href="http://www.tag2find.com" rel="nofollow noreferrer">Tag2Find</a> you can organize your files by... | 20,726 |
<p>Suppose that I have a Java program within an IDE (Eclipse in this case).
Suppose now that I execute the program and at some point terminate it or it ends naturally.</p>
<p>Is there a <strong>convenient</strong> way to determine which lines executed at least once and which ones did not (e.g., exception handling or c... | <p><a href="http://www.eclemma.org/" rel="nofollow noreferrer">eclemma</a> would be a good start: a code coverage tool would allow a coverage session to record the information you are looking for.</p>
<p><a href="https://i.stack.imgur.com/bWhQj.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bWhQj.g... | <p>What you're asking about is called "coverage". There are several tools that measure that, some of which integrate into Eclipse. I've used <a href="http://java-source.net/open-source/code-coverage/jcoverage-gpl" rel="nofollow noreferrer">jcoverage</a> and it works (I believe it has a free trial period, after which yo... | 36,829 |
<p>I'm trying to store an xml serialized object in a cookie, but i get an error like this:</p>
<pre><code>A potentially dangerous Request.Cookies value was detected from the client (KundeContextCookie="<?xml version="1.0" ...")
</code></pre>
<p>I know the problem from similiar cases when you try to store something... | <p>Storing serialized data in a cookie is a very, very bad idea. Since users have complete control over cookie data, it's just too easy for them to use this mechanism to feed you malicious data. In other words: <i>any</i> weakness in your deserialization code becomes instantly exploitable (or at least a way to crash so... | <p>You might look into using <a href="http://msdn.microsoft.com/en-us/library/ms972429.aspx" rel="nofollow noreferrer">Session State</a> to store the value. You can configure it to use a cookie to store the session id. This is also more secure, because the value is neither visible or changeable by the user-side.</p>
... | 14,545 |
<p>I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices "Composite Application Guidance for WPF". I've followed their instructions however my WPF application fails immediately with a "TypeInitializationException".</p>
<p>The InnerException property reveals t... | <p>Thanks @ima, your answer pointed me in the right direction. I was using an app.config file and it contained this:</p>
<pre><code><configuration>
<startup>
<supportedRuntime version="v2.0.50727" sku="Client"/>
</startup>
<configSections>
<section name="modules" type="M... | <p>You have two sections named "modules". Place both module definitions in one section named "modules".</p>
| 8,276 |
<p>I'm currently writing a website that allows people to download Excel and text files. Is there a way to redirect to a different page when they click, so that we run javascript and do analytics (i.e. keep download count)? Currently, nothing prevents the user from simply right-clicking and saving. </p>
<p>Edit: </p>
... | <p>I started describing how you might do this in Grails but then remembered most analytics services (Google, Omniture, etc.) will let you track downloaded files by using the onclick event. If you have some custom javascript based tracking you're doing, you can do the same thing. The onclick will get called before the... | <p>I'm not sure what you are asking here, are you trying to figure out how to redirect in the controller or are you trying to override the right-click behavior in the browser?</p>
<p>To redirect in the controller you can do something like this documented <a href="http://grails.org/doc/1.0.x/" rel="nofollow noreferrer"... | 20,296 |
<p>I have been reading lots of blog posts offering cause and solution to the "Operation Aborted" error in IE. I recently built an application that is getting this error for some of ther users, some of the time.</p>
<p>Let me explain in detail.</p>
<p>The application is .NET 2.0, ASP .NET and C# web application built ... | <p>The intricacies of your collection and bindings have introduced a <strong>race condition</strong>.</p>
<p>The <strong>Operation Aborted</strong> error is an obscure IE bug, which occurs when the DOM is appended before the page is finished loading.</p>
<p><strong>The Operation Aborted Error</strong></p>
<p>Refer t... | <p>See bug report here:</p>
<p><a href="http://webbugtrack.blogspot.com/2008/08/bug-404-operation-aborted-in-ie.html" rel="nofollow noreferrer">http://webbugtrack.blogspot.com/2008/08/bug-404-operation-aborted-in-ie.html</a></p>
<p>in short:</p>
<ol>
<li><p>The HTML file is being parsed</p></li>
<li><p>script is exe... | 33,422 |
<p>I need to be able to insert/update objects at a consistent rate of at least 8000 objects every 5 seconds in an in-memory HSQL database.</p>
<p>I have done some comparison performance testing between Spring/Hibernate/JPA and pure JDBC. I have found a significant difference in performance using HSQL.. With Spring/H... | <p>We have similar experience comparing Hibernate with JDBC in batch mode (Statement#executeBatch()). Basically, it seems like Hibernate just doesn't do that well with bulk operations. In our case, the Hibernate implementation was fast enough on our production hardware.</p>
<p>What you may want to do, is to wrap your ... | <p>All that mapping ... it can get a little bit expensive, with all the arcane logic and all the reflection and consistency-checking that it has to do.</p>
<p>The point of mapping is not to boost performance, of course. Typically, you take a performance hit. But what you lose in performance, you (<em>can</em>) gain ma... | 32,585 |
<p>OK so I'm looking a some code which looks roughly like this:</p>
<pre><code>void DoSomething(object o)
{
if (o is Sometype1) {
//cast o to Sometype and do something to it
}
else if (o is Sometype2) {
//cast o to Sometype2 and do something to it
}
...
else if (o is SometypeN) {
/... | <p>any time you see a switch statement (or a series of if-statements) that are checking the type of an object, this is a Big Red Flag for a missing base class or interface. In other words, the code should be relying on polymorphism, not testing the object type</p>
<p>if you cannot change the base class or implement an... | <p>A real example would be more helpful. If you are simply changing the implementation of a method for a family of related classes then, as @Steven A. Lowe says, you're best off using polymorphism and using the subclass relationships for this. If the classes don't participate in "is a" relationships, then other patter... | 39,391 |
<p>I am new to asp and have a deadline in the next few days.
i receive the following xml from within a webservice response.</p>
<pre><code>print("<?xml version="1.0" encoding="UTF-8"?>
<user_data>
<execution_status>0</execution_status>
<row_count>1</row_count>
<txn_id>stuetd67... | <p>You need to read about MSXML parser. Here is a link to a good all-in-one example <a href="http://oreilly.com/pub/h/466" rel="nofollow noreferrer">http://oreilly.com/pub/h/466</a></p>
<p>Some reading on XPath will help as well. You could get all the information you need in MSDN.</p>
<p>Stealing the code from <a hre... | <p>You could try loading the xml into the xmldocument object and then parse it using it's methods.</p>
| 12,029 |
<p>I am building a table using the DataGridView where a user can select items from a dropdown in each cell. To simplify the problem, lets say i have 1 column. I am using the DataGridViewComboBoxColumn in the designer. I am trying to support having each row in that column have a different list of items to choose fro... | <p>Yes. This can be done using the DataGridViewComboBoxCell.</p>
<p>Here is an example method to add the items to just one cell, rather than the whole column.</p>
<pre><code>private void setCellComboBoxItems(DataGridView dataGrid, int rowIndex, int colIndex, object[] itemsToAdd)
{
DataGridViewComboBoxCell dgvcbc ... | <pre><code> //Populate the Datatable with the Lookup lists
private DataTable typeDataTable(DataGridView dataGridView, Lookup<string, Element> type_Lookup, Dictionary<Element, string> type_dictionary, string strNewStyle, string strOldStyle, string strID, string strCount)
{
int row = 0;
... | 11,717 |
<p>I could use some advice on tracking down the cause of memory leaks in C#. I understand what is a memory leak and I get why they occur in C# but I'm wondering what tools/strategies have you used in the past to resolve them?</p>
<p>I am using .NET Memory Profiler and I've found that one of my huge main objects is sta... | <p>Break into the debugger and then type this into the Immediate window:</p>
<pre><code>.load C:\Windows\Microsoft.NET\Framework\v2.0.50727\sos.dll
</code></pre>
<p>The path to sos.dll varies. The way to find out the correct path is to look for mscorwks.dll in the Modules pane. Wherever that is loaded from is the cor... | <p>.NET Memory Profiler is an excellent tool, and one that I use frequently to diagnose memory leaks in WPF applications.</p>
<p>As I'm sure you're aware, a good way to use it is to take a snapshot before using a particular feature, then take a second snapshot after using it, closing the window, etc. When comparing th... | 28,204 |
<p>In order to reference a member of a class in XML comments/documentation, you have to use the following tag:</p>
<pre><code><see cref="member"/>
</code></pre>
<p>It is better explained <a href="http://msdn.microsoft.com/en-us/library/acd0tfbe.aspx" rel="noreferrer">here</a>.</p>
<p><strong>How do you referen... | <pre><code><see cref="P:System.Collections.ArrayList.Item(System.Int32)" />
</code></pre>
| <p>In general, in order to find out, how to reference any member in your comments, find the member in your XML documentation file for the assembly. It is created on each build. With the only exception of generics the member reference can be taken from here: </p>
<pre><code></member>
<member name="P:My.Namespa... | 44,325 |
<p>In SQL Server 2005, are there any disadvantages to making all character fields nvarchar(MAX) rather than specifying a length explicitly, e.g. nvarchar(255)? (Apart from the obvious one that you aren't able to limit the field length at the database level)</p>
| <p>Same question was asked on MSDN Forums:</p>
<ul>
<li><a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4d9c6504-496e-45ba-a7a3-ed5bed731fcc/varcharmax-vs-varchar255" rel="noreferrer">Varchar(max) vs Varchar(255)</a></li>
</ul>
<p>From the original post (much more information there):</p>
<blockquote>
... | <p>This will cause a performance problem, although it may never cause any actual issues if your database is small. Each record will take up more space on the hard drive and the database will need to read more sectors of the disk if you're searching through a lot of records at once. For example, a small record could fit... | 17,882 |
<p>I want to make a WPF Window that behaves like a context menu.</p>
<p>So, for instance - when I show the wpf window, I want it to be the topmost window and from there on out, if the user clicks anything outside of that window I want the window to be hidden again.</p>
<p>So far I have tried quite a few techniques bu... | <p>Is <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup.aspx" rel="nofollow noreferrer">PopUp</a> not sufficient for your needs? It has a <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup.staysopen.aspx" rel="nofollow noreferrer">StaysOpen... | <p>Don't know how helpful this will be, but if you don't necessarily need a Window, one technique I have used is placing a UserControl inside a Window.</p>
<p>Depending on whatever condition, you would show a context menu. Inside the menu I placed a menu item and inside that just place the user control. It will behave... | 47,115 |
<p>I have a public property set in my form of type <code>ListE<T></code> where:</p>
<pre><code>public class ListE<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
</code></pre>
<p>Yeah, it's a mouthful, but that's what the Designer requires for it to show up... | <p>I can't understand what's motivating you to attempt to reinvent the List<T> wheel in that way, but to answer your question: I would add a line "System.Diagnostics.Debugger.Break()" to the constructor of your class.</p>
<p>Then try to use it in the designer, and you'll get a popup asking you if you want to att... | <p>One place to start would be that it may be doing math with your ListE`1::Count property. If that has some subtle flaw (i.e. it is more complicated than return this.innerList.Count) it could be causing the designer to arithmetic overflow on some operation. Normally arithmetic overflows do not occur unless specificall... | 13,604 |
<p>I'm trying to use TJCLHashMap family of classes, but apparently this class has no useful public methods. All methods are "protected". How to use this class? Although JCL comes with some samples, I seem to miss something. A basic example would be great.</p>
| <p>You should use the interfaces declared in JclContainerIntf.pas. The classes in JclHashMaps implement those interfaces.<br>
Take a look at jcl\examples\common\containers\hashing\HashingExample.dpr for a few examples (integer, strings, objects, etc.)</p>
| <p>Extend it and add public methods that call the protected methods internally?</p>
| 30,762 |
<p>I have an OpenGL RGBA texture and I blit another RGBA texture onto it using a framebuffer object. The problem is that if I use the usual blend functions with
<code>glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA),</code>
the resulting blit causes the destination texture alpha to change, making it slightly transpar... | <p>You can set the blend-modes for RGB and alpha to different equations:</p>
<pre><code>void glBlendFuncSeparate(
GLenum srcRGB,
GLenum dstRGB,
GLenum srcAlpha,
GLenum dstAlpha);
</code></pre>
<p>In your case you want to use the following enums:</p>
<pre><code> glBlendFuncSeparate(GL_SRC_ALPHA, G... | <p>Maybe you could use <a href="http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html" rel="nofollow noreferrer">glColorMask</a>()? It let's you enable/disable writing to each of the four color components.</p>
| 17,604 |
<p>Can anyone suggest a way of getting version information into a Web Service? (VB.NET)</p>
<p>I would like to dynamically use the assembly version in the title or description, but the attributes require constants. </p>
<p>Is manually writing the version info as a string the only way of displaying the information on ... | <p>I have been looking at this kind of functionality myself recently and have decided on using jQuery with the help of <a href="http://ui.jquery.com/" rel="noreferrer">jQuery UI</a>. I came across a large amount of information that also suggested <a href="http://developer.yahoo.com/yui/" rel="noreferrer">Yahoo UI</a> (... | <p>I used the Microsoft ASP.Net Ajax and AjaxControlToolkit to do something like this. They have a ResizeableControl and a DragPanel. I used these, then hosted an IFrame inside the panel to display the content.</p>
<p>Worked pretty well.</p>
<hr>
<p>This site:</p>
<p><a href="http://www.asp.net/learn/videos/defau... | 3,695 |
<p>I have written a program in C to parse large XML files and then create files with insert statements. Some other process would ingest the files into a MySQL database.
This data will serve as a indexing service so that users can find documents easily.</p>
<p>I have chosen InnoDB for the ability of row-level locking... | <ul>
<li>Use the mysqlimport tool or the LOAD DATA INFILE command.</li>
<li>Temporarily disable indices that you don't need for data integrity</li>
</ul>
| <p>MySQL with the standard table formats is wonderfully fast as long as it's a write-only table; so the first question is whether you are going to be updating or deleting. If not, don't go with innosys - there's no need for locking if you are just appending. You can truncate or rename the output file periodically to de... | 40,600 |
<p>I'm trying to call a 3rd party vendor's C DLL from vb.net 2005 and am getting <code>P/Invoke</code> errors. I'm successfully calling other methods but have hit a bottle-neck on one of the more complex. The structures involved are horrendous and in an attempt to simplify the troubleshooting I'd like to create a C++... | <p>Try using the <a href="http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx" rel="nofollow noreferrer">__decspec(dllexport)</a> magic pixie dust in your C++ function declaration. This declaration sets up several things that you need to successfully export a function from a DLL. You may also need to use WINAPI or so... | <p>You can try to look at the exported functions (through DumpBin or Dependency Walker) and see if the names are mangled.</p>
| 6,009 |
<p>I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but <strong>is there anything characteristic about a software architecture for a system written in a functional ... | <p>The common thread in the "architecture" of projects that use functional languages is that they tend to be separated into layers of algebras rather than subsystems in the traditional systems architecture sense.</p>
<p>For great examples of such projects, check out <a href="http://xmonad.org/" rel="noreferrer">XMonad... | <p>I think this may help; </p>
<blockquote>
<p>Some of the patterns disappear -- that
is, they are supported directly by
language features, some patterns are
simpler or have a different focus, and
some are essentially unchanged.</p>
</blockquote>
<p>[AIM-2002-005] Gregory T. Sullivan, <a href="http://dspace... | 11,479 |
<p><strong>Is there a YAML driver for the Java <a href="http://x-stream.github.io/" rel="nofollow noreferrer">XStream</a> package?</strong></p>
<p>I'm already using XStream to serialise/deserialise both XML and JSON. I'd like to be able to do the same with YAML.</p>
| <p>To parse a YAML document you can use this chain:
YAML -> SnakeYAML -> Java -> Your Application (-> XStream -> XML)</p>
<p>Emitting YAML is simpler and there are a couple of options:
1) Your Application -> XStream with Custom Writer -> YAML
2) Your Application -> SnakeYAML -> YAML</p>
<p>The second option does not ... | <p>I used JYAML and it worked great. I know it doesn't directly answer your question but it works well.</p>
| 45,292 |
<p>I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port?</p>
<p>What I'm doing now:</p>
<pre><code>class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def doGET
[...]
clas... | <p>Sure; just start two different servers on two different ports in two different threads that each use the same handler. Here's a complete, working example that I just wrote and tested. If you run this code then you'll be able to get a Hello World webpage at both <a href="http://localhost:1111/" rel="noreferrer">htt... | <p>Not easily. You could have two ThreadingHTTPServer instances, write your own serve_forever() function (don't worry it's not a complicated function).</p>
<p>The existing function:</p>
<pre><code>def serve_forever(self, poll_interval=0.5):
"""Handle one request at a time until shutdown.
Polls for shutdown e... | 8,566 |
<p>What is the maxiimum boost factor value for a word in Lucene.Net?
I believe default value is 1.0f</p>
<p>Thanks!</p>
| <p>It can be any positive number. Of course, if you pick an unreasonable number, like Float.POSITIVE_INFINITY (or the .NET equivalent), you'll end up with some crazy scores. Generally, you want to look at your boosts as a percentage: 1.0F is 100%, meaning no boost up or down. 1.2F is 120%, a little boost up; 0.5 is 50%... | <p>I've found evidence on Google that it's at least 4... but I can't find any further information as to what the ceiling is. Some of the document importance descriptions use 4 as an example which is where I drew my conclusion.</p>
<p>However the user documentation defines that it must be a positive number which may b... | 44,581 |
<p>I am using jQuery to try and trigger a method when an <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> (2.0) dropdown list's change event is handled by jQuery. The problem is that the drop down list is located inside a gridview and even then only when a user has decided to edit a ... | <p>A couple of things here.</p>
<ol>
<li>You need to wrap your selectors in quotes when you pass them to the <code>$()</code> function. The code snippet above generates something like <code>$(#some-generated-id)</code>, which won't work.</li>
<li>The closing curly brace for your server side if statement was outside th... | <p>The key can be anything you want, it should be unique though.</p>
| 34,232 |
<p>I'm using VB .NET 2005 and Exchange Server 2003 installed
I have found some code which gives me the ability to connect in an Exchange Server and create an appointment.
The thing is that I cannot find the CDO. Appointment.
Where can I find it and make the below code to work ?
I have tried all the examples with CDO a... | <p>CDO.Appointment indeed is part of cdoex.dll (Collaboration Data Objects for Exchange) that comes with some versions of Exchange, SPS and Office. You can download and register cdoex.dll on your machine, and reference it in your VB.Net application.</p>
<p>These posts should be helpful:</p>
<ul>
<li><a href="http://s... | <p>If you cannot find a copy of <code>cdoex.dll</code> on your local PC or server, try these downloads:</p>
<p><a href="http://www.google.nl/search?q=download+CDOEX.DLL" rel="nofollow noreferrer">http://www.google.nl/search?q=download+CDOEX.DLL</a></p>
| 36,402 |
<p>I have a Rails application for project management where there are Project and Task models. A project can have many tasks, but a task can also have many tasks, ad infinitum.</p>
<p>Using nested resources, we can have /projects/1/tasks, /projects/1/tasks/new, /projects/1/tasks/3/edit etc.</p>
<p>However, how do you ... | <p>Going anywhere beyond a single nested route is generally considered a bad idea.</p>
<p>From page 108 of <strong>The Rails Way</strong>:</p>
<p><a href="http://weblog.jamisbuck.org/2007/2/5/nesting-resources" rel="noreferrer">"<em>Jamis Busk a very influential figure in the Rails community, almost as much as David ... | <p>there's no reason they should have decendant URLS. </p>
<p>logically:</p>
<pre>
/projects/1 --> project 1
/projects/1/edit ( etc )
/tasks/1 --> task 1
/project/1/tasks --> task list for project 1
/project/1/tasks/new
/project/1/tasks/1/edit -> /tasks/5/edit ( redundancy )
/project/1/tasks/1 -> redirect ... | 20,988 |
<p>I am using:</p>
<pre><code>set constraints all deferred;
(lots of deletes and inserts)
commit;
</code></pre>
<p>This works as expected. If there are any broken relationships then the commit fails and an error is raised listing ONE of the FKs that it fails on.</p>
<p>The user fixes the offending data and runs aga... | <p>First option, you can look into <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#BGBEIACB" rel="nofollow noreferrer">DML error logging</a>. That way you leave your constraints active, then do the inserts, with the erroring rows going into error tables. You can find them the... | <p>Oracle's Error Mechanism is too primitive to return a collection of all errors that COULD occur. I mean, it's a cool thought but think about what you'd have to do if you wrote the code. Your standard error handling would need to be thwarted. Instead of returning an error as soon as you encounter it, you'd have to co... | 35,215 |
<p>How can i make my Java Swing GUI Components [Right To Left] for Arabic language from NetBeans Desktop Application?</p>
| <p>Don't you just have to use:</p>
<pre><code>Component.setComponentOrientation( ComponentOrientation.RIGHT_TO_LEFT )
</code></pre>
<p>I believe that the swing components all already have support for RTL, don't they?</p>
<p>Not sure how/where you'd do that in regards to netbeans, though.</p>
| <p>you could use it if you have components inside panels inside contentPane</p>
<pre><code> Component[] component = contentPane.getComponents();
for(int i=0; i<component.length; i++){
component[i].applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
Component[] cp = ((Container)... | 46,220 |
<p>What is the difference, if any, between these methods of indexing into a PHP array:</p>
<pre><code>$array[$index]
$array["$index"]
$array["{$index}"]
</code></pre>
<p>I'm interested in both the performance and functional differences.</p>
<h3>Update:</h3>
<p>(In response to @Jeremy) I'm not sure t... | <p>see @svec and @jeremy above. All array indices are of type 'int' first, then type 'string', and will be cast to that as PHP sees fit.</p>
<p>Performance wise, $index should be faster than "$index" and "{$index}" (which are the same). </p>
<p>Once you start a double-quote string, PHP will go into interpolation mo... | <p>I believe from a performance perspective that $array["$index"] is faster than $array[$index] See <a href="http://www.chazzuka.com/blog/?p=163" rel="nofollow noreferrer">Best practices to optimize PHP code performance</a></p>
<p>Another variation that I use sometimes when I have an array inside a string is:</p>
<pr... | 2,835 |
<p>I have a problem in regards to filament jam, however I don't think that my case is any related to the extruder nozzle.
After 30 to 40 minutes printing my filament bends and get stuck on the tube entrance.
To print a nut wheel which comes as a demo file, I had to repeat the operation 4 times, and I had to stop printi... | <p>Something is stopping the filament from going down the tube 30 to 40 min. after you start printing. You are correct that this doesn't sound like a clogged nozzle. It could be deformed filament, but the closeness of the timing after the start sounds like heat creep. Other possibilities are also listed at the linke... | <p>You need a better filament quality I have the same printer and I had switched to Overture. Know use PLA Plus or (PLA+)due to not sticking to the bed well enough and your issue. And this issue may be the way the entire module moves up and down the threads may need better positioning like tighten loosen or even level... | 1,921 |
<p>I'm working on a visual studio 2005 vb.net windows forms project that's been around for several years. It's full of default textboxes, labels, dropdowns, datagrids, datetime pickers -- all the standard stuff. The end result is a very gray, old-looking project.</p>
<p>What would be the best approach to making this... | <p>I was actually just sprucing up a dialog today. A lot of it depends on what kind of application you have, and what OS it is running on. A couple of these tips will certainly go a long way to jazzing things up.</p>
<ol>
<li><p>Ensure adequate spacing between controls — don't cram them all together. Space is appeal... | <p>This depends on how the existing "gray old looking" project is structured in terms of code. For example, is data access code separated from the UI in a Data Access Layer, is the business logic in a Business Logic Layer? If yes, then cleaning the UI for a snazzy look should be relatively simple.</p>
<p>If everythi... | 5,376 |
<p>Does Stackoverflow create a new OpenID when a user registers with an email address (i.e. does not provide an existing OpenID)? How do you do that? Do you have code examples in C#? Java? Python?</p>
| <p>You can find OpenID implementations <a href="http://wiki.openid.net/Libraries" rel="nofollow noreferrer">here</a>. If you just want more information, I would check out the <a href="http://openid.net/" rel="nofollow noreferrer">OpenID site</a>.</p>
| <p>I think you are mis-understanding OpenID, the process of registering and OpenID is the responsibility of the user, you'll note that there is no place to signup here without an OpenID.</p>
| 6,386 |
<p>I recently was working with a subversion project that checked out code not only from the repository I was working with, but also from a separate repository on a different server.</p>
<p>How can I configure my repository to do this?</p>
<p>I'm using the subversion client version 1.3.2 on Linux, and I also have acce... | <p>See <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html" rel="nofollow noreferrer">svn:externals</a>:</p>
<blockquote>
<p>Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different subdirectories to come from different locations... | <p>I think you should take a look at the <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html" rel="nofollow noreferrer">svn:externals</a> property</p>
| 10,048 |
<p>Today I ran into a problem were I needed to remote-debug a program. The program was launched from another system, so I really don't have an opportunity to interact with it on the command line. I could change its source easily though.</p>
<p>What I needed to happen was for the program to start normally, and then w... | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.isattached.aspx" rel="noreferrer">System.Diagnostics.Debugger.IsAttached</a> property to check if a debugger is attached to the process. This application will wait until a debugger has been attached:</p>
<pre><code>using Sy... | <p>Set a timeout that gives you time to attach the debugger.</p>
<pre><code>Thread.Sleep(30000);
</code></pre>
| 47,122 |
<p>Did you ever use SQL Server auditing features on a production db?</p>
<p>How did that impact on performances, and are there differences you noticed between different versions of SQL Server.</p>
<p>Also how we need to enable the audit features.</p>
| <p>The C2 audit mode suffers from a variety of problems, and your question touched on only one of them - performance. C2 auditing has a tremendous performance impact, very high.</p>
<p>Setting the performance issue aside, it's very difficult to manage. It's not a set-it-and-forget-it configuration switch. You have ... | <p>I'm afraid there's no such a thing as "audit feature". Instead you need to build it yourself depending on what kind of requirements you have. There are many ways to do this, for example</p>
<ul>
<li>A trigger fires every time data in audited tables change. An example here: <a href="http://web.archive.org/web/200710... | 39,189 |
<p>I've got a 44Khz audio stream from a CD, represented as an array of 16 bit PCM samples. I'd like to cut it down to an 11KHz stream. How do I do that? From my days of engineering class many years ago, I know that the stream won't be able to describe anything over 5500Hz accurately anymore, so I assume I want to cu... | <p>Read on FIR and IIR filters. These are the filters that use a coefficent array.</p>
<p>If you do a google search on "FIR or IIR filter designer" you will find lots of software and online-applets that does the hard job (getting the coefficients) for you. </p>
<p><strong>EDIT:</strong></p>
<p>This page here ( <a hr... | <p>I would try applying DFT, chopping 3/4 of the result and applying inverse DFT. I can't tell if it will sound good without actually trying tough.</p>
| 29,480 |
<p>I need to write a Delphi application that pulls entries up from various tables in a database, and different entries will be in different currencies. Thus, I need to show a different number of decimal places and a different currency character for every Currency data type ($, Pounds, Euros, etc) depending on the curr... | <p>Even with the same currency, you may have to display values with a different format (separators for instance), so I would recommend that you associate a LOCALE instead of the currency only with your values.<br>
You can use a simple Integer to hold the LCID (locale ID).<br>
See the list here: <a href="http://msdn.mic... | <p>I'd use SysUtils.CurrToStr(Value: Currency; var FormatSettings: TFormatSettings): string;</p>
<p>I'd setup an array of TFormatSettings, each position configured to reflect each currency your application supports. You'll need to set the following fields of the TFormat Settings for each array position: CurrencyString... | 11,149 |
<p>I'm using .NET 3.5. I have two string arrays, which may share one or more values:</p>
<pre><code>string[] list1 = new string[] { "apple", "orange", "banana" };
string[] list2 = new string[] { "banana", "pear", "grape" };
</code></pre>
<p>I'd like a way to merge them into one array with no duplicate values:</p>
<... | <pre><code>string[] result = list1.Union(list2).ToArray();
</code></pre>
<p>from <a href="http://msdn.microsoft.com/en-us/library/bb341731.aspx" rel="noreferrer">msdn</a>: "This method excludes duplicates from the return set. This is different behavior to the Concat(TSource) method, which returns all the elements in t... | <p>Probably creating a hashtable with your values as keys (only adding those not already present) and then converting the keys to an array could be a viable solution.</p>
| 17,624 |
<p>How do I access 'a' below?</p>
<pre><code>var test = function () {
return {
'a' : 1,
'b' : this.a + 1 //doesn't work
};
};
</code></pre>
| <p>You can't do it this way. When you are in the process of constructing an object (that's what you actually do using the curly braces), there is no way to access it's properties before it is constructed.</p>
<pre><code>var test = function () {
var o = {};
o['a'] = 1;
o['b'] = o['a'] + 1;
return o;
};
</code><... | <pre><code>var test = function () {
//private members
var a = 1;
var b = a + 1;
//public interface
return {
geta : function () {
return a;
},
getb : function () {
return b;
}
}
}();
</code></pre>
| 44,800 |
<p>How can I implement ActiveX Document on C#/.NET? (ActiveX Document can draw itself in IE)<br>
<strong>Update:</strong> I need a solution for drawing my own document type in IE windows (like MS Word or MS Excel draw its documents in IE). </p>
| <p>You need to dive into OLE for that purpose. </p>
<p>Things like IOleDocument, IOleInPlaceSite (see <a href="http://msdn.microsoft.com/en-us/library/ms687196.aspx" rel="nofollow noreferrer">MSDN</a> for that). Figure out which interfaces are needed for the client (as IE would be the container and will need to commun... | <p>Look at <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.domdocument.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.domdocument.aspx</a>, it's .NET wrapper for DOM Document</p>
| 44,793 |
<p>I know there are some ways to get notified when the page body has loaded (before all the images and 3rd party resources load which fires the <strong>window.onload</strong> event), but it's different for every browser.</p>
<p>Is there a definitive way to do this on all the browsers?</p>
<p>So far I know of:</p>
<u... | <p>There's no cross-browser method for checking when the DOM is ready -- this is why libraries like jQuery exist, to abstract away nasty little bits of incompatibility.</p>
<p>Mozilla, Opera, and modern WebKit support the <code>DOMContentLoaded</code> event. IE and Safari need weird hacks like scrolling the window or ... | <p>This works pretty well:</p>
<pre><code>setTimeout(MyInitFunction, 0);
</code></pre>
| 9,115 |
<p>I have a class that has some properties. And I want something that calculates a Score out of these properties. Since this is a trivial task (some additions and divisions, but nothing spectacular).</p>
<p>So naturally, the question is: "When to use a Property with some code in the getter, and when to use a function?... | <p>Pull up reflector, you'll see that your properties already are methods :)</p>
| <p>As others already pointed out - nothing to worry. I just post to clarify that according to the coding guidelines, a property name usually is noun (i.e. Score), but methods should describe actions (verb), so more proper name is GetScore() or CalculateScore() :)</p>
<p>Grammar Nazi in action :)</p>
| 37,951 |
<p>I'm trying to get a query working that takes the values (sometimes just the first part of a string) from a form control. The problem I have is that it only returns records when the full string is typed in.</p>
<p>i.e. in the surname box, I should be able to type gr, and it brings up </p>
<p>green
grey
graham</p>
... | <h2>There is an Access Method for that!</h2>
<p>If you have your "filter" controls on the form, why don't you use the Application.buildCriteria method, that will allow you to add your filtering criterias to a string, then make a filter out of this string, and build your WHERE clause on the fly?</p>
<pre><code>selectC... | <p>My only thoguht is that maybe a () is needed to group the like</p>
<p>For example a snippet on the first part</p>
<pre><code>,[Forms]![FrmSearchCustomer]![SearchFore] Like ([customerforname] & "*"))=True
</code></pre>
<p>It has been a while since I've used access, but it is the first thing that comes to mind<... | 27,614 |
<p>I'll be quick and honest: I'm currently trying to write a client/server for an online game. Since I'm poor and limited on resources, I'll be testing the bare basics of the server using a PHP backend, with the eventual goal being to rebuild the server end in C++.</p>
<p>I'm looking for a C++ library for Windows (XP ... | <p><a href="http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio.html" rel="nofollow noreferrer">Boost.Asio</a></p>
<p>ASIO has simple web server examples.</p>
<p><a href="http://www.boost.org/doc/libs/1_37_0/doc/html/thread.html" rel="nofollow noreferrer">Boost.Thread</a></p>
| <p>You should just use <a href="http://curl.haxx.se/" rel="nofollow noreferrer">cUrl</a> with multihandles. It is better designed to do what you want than whatever it is that you have designed.</p>
| 44,579 |
<p>On a number of occasions I've broken small plastic parts that are nearly impossible to replace but could easily be 3-D printed. The latest such mishap is the volume knob on the factory-installed radio on my car. </p>
<p>I have little experience in 3D printing, and would like to be able to replace these parts with... | <p>The easiest way is as you currently do: model the pieces by hand, using (digital) calipers to measure them.</p>
<p>Scanning technology isn't very good, and the models are not of printable quality. Usually, fixing a scan is more work than modeling an item from scratch.</p>
| <p>There is scanning technology: either hardware or software (such software typically works from multiple 2D photographs). It has limitations, but is an active research area, and getting better all the time. "Autodesk 123D Catch" and "3-Sweep" are a couple examples.</p>
<p>One tradeoff between automatic and manual is ... | 97 |
<p>I'm using Chris Pederick's Firefox addon <a href="http://chrispederick.com/work/web-developer/" rel="nofollow noreferrer">"Web Developer 1.1.6"</a>. I get this warning when hitting a certain web page on my site: </p>
<blockquote>
<p>Unknown property 'MozOpacity'. Declaration dropped.</p>
</blockquote>
<p>What do... | <p>It's customary for browsers to prefix experimental or proprietary features with <em>-moz</em> (for Gecko-based browsers) or <em>-webkit</em> (for webkit) so they can be used but don't interfere with standard CSS rendering. In the case of <em>-moz-opacity</em>, it seems that they have finally removed the proprietary ... | <p>there is some proprietary css declaration :
- filter (from microsoft);
- -moz-corner-radius, -moz-opacity and other -moz prefixed from mozilla
- -khtml prefixed from safari</p>
<p>these are NOT standard and it works ONLY in that browser.
If you don't expect -moz properties to work on safari and filter on firefox, ... | 28,999 |
<p>I want to create a class that, for example, extends HttpServlet? My compiler warns me that my class should have a serialVersionUID. If I know that this object will never be serialized, should I define it or add an annotation to suppress those warnings?</p>
<p>What would you do and why?</p>
| <p>I don't know Java best practices, but it occurs to me that if you are claiming that serialization will never happen, you could add a writeObject method which throws. Then suppress the warning, safe in the knowledge that it cannot possibly apply to you.</p>
<p>Otherwise someone might in future serialize your object ... | <p>Please follow this link to get detailed explanation: <a href="http://technologiquepanorama.wordpress.com/2009/02/13/what-is-use-of-serialversiouid/" rel="nofollow noreferrer">http://technologiquepanorama.wordpress.com/2009/02/13/what-is-use-of-serialversiouid/</a></p>
| 17,660 |
<p>I have some strings that I am pulling out of a database and I would like to use Template Toolkit on them, but I can't seem to figure out how to use strings as TT input. Any tips?</p>
<p>Thanks!</p>
<p>-fREW</p>
| <p>The documentation explains:</p>
<blockquote>
<p>process($template, \%vars, $output, %options)</p>
<p>The process() method is called to process a template. The first parameter indicates the input template as one of: a filename relative to INCLUDE_PATH, if defined; <strong>a reference to a text string contain... | <p>From the <a href="http://template-toolkit.org/docs/modules/Template.html#method_process" rel="nofollow noreferrer">docs</a>:</p>
<pre><code># text reference
$text = "[% INCLUDE header %]\nHello world!\n[% INCLUDE footer %]";
$tt->process(\$text)
|| die $tt->error(), "\n";
</code></pre>
<p>(Looks like I s... | 40,624 |
<p>I am trying to coach some guys on building web applications. They understand and use MVC, but I am interested in other common patterns that you use in building web apps. </p>
<p>So, what patterns have you found to fit nicely into a properly MVC app. Perhaps something for Asynchronous processes, scheduled tasks, de... | <p>Once you get into MVC, it can be worthwhile to explore patterns beyond the "Gang of Four" book, and get into Martin Fowler's "<a href="http://martinfowler.com/eaaCatalog/index.html" rel="noreferrer">Patterns of Enterprise Application Architecture</a>."</p>
<p>The <a href="http://martinfowler.com/eaaCatalog/registry... | <p>I would most likely recommend some kind of Dependency Injection as well (Inversion of Control). Probably the single most important supplementary "pattern" to use.</p>
| 42,477 |
<p>A listbox is passed, the data placed in an array, the array is sort and then the data is placed back in the listbox. The part that does work is putting the data back in the listbox. Its like the listbox is being passed by value instead of by ref.</p>
<p>Here's the sub that does the sort and the line of code that c... | <p>This works for me on Excel 2003 on a very basic UserForm with a single ListBox called ListBox1:</p>
<pre><code>Private Sub UserForm_Initialize()
ListBox1.AddItem "john"
ListBox1.AddItem "paul"
ListBox1.AddItem "george"
ListBox1.AddItem "ringo"
SortListBox ListBox1
End Sub
</code></pre>
<p>and then your SortList... | <p>I dont know if this would work for you but try it this way. </p>
<p>First, make an array of all the items in the list box</p>
<p>Pass that array to your function</p>
<p>Sort that array</p>
<p>return the array to the main program</p>
<p>clear the listbox</p>
<p>overwrite the listbox items with the new array</p>... | 44,927 |
<p>Besides the sample applications featured in the books <em>Beginning Groovy and Grails</em> and <em>The Definitive Guide to Grails</em>, are there any applications out there written in Grails that are good examples from which to learn best practices? Such as real applications that are open-source? Thanks.</p>
| <p>During my learning phase, I came across several good sample applications.</p>
<p>This sample web album app got me started on grails. It covers security, image upload / manipulation, basic crud etc.</p>
<p><a href="http://www.syger.it/Tutorials/GrailsWebAlbum.html" rel="noreferrer">http://www.syger.it/Tutorials/Gr... | <p>I second the IBM series Ray Tayek mentioned, and the energizedwork.com example j pimmel mentioned. The latter has been my reference manual for writing well-tested code and I can't live without it.</p>
| 34,935 |
<p>What is the difference between a pointer variable and a reference variable?</p>
| <ol>
<li><p>A pointer can be re-assigned:</p>
<pre><code>int x = 5;
int y = 6;
int *p;
p = &x;
p = &y;
*p = 10;
assert(x == 5);
assert(y == 10);
</code></pre>
<p>A reference cannot be re-bound, and must be bound at initialization:</p>
<pre><code>int x = 5;
int y = 6;
int &q; // error
int &r = x;
</code>... | <p>In short,</p>
<blockquote>
<p>Pointers: A pointer is a variable that holds the memory address of another variable. A pointer needs to be dereferenced with the * operator to access the memory location it points to. - Extracted from Geeks for Geeks</p>
</blockquote>
<blockquote>
<p>References: A reference variable is ... | 8,172 |
<p>I have a classic 3-tier ASP.Net 3.5 web application with forms that display business objects and allow them to be edited. Controls on the form correspond to a property of the underlying business object. The user will have read/write, readonly, or no access to the various controls depending on his/her role. Very conv... | <p>To work properly, I have found that access levels should be in this increasing order:
NONE, VIEW, REQUIRED, EDIT.</p>
<p>Note that REQUIRED is NOT the top level as you may think it would be since EDIT (both populate & de-populate permission) is a greater privilege than REQUIRED (populate-only permission).</p>
... | <p>I have often found that this is really the only real easy and understandable way to do it, as your interface needs to modify based on the information and level of editing that they can complete. </p>
<p>I do find typically though that depending on the needs, you can interject the "cannot edit" information by passi... | 48,164 |
<p>It seems safe to cast the result of my vector's <code>size()</code> function to an <code>unsigned int</code>. How can I tell for sure, though? My documentation isn't clear about how <code>size_type</code> is defined.</p>
| <p>Do not assume the type of the container size (or anything else typed inside).</p>
<h3>Today?</h3>
<p>The best solution for now is to use:</p>
<pre><code>std::vector<T>::size_type
</code></pre>
<p>Where T is your type. For example:</p>
<pre><code>std::vector<std::string>::size_type i ;
std::vector<... | <p>I'm not sure how well this will work because I'm just thinking off the top of my head, but a compile-time assertion (such as <code>BOOST_STATIC_ASSERT()</code> or see <a href="https://stackoverflow.com/questions/174356/ways-to-assert-expressions-at-build-time-in-c">Ways to ASSERT expressions at build time in C</a>) ... | 27,979 |
<p>I have heard a few developers recently say that they are simply polling stuff (databases, files, etc.) to determine when something has changed and then run a task, such as an import.</p>
<p>I'm really against this idea and feel that utilising available technology such as <a href="http://en.wikipedia.org/wiki/.NET_R... | <p>Polling is not "wrong" as such.</p>
<p>A lot depends on how it is implemented and for what purpose. If you really care about immedatly notification of a change, it is very efficient. Your code sits in tight loop, constantly polling (asking) a resource whether it has changed / updated. This means you are notified as... | <p>Here is a good summary of relative merits of push and pull:
<a href="https://stpeter.im/index.php/2007/12/14/push-and-pull-in-application-architectures/" rel="nofollow noreferrer">https://stpeter.im/index.php/2007/12/14/push-and-pull-in-application-architectures/</a></p>
<p>I wish I could summarize it further into... | 41,428 |
<p>I would like to be able to detect what country a visitor is from on my website, using PHP. </p>
<p>Please note that I'm not trying to use this as a security measure or for anything important, just changing the spelling of some words <em>(Americans seems to believe that the word "enrolment" has 2 Ls.... crazy yanks)... | <p>Not guaranteed, but most browsers submit an Accept-Language HTTP header that specifies en-us if they're from the US. Some older browsers only said they are en, though. And not all machines are set up correctly to indicate which locale they prefer. But it's a good first guess.</p>
<p>English-UK based-users usually s... | <p>The <a href="http://countries.nerd.dk" rel="nofollow noreferrer">http://countries.nerd.dk</a> service is what I use for IP-to-country mapping. It works really well and being based on DNS, is cached well too.</p>
<p>You can also download the database for local use if you don't want to rely on an external service.</p... | 38,077 |
<p>Like many people, I have burnt the pins in the micro-controller connected to the E0 motor - the E0 motor is not working anymore and I need to print tomorrow! I need to control the extruder motor with the working E1 pins. How do I change this in firmware? </p>
<p>I tried to change to the pins in `pins_RAMPS.h" but i... | <p>I would change the pin assignments by swapping E0 and E1 in <code>pins_RAMPS.h</code>.</p>
| <p>As a quick and dirty solution you may try to enable two extruders in configuration file, re-upload firmware, and then edit your GCODE file to replace all E0 references with E1.</p>
| 447 |
<p>In a shellscript, I'd like to set the IP of my box, run a command, then move to the next IP. The IPs are an entire C block.</p>
<p>The question is how do I set the IP of the box without editing a file? What command sets the IP on Slackware?</p>
<p>Thanks</p>
| <p>As mentioned in other answers, you can use either the ifconfig command or the ip command. ip is a much more robust command, and I prefer to use it. A full script which loops through a full class C subnet adding the IP, doing stuff, then removing it follows. Note that it doesn't use .0 or .255, which are the netwo... | <p>It should be something like: <code>ifconfig eth0 192.168.0.42 up</code></p>
<p>Replace eth0 by the network interface of your network card, obviously adapt the ip address to your needs and the up is only necessary once, but doesn't hurt if you run it each time. </p>
| 9,967 |
<p>How can someone validate that a specific element exists in an XML file? Say I have an ever changing XML file and I need to verify every element exists before reading/parsing it. </p>
| <pre><code>if(doc.SelectSingleNode("//mynode")==null)....
</code></pre>
<p>Should do it (where doc is your XmlDocument object, obviously)</p>
<p>Alternatively you could use an XSD and validate against that</p>
| <p>//I am finding childnode ERNO at 2nd but last place</p>
<pre><code>If StrComp(xmlnode(i).ChildNodes.Item(xmlnode(i).ChildNodes.Count - 1).Name.ToString(), "ERNO", CompareMethod.Text) = 0 Then
xmlnode(i).ChildNodes.Item(xmlnode(i).ChildNodes.Count - 1).InnerText = c
Else
e... | 12,650 |
<p>I am currently working on (or at least planning) a couple of projects that work with large amounts of repetitive data. The kind of data that works well in a spreadsheet or database, but is nasty in XML. :)</p>
<p>NetCDF seems like a great option for a file format. However, my work is in C# and there is no "official... | <p>First, are you sure that NetCDF is the right choice? If you want to interact with other programs that need to read in large amounts of data and they already support NetCDF, then it's probably a great choice. There aren't that many standard and well-supported file formats that support large multidimensional arrays.... | <p>In a project we are using the ucar netcdf implementation in c# using ikvm. IKVM can be used to 'convert' java projects into .Net libraries without a use for java VM. I have not done any performance check but it is a simple way to get netcdf in c# :).</p>
<p><a href="http://www.unidata.ucar.edu/downloads/netcdf/netc... | 8,484 |
<p>I have a custom XML schema defined for page display that puts elements on the page by evaluating XML elements on the page. This is currently implemented using the preg regex functions, primarily the excellent preg_replace_callback function, eg:</p>
<pre><code>...
$s = preg_replace_callback("!<field>(.*?)<... | <p>PHP's <a href="http://de2.php.net/manual/en/class.xsltprocessor.php" rel="nofollow noreferrer"><code>XSLTProcessor</code></a> class (<a href="http://de2.php.net/manual/en/book.xsl.php" rel="nofollow noreferrer">ext/xsl</a> - PHP 5 includes the XSL extension by default and can be enabled by adding the argument <code>... | <p>Definitely not regexps. XML formats can change in ways that don't effect their content (in other words: that are invisible to XML-handling libraries), yet are significant to regexps. Such code becomes a maintenance nightmare quickly. </p>
<p>As to which parser to use (SAX, StAX, DOM, JDOM, dom4j, XOM, etc.), </p>
| 42,376 |
<p>I have a Monoprice Maker Select Plus, currently using Ultimaker Cura 3.6.0 with the default settings for a Wanhao Duplicator i3 Plus. Right now when a print finishes, the bed retreats towards the back of the machine. I'd rather present the bed forward for easier part removal.</p>
<p>Here is my ending G-Code:</p>
<... | <p>Note that <a href="https://reprap.org/wiki/G-code#G28:_Move_to_Origin_.28Home.29" rel="nofollow noreferrer">this reference</a> states that:</p>
<blockquote>
<p>Because the behavior of <code>G28</code> is unspecified, it is recommended <strong>not</strong> to automatically include <code>G28</code> in your <strong>... | <p>You're correct that the G28 line should be changed. What I would do is the following:</p>
<pre><code>M104 S0 ;extruder heater off
G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and... | 1,210 |
<p>I ruined several unit tests some time ago when I went through and refactored them to make them more <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" rel="noreferrer">DRY</a>--the intent of each test was no longer clear. It seems there is a trade-off between tests' readability and maintainability. If ... | <p>Readability is more important for tests. If a test fails, you want the problem to be obvious. The developer shouldn't have to wade through a lot of heavily factored test code to determine exactly what failed. You don't want your test code to become so complex that you need to write unit-test-tests.</p>
<p>Howeve... | <p>I don't think there is a relation between more duplicated and readable code. I think your test code should be as good as your other code. Non-repeating code is more readable then duplicated code when done well.</p>
| 15,761 |
<p>I have two unsorted lists and I need to produce another list which is sorted and where all the elements are unique.</p>
<p>The elements can occur multiple times in both lists and they are originally unsorted.</p>
<p>My function looks like this:</p>
<pre><code>(defun merge-lists (list-a list-b sort-fn)
"Merges... | <p>Our neighbourhood friendly Lisp guru pointed out the <a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_rm_dup.htm" rel="nofollow noreferrer">remove-duplicates function</a>.</p>
<p>He also provided the following snippet:</p>
<pre><code>(defun merge-lists (list-a list-b sort-fn test-fn)
(sort (rem... | <p>Sounds like you need to be using Sets.</p>
| 12,523 |
<p>I have a Win32 TreeCtrl where the user can rename the tree labels. I process the TVN_ENDLABELEDIT message to do this.</p>
<p>In certain cases I need to change the text that the user entered. Basically the user can enter a short name during edit and I want to replace it with a longer text.</p>
<p>To do this I chang... | <p>Unless you're using <code>LPSTR_TEXTCALLBACK</code>, the tree-view control is responsible for allocating the memory, not your code, so you shouldn't change the value of the <code>pszText</code> pointer.</p>
<p>To change the item's text in your <code>TVN_ENDLABELEDIT</code> handler, you can use <code>TreeView_SetIte... | <p>You don't want to directly edit the text in the TVITEM struct, the results are undefined. Instead, use the TVM_SETITEM message, or equivalently, use the TreeView_SetItem() macro defined in windowsx.h.</p>
| 12,638 |
<p>Is using SQL Express in a production environment a reasonable choice?</p>
<p>I looked at Microsoft's comparison chart:</p>
<p><a href="https://www.microsoft.com/en-us/sql-server/sql-server-2019-comparison" rel="nofollow noreferrer">https://www.microsoft.com/en-us/sql-server/sql-server-2019-comparison</a></p>
<p>I wo... | <p>I know many people using SQL Express for production and it works well, the biggest limiting factor is the absence of SQL Agent for automated backups. To automate backups you have to either take a VM image (if on a VPS) or use windows scheduler or some other technology.</p>
<p>The only other major limiting factor i... | <p>There's a maximum of 5 concurrent connections for SQL Express. If you have more than 5 concurrent connections performance will drop severely.
Alos, you have to consider that SQL Agent is not included so if you want to schedule backups or maintenance tasks you have to use windows scheduler.
Other that this, it's a pe... | 21,783 |
<p>I'm trying to figure out how all these work together. I know that a DTO is basically just a container of data for the Domain Objects to pass back and forth to forms and such. Does the Domain object contain a DTO or do the DTO and the Domain Object happen to just have all of the same properties that will be mapped ma... | <ul>
<li>The DTO's and the Domain objects should be separate.</li>
<li>There should be a mapper that maps a DTO to a domain object and a domain object to a DTO. This mapper should be an implementation of an interface, with the default mapper using reflection to map the objects to each other.</li>
<li>The repository sh... | <p>I think it's better to have the DTO contain a reference to the Domain object so that the DTO's consumers can begin using the Domain object. That said, if the DTO's consumers must not mutate the Domain object, you may need to have the DTO contain the values encapsulated in the Domain object. This can be difficult sin... | 34,580 |
<p>I want to decode all the HTML entities in a complicated data structure. Basically I'm looking for a "super map()" function. Here's what I have so far:</p>
<pre><code>sub _html_decode {
my $self = shift;
my $ref = shift;
if (ref($ref) eq "HASH") {
$self->_html_decode_hash($ref)
}
if (... | <p><a href="http://search.cpan.org/~bowmanbs/Data-Rmap-0.62/lib/Data/Rmap.pm" rel="nofollow noreferrer">Data::Rmap</a> seems to do this as well. Does anyone have any experience with this module?</p>
| <p>I think this should do, but I haven't tested it.</p>
<pre><code>sub _html_decode {
my ($self, $ref) = @_;
if (ref($ref) eq "HASH") {
for my $value (values %{$ref}) {
$self->_html_decode($value);
}
}
elsif (ref($ref) eq "ARRAY") {
for my $value (@{$ref}) {
... | 49,108 |
<p>I have a class that maintans a reference to a Hashtable and serializes/deserializes that Hashtable. After the call to SerializationInfo.GetValue, the Hashtable is not fully deserialized because the deserialization happens during the IDeserialization calback.</p>
<pre><code>Hashtable hashtable = (Hashtable) info.Get... | <p>This is really an interesting issue. After checking the serialization code with Reflector, I think that there is no generally good soluiton if a referred class uses IDeserializationCallback. </p>
<p>Probably you have seen, that there are two other ways as well to run some code during deserialization, the [OnDeseria... | <p>I suspect you have already googled, but I happened to across <a href="http://clevercoder.wordpress.com/2006/11/30/hashtable-serialization-and-the-ideserializationcallback-interface/" rel="nofollow noreferrer">this</a> pattern yesterday. </p>
<pre><code>public BoringClass(SerializationInfo info, StreamingContext co... | 35,329 |
<p>I am looking for a method of reading emails using Pop3 in C# 2.0. Currently, I am using code found in <a href="http://www.codeproject.com/KB/IP/Pop3MimeClient.aspx?fid=341657" rel="noreferrer">CodeProject</a>. However, this solution is less than ideal. The biggest problem is that it doesn't support emails written in... | <p>I've successfully used <a href="http://sourceforge.net/projects/hpop/" rel="noreferrer">OpenPop.NET</a> to access emails via POP3. </p>
| <p>call me old fashion but why use a 3rd party library for a simple protocol. I've implemented POP3 readers in web based ASP.NET application with System.Net.Sockets.TCPClient and System.Net.Security.SslStream for the encryption and authentication. As far as protocols go, once you open up communication with the POP3 s... | 6,614 |
<p>I have a compiled AppleScript application which I have moved to my windows server. I'd like to then insert a text file into the application (which looks like a zip file on windows):</p>
<pre><code>myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt
</code></pre>
<p>So, I've precompiled the AppleScript to t... | <p>Ok, I figured it out, I changed the second line to this:</p>
<pre><code>set theFile to (POSIX file (theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt"))
</code></pre>
| <p>Reading a file via a file path in a variable.</p>
<p>The 1st two work. The 3rd, which stores the file name in variable does not.</p>
<p>set myData to read file POSIX file ¬
"/Users/sww/Devel/afile.csv"</p>
<p>set myData to read file ¬
"Macintosh HD:Users:sww:Devel:afile.csv"</p>
<pre><code>set fRef ... | 35,561 |
<p>So lets say I'm using Python's <a href="http://www.python.org/doc/2.5.2/lib/module-ftplib.html" rel="nofollow noreferrer">ftplib</a> to retrieve a list of log files from an FTP server. How would I parse that list of files to get just the file names (the last column) inside a list? See the link above for example outp... | <p>Using retrlines() probably isn't the best idea there, since it just prints to the console and so you'd have to do tricky things to even get at that output. A likely better bet would be to use the nlst() method, which returns exactly what you want: a list of the file names.</p>
| <p>I believe it should work for you.</p>
<pre><code>file_name_list = [' '.join(each_file.split()).split()[-1] for each_file_detail in file_list_from_log]
</code></pre>
<p>NOTES - </p>
<ol>
<li><p>Here I am making a assumption that you want the data in the program (as list), not on console.</p></li>
<li><p>each_file_... | 29,406 |
<p>I'm having trouble running a complex query against our company LDAP server. I'm using the following Perl script:</p>
<pre><code>use Data::Dumper;
use Net::LDAP;
die "Can't connect to LDAP-Server: $@\n"
unless $ldap = Net::LDAP->new( 'xLDAPx' );
foreach my $filter ( 'ou=Personal', 'ou=BAR', 'ou=Personal,o... | <p>I think you want it to be more like <code>(&(ou=Personal)(ou=FOO)(o=FOO)(dc=foo)(dc=com))</code>.
But you are not clear at all on what you want exactly, so I can't make a filter for you.</p>
<p>Edited to add: I'm guessing this is what you want to do: <code>(|(ou=Personal)(ou=FOO))</code></p>
| <p>The reason is that you are not providing syntactically correct filter strings, but parts of a DN. I can't imagine this works in Ldap Browser - I just tried myself without success.</p>
<p>The first two are correct filter strings. They filter on a single object attribute in a "({attribute}={value})" fashion. The firs... | 30,038 |
<p>I am attempting to determine prior art for the following idea:</p>
<p>1) user types in some code in a language called (insert_name_here);</p>
<p>2) user chooses a destination language from a list of well-known output candidates (javascript, ruby, perl, python);</p>
<p>3) the processor translates insert_name_here ... | <p>The .NET CLR is designed such that C++.Net, C#.Net, and VB.Net all compile to the same machine language, and you can "decompile" that CLI back in to any one of those languages. </p>
<p>So yes, I would say it already exists though not exactly as you describe.</p>
| <p>This seems a little bizarre. If you're using the term "prior art" in its most common form, you're discussing a potentially patentable idea. If that <strong>is</strong> the case, you have:</p>
<p>1/ Published the idea, starting the clock running on patent filing - I'm assuming, perhaps incorrectly, that you're based... | 43,997 |
<p>I tried GNUBOX which use bluetooth to connect to my computer then to the internet. It's very painful to set up (under windows more than under linux, but it's still painful, it works 1 time on 3).</p>
<p>I own a Nokia 6630 so there is no WLAN support. Is there any emulator? I'd need to know something like max width... | <p>This may sound silly but you could consider getting a mobile tariff with unlimited data. In most European countries these are now available and are not too expensive.</p>
<p>I don't believe you would get a solid experience from any emulator.</p>
| <p>Can you use a data cable and IP pass through? </p>
<p>Since the 6630 is a Symbian phone, you should be able to use GNUbox to handle the connection. See <a href="http://xan.dnsalias.org/gnubox/" rel="nofollow noreferrer">http://xan.dnsalias.org/gnubox/</a></p>
| 17,535 |
<p>I just saw this mentioned in Stack Overflow question <em><a href="http://web.archive.org/web/20090503103538/http://stackoverflow.com:80/questions/7975/best-css-editor" rel="nofollow noreferrer">Best WYSIWYG CSS editor</a></em> and didn't know it could be done. I'm a Visual Studio newbie, so how do you do it?</p>
<p>... | <p>I prefer using <a href="http://en.wikipedia.org/wiki/Firebug_%28software%29" rel="nofollow noreferrer">Firebug</a> for projects I can't use <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2008" rel="nofollow noreferrer">Visual Studio 2008</a> on.</p>
| <p>In Internet Explorer, select <em>View</em> -> <em>Script Debugger</em> -> <em>Open</em>. That should do it.</p>
| 2,981 |
<p>I recently installed vim-enhanced , but I can't find any article/tutorial related to it.All I could find is a page that briefly describes it's new features , along with several RPM's to download .
What exactly does it have to offer to scripting languages that regular vi/vim can't ?</p>
<p>Thanks</p>
| <p>According to <a href="http://linux.maruhn.com/sec/vim-enhanced.html" rel="noreferrer">this</a>, vim-enhanced is just vim "with the perl, python, tcl, and cscope options compiled in." You should be able to find everything you need to know about these compile options in <a href="http://vimdoc.sourceforge.net/htmldoc/h... | <p>If you're new to vim, then run vimtutor</p>
<p>You may also want to start out by reading :help and learning how to use the help system. In particular :help topic (control-D) and :help topic (more useful if you have :set wildmenu) will help you find topics in vim's built-in help (which is notably superior to tryi... | 10,044 |
<p>I need a framework for generating charts for data visualization. I picked up Processing www.processing.org/ but at the moment i can not run that in the "headless" mode from a web server. Is there any other candidate for this domain? What are the options if you need more chart type than what is supported by out-of-th... | <p><a href="http://www.jfree.org/jfreechart/" rel="nofollow noreferrer">JFreeChart</a> is a option, or a software reporting software tool that does all the footwork of data analysis for you. I can recommend <strong><a href="http://www.inetsoftware.de" rel="nofollow noreferrer">i-net Clear Reports</a></strong> seeing as... | <p>I am now using Graphics2D that comes with JDK. With this you are no longer limited to the chart types - simply concentrate of the data pattern and let Graphics2D do it's job. </p>
| 12,839 |
<p>I have a custom control that I created for my project. In this control there are several child controls like a Label, a PictureBox, and a LinkLabel. Other then the LinkLabel, I want the mouse over event currently on the parent control and have the control respond to the mouse over. The background color changes when ... | <p>Your description leads me to believe that you want both your child and your parent controls to respond to a click on the child control.</p>
<p>If I understand your question correctly, I'd suggest subscribing to your child controls' click events and, in those event handlers, calling some common method that manipulat... | <p>Peter Rilling over at CodeProject has some simple and effective code to do event bubbling/broadcasting in winforms (and C#). It's really easy to use.</p>
<p><a href="http://www.codeproject.com/KB/cs/event_broadcast.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/event_broadcast.aspx</a></p>
| 21,756 |
<p>I need to have the output of a PHP snippet in a Plone site. It was delivered to be a small library that has a display() function, in PHP, that outputs a line of text. But I need to put it in a Plone site. Do you have any recommendations?</p>
<p>I was thinking a long the lines of having a display.php that just runs ... | <p>Another option is to run the PHP script on the server using os.popen, then just printing the output. Quick and dirty example:</p>
<pre><code>import os
print os.popen('php YourScript.php').read()</code></pre>
| <p>Probably the easiest way: install <a href="http://plone.org/products/windowz" rel="nofollow noreferrer" title="windowz">windowz</a> inside your site. That way you get a page with an iframe in your plone layout. Make sure the php script outputs a regular html page and configure your windowz page with that url. Done.<... | 41,526 |
<p>Does anyone have C# code handy for doing a ping and traceroute to a target computer? I am looking for a pure code solution, not what I'm doing now, which is invoking the ping.exe and tracert.exe program and parsing the output. I would like something more robust.</p>
| <p>Given that I had to write a TraceRoute class today I figured I might as well share the source code.</p>
<pre><code>using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Text;
using System.Net;
namespace Answer
{
public class TraceRoute
{
private const string Data = "aaaaaaaa... | <p>As am improvement to Scotts code answer above, I found that his solution doesn't work if the route tapers off into nothing before reaching the destination - it never returns. A better solution with at least a partial route could be this (which I've tested and it works well). You can change the '20' in the for loop t... | 17,233 |
<p>I'm porting a Java library to C#. I'm using Visual Studio 2008, so I don't have the discontinued Microsoft Java Language Conversion Assistant program (JLCA).</p>
<p>My approach is to create a new solution with a similar project structure to the Java library, and to then copy the java code into a c# file and convert... | <p>Your doing it in the only sane way you can...the biggest help will be this document from Dare Obasanjo that lists the differences between the two languages:</p>
<p><a href="http://www.25hoursaday.com/CsharpVsJava.html" rel="nofollow noreferrer">http://www.25hoursaday.com/CsharpVsJava.html</a></p>
<p>BTW, change al... | <p>I'm not sure if it is really the best way to convert the code line by line especially if the obstacles become overwhelming. Of course the Java code gives you a guideline and the basic structure but I think at the end the most important thing is that the library does provide the same functionality like it does in Jav... | 20,380 |
<p>Can you please clarify the folowing query? I am not sure if the way I am trying to code is correct. Kindly advise me if I am moving in the right/wrong direction.</p>
<p>I am trying to develop an automation framework using <a href="http://en.wikipedia.org/wiki/HP_QuickTest_Professional" rel="nofollow noreferrer">Qui... | <p>Well, it sounds like you already have the answer.. You just need to handle the expection that occurs when reading in the data within the main loop and make it stop there..</p>
<p>Now, I have not done VBScript for a LONG time so, to pseudo it:</p>
<pre><code>While Not EndOfExcelSheet
ReadDataFromExcel();
If... | <p>It's hard to answer your question based on what you wrote, but the first thing that comes to my mind is to add a boolean parameter to your exception-handling function (let's call it ExceptionHandler). Say, if the parameter (let's call it ExitLoop) is true, you wll exit from the "entire loop", otherwise, continue. ... | 13,926 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.