instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>In MS Excel there is a tool for an iterative calculation of one cell given a condition in an other connected cell (target search is my obvisoly very poor translation from Swedish). I now want to do this whatever-it-is-called in MS Access. Any hint or at least a correct English term would be of great help.</p>
<p>Forgive me if this is a dumb question, but I notice this line in your config file:</p> <blockquote> <p>Arguments=-u C:\app\app_wsgi.py</p> </blockquote> <p>Are you running a WSGI application or a FastCGI app? There <em>is</em> a difference. In WSGI, writing to stdout isn't a good idea. Your program should hav...
<p>On windows, it's possible to launch a proces without a valid stdin and stdout. For example, if you execute a python script with pythonw.exe, the stdout is invdalid and if you insist on writing to it, it will block after 140 characters or something.</p> <p>Writing to another destination than stdout looks like the sa...
46,434
<p>How to make database connection pool in PowerBuilder (v9+) with...</p> <ul> <li>...ODBC?</li> <li>...SQL Server?</li> <li>...Oracle?</li> </ul>
<p>Unfortunately, at least with PB 9, you can't <em>natively</em>. PB has always been a two-tier dev tool. However, if you are using the WebServices support that started in PB 9 you can get around this limitation by invoking WebServices on a connection pooled appServer. I haven't played with PB 11.5 yet BTW. Could ...
<p>@Jason Vogel...</p> <p>You said I can't do <em>natively</em> ...so there is an alternative way to do it?</p>
14,164
<p>I've been tasked with the awesome job of generating a look-up table for our application culture information. The columns I need to generate data for are:</p> <ul> <li>Dot Net Code</li> <li>Version</li> <li>Culture Name</li> <li>Country Name</li> <li>Language Name</li> <li>Java Country Code</li> <li>Java Language C...
<p>Java uses the 2-letter ISO country and language codes. I recommend getting rid of the "Java Country Code" and "Java Language Code" fields in your lookup table, since they would be redundant.</p> <p>I assume that wherever you get your ISO <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" rel="nofollow norefe...
<p>Java uses Locales to store this information. Most of all the information you need regarding it can be found on Sun's <a href="http://java.sun.com/developer/technicalArticles/J2SE/locale/" rel="nofollow noreferrer">Internationalization</a> page. Java uses a syntax similar to the "en-us" syntax, however rather than us...
35,189
<p>Im testing an ASP.NEt site. When I execute it, it starts the ASP.NET Development Server and opens up a page.</p> <p>Now I want to test it in the intranet I have. </p> <ol> <li><p>Can I use this server or I need to configure IIS in this machine? </p></li> <li><p>Do I need to configure something for it to work?</p>...
<p><strong>Yes you can! And you don't need IIS</strong></p> <p>Just use a simple Java TCP tunnel. Download this Java app &amp; just tunnel the traffic back. <a href="http://jcbserver.uwaterloo.ca/cs436/software/tgui/tcpTunnelGUI.shtml" rel="nofollow noreferrer">http://jcbserver.uwaterloo.ca/cs436/software/tgui/tcpTun...
<p>I believe the built in ASP.NET server only works on localhost. You'll have to use IIS.</p>
3,942
<p>i have played around with dynamic data website. is there something similar for winforms. if there isn't anything out there for doing the same with winforms than the question would be why not? we have a massive ERP application that we want to migrate from AS400 to .Net Winform application. my initial thoughts were to...
<p>I would think that WPF would be a better starting point then WinForms, as it has support for style to say how item of data are displayed.</p>
<p>Dynamic data is using the routing functionality of the MVC framework. In Windows forms we don't have this approach of fetching data with URLs from a server.<br> I am not sure how this model could fit into Windows forms.</p> <p>I think it's pretty hard to create something like dynamic data for Windows Forms.<br> My ...
45,006
<p>Is there ever a circumstance in which I would not want to use the <a href="http://msdn.microsoft.com/en-us/library/cb8x3kfz.aspx" rel="noreferrer"><code>AndAlso</code></a> operator rather than the <a href="http://msdn.microsoft.com/en-us/library/sdbcfyzh.aspx" rel="noreferrer"><code>And</code></a> operator? &hellip...
<p>From <a href="http://msdn.microsoft.com/en-us/library/wz3k228a.aspx" rel="noreferrer">MSDN</a>:</p> <p><strong>Short-Circuiting Trade-Offs</strong></p> <p><em>Short-circuiting can improve performance by not evaluating an expression that cannot alter the result of the logical operation. However, if that expression ...
<p>They are completely different functionalities in VB.net and both have their use cases (though for the most common use both will work)</p> <p><code>AndAlso</code> and <code>OrElse</code> are <strong>conditional</strong> operators, they return a true or false boolean value and only evaluate what they need to until the...
7,872
<p>I'm writing an ASP.NET webforms app, and I'm using jQuery for my AJAX calls. This is working well, but on some occasions, the $.getJSON call is causing a full page postback. I am not using the ASP.NET AJAX library anywhere in the app. I can't reproduce the problem on a consistent basis, and am not sure what is causi...
<p>How are you triggering that JavaScript function? </p> <p>If it's a client-side click handler on a control like a Button, you need to be sure to call preventDefault(). Otherwise, the browser will submit the form and cause a postback, even while the AJAX callback is in progress.</p>
<p>Under some circumstances when jQuery can't do a AJAX call, so it creates a hidden iframe and does a normal submit from there. I'm guessing that some how that process is breaking down.</p>
28,612
<p>When you want to add whitespace between HTML elements (using CSS), to which element do you attach it?</p> <p>I'm regularly in situations along these lines:</p> <pre><code>&lt;body&gt; &lt;h1&gt;This is the heading&lt;/h1&gt; &lt;p&gt;This is a paragraph&lt;/p&gt; &lt;h1&gt;Here's another heading&lt;/h1&gt; ...
<p>I tend to use a bottom margin on elements when I want them to have space before the next element, and then to use a ".last" class in the css to remove the margin from the last element.</p> <pre><code>&lt;body&gt; &lt;h1&gt;This is the heading&lt;/h1&gt; &lt;p&gt;This is a paragraph&lt;/p&gt; &lt;h1&gt;Here's ...
<p>I tend to agree with you that the first option is better. It's generally what I like to do. However, there is an argument to be made that you should specify a margin for each one of those elements and zero it out if you don't want to apply it since browsers all handle margins differently. The &lt;p&gt; (and the &...
13,163
<p>I’ve been trying to install Ms SQL Server 2005 for over two weeks now, and I’ve finally gotten to the point where the prerequisites all seem to be in place. Unfortunately, every time I try to install SQL Server itself, I get the following message:</p> <p>“The SQL Server service failed to start. For more information...
<p>I had similar problem while installing SQL Server 2005 on Windows 7 Professional and got error <code>SQL server failed to start</code>. I logged in as a Administrator (my user id is administrator) in windows.</p> <p>SOLUTION</p> <ol> <li><p>Go to services, from control panel -> Administrative Tools</p></li> <li><p...
<p>While that error message is on the screen (before the rollback begins) go to Control Panel -> Administrative Tools -> Services and see if the service is actually installed. Also check what account it is using to run as. If it's not using Local System, then double and triple check that the account it's using has ri...
8,853
<p>I'm using a decimal column to store money values on a database, and today I was wondering what precision and scale to use.</p> <p>Since supposedly char columns of a fixed width are more efficient, I was thinking the same could be true for decimal columns. Is it?</p> <p>And what precision and scale should I use? I ...
<p>If you are looking for a one-size-fits-all, I'd suggest <code>DECIMAL(19, 4)</code> is a popular choice (a quick Google bears this out). I think this originates from the old VBA/Access/Jet Currency data type, being the first fixed point decimal type in the language; <code>Decimal</code> only came in 'version 1.0' st...
<p>I would think that for a large part your or your client's requirements should dictate what precision and scale to use. For example, for the e-commerce website I am working on that deals with money in GBP only, I have been required to keep it to Decimal( 6, 2 ).</p>
27,728
<p>Alright, currently I have my SWF hitting a php file that will go and find all the files I specify to it, add their sizes together and return their combined sizes as one number. I then use this number with a ProgressEvent listener to determine the current percentage of files downloading for that particular section of...
<p>You could do an HTTP HEAD request to the server for the files. This will return the header info (including file size) but not the actual file. You could then make a GET request to load the files.</p> <p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html" rel="nofollow noreferrer">http://www.w3.org/Proto...
<p>If it's absolutely necessary to control how the files are loaded, then I believe Mike Chambers' suggestion to make an HTTP HEAD request is the way to go.</p> <p>However, unless there's a good reason not to, I'd simply begin loading all the files at once and get my file sizes from each file's getBytesTotal method. S...
9,309
<p>I have a number of fairly large printed pieces. The parts, when assembled, form a very large sword. (The model is this: <a href="https://www.thingiverse.com/thing:4178060" rel="nofollow noreferrer">https://www.thingiverse.com/thing:4178060</a>, and is not mine.) It is about 7' from tip to pommel, and individual p...
<p><strong>Previous answer assuming not yet printed</strong>:</p> <p>If you want to drill holes, print smaller guide holes to guide the drill bit. The best glue depends on the material. Printing structures like dovetails makes the connection less dependent on the strength of the glue.</p> <p><strong>Answer with the p...
<p>A stronger joint than glue can be had by welding, albeit uglier and best used in hidden areas. One way to weld is with friction, using a Dremel to spin a piece of filament so fast it heats up and melts with the two plastic pieces you are joining. You tack the pieces together with a couple spot welds, then move along...
1,783
<p>I've been fooling around with the Google App Engine for a few days and I have a little hobby application that I want to write and deploy.</p> <p>However I'd like to set it up so that users are <strong>not</strong> directly accessing the app via appspot.com.</p> <p>Is hosting it through Google Apps and then pointin...
<p>To do this, I believe you need to be using <a href="http://www.google.com/apps/intl/en/business/index.html" rel="nofollow noreferrer">Google Apps</a> and have a custom domain setup for Google Apps. Then, you <a href="https://developers.google.com/appengine/articles/domains" rel="nofollow noreferrer">deploy your app...
<p>It can be easily done using <code>request.getRequestURI()</code> method. If the URL doesn't include your domain, just redirect it to the desired URL using</p> <pre><code>resp.sendRedirect("&lt;your domain&gt;") </code></pre> <p>Otherwise load a error page using </p> <pre><code>request.getRequestDispatcher("&lt;er...
22,313
<p>How do you randomly select a table row in T-SQL based on an applied weight for all candidate rows?</p> <p>For example, I have a set of rows in a table weighted at 50, 25, and 25 (which adds up to 100 but does not need to), and I want to select one of them randomly with a statistical outcome equivalent to the respec...
<p>Dane's answer includes a self joins in a way that introduces a square law. <code>(n*n/2)</code> rows after the join where there are n rows in the table.</p> <p>What would be more ideal is to be able to just parse the table once.</p> <pre><code>DECLARE @id int, @weight_sum int, @weight_point int DECLARE @table TABLE ...
<p>The <em>"incrementally carrying a an accumlating[sic] weight sum"</em> part is expensive if you have a lot of records. If you also already have a wide range of scores/weights (ie: the range is wide enough that most records weights are unique. 1-5 stars probably wouldn't cut it), you can do something like this to p...
8,279
<p>I wanted to know what people used as a best practice for limiting memory on IIS [5/6/7]. I'm running on 32bit web servers with 4GB of physical memory, and no /3GB switch. I'm currently limiting my app pools to 1GB used memory. Is this too low? any thoughts?</p>
<p>All the limits in the application pool are for bad behaving apps. And more specifically:</p> <ol> <li>To prevent the bad app from disturbing to good apps.</li> <li>To try and keep the bad app running as much as possible.</li> </ol> <p>In that light, the answer is of course: It depends.</p> <p>If your application is ...
<p>There's a great <a href="http://blogs.msdn.com/pfedev/archive/2009/01/22/memory-based-recycling-in-iis-6-0.aspx" rel="noreferrer">writeup</a> from a MS Field Engineer about this subject.</p>
45,587
<p>I thought that it would be fun to present some classic CS problems and let people show their algorithm optimization skills. The hope is that we get to see some clever techniques to solve abstract problems that we may be able to implement in practice.</p> <p>Ideally solutions would be presented in pseudo code with a...
<p>Students will only flip the state of those lockers that their number is a divisor of (student 2 flips the even lockers, student 3 flips the lockers divisible by 3, so on and so forth...). So, the only lockers that will remain open after N rounds are those that have an odd number of divisors (because they start clos...
<p><em>Below is the java code using brute force method. It checks for each and every student, and what he does to every particular locker. There is better approach. Assume there are 100 students and 100 lockers. Then Sixth locker will be touched by Student 1, Student 2 and Student 3. 1X1, 2X3, 3X2. But only lockers w...
34,361
<p>I was wondering if there was a way to bind an ArrayList (or any kind of List, for that matter) to a PreparedStatement which will eventually be used to access an Oracle database. I found:</p> <p><a href="https://stackoverflow.com/questions/178479/alternatives-for-java-sql-preparedstatement-in-clause-issue">Prepared...
<p>You can't bind a List to a single parameter in a prepared statement.</p> <p>Generate SQL with the a parameter marker for each element in the list, for example:</p> <pre><code>SELECT NAME FROM ITEM WHERE ID IN (?, ?, ?, ?) </code></pre> <p>Even though you'll generate a new statement for each query, I'd still recom...
<p>Well, judging by the answer to that one, especially the comments to my wrong answer in that question, you can't.</p> <p>See <a href="https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html#996857" rel="nofollow noreferrer">https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html#...
38,957
<p>I am working on designing and building a desktop application. I am thinking about using eclipse or netbeans for the base of this application. However, I have never built on either of these platforms. I am personally leaning to using netbeans because it seams like that platform is an easer learning curve. But, I ...
<p>I can't say enough about the Eclipse RCP platform. I would recommend it for any Java desktop app development. </p> <p>It's free, has great tutorials, and allows cross-platform development of rich desktop applications that use native OS windowing toolkit, meaning that your application will look native in any platfor...
<p>I would use eclipse RCP when you really need a platform to built on top, not just "widgetery" like swing or swt. RCP is rock solid and consistent, modular and very flexible. Once you master it, you get huge benefits. Being a platform it give you the most commonly used things - preference, configurations, automatic u...
7,380
<p>i'm working with a multi-threaded program (using pthreads) that currently create a background thread (PTHREAD_DETACHED) and then invokes pthread_exit(0). My problem is that the process is then listed as "defunct" and curiously do not seems to "really exists" in /proc (which defeats my debugging strategies)</p> <p>I...
<p>You can either suspend the execution of the main process waiting for a signal, or don't detach the thread (using the default <strong>PHTREAD_CRATE_JOINABLE</strong>) waiting for its termination with a <code>pthread_join()</code>.</p>
<p>Not the most elegant design but maybe you could block the main thread before exiting with:</p> <pre><code> while(1) { pause(); } </code></pre> <p>Then you can install a signal handler for SIGINT and SIGTERM that breaks the loop. The easiest way for that is: exit(0) :-).</p>
16,019
<p>Note: The examples below are C# but this problem should not be specific to any language in particular.</p> <p>So I am building an object domain using a variant of the <a href="http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx" rel="nofollow noreferrer">S# Architecture</a>. For those unfamilia...
<p>I just discovered a significantly better approach that works at least with Castle Windsor. By changing the data access object dependencies to properties rather than constructor dependencies Windsor will autofill them after instantiating each object fully.</p> <p>So the following works just fine:</p> <pre><code>pu...
<p>You simply shouldn't have circular dependencies like this. It's just wrong.</p> <p>If you just need to be wrong for a little while to get over the hump, then try using a service locator: a class that knows about the container and resolves dependencies when they are used instead of when your DAO class is being insta...
34,434
<p>As a developer who spent many years working within Visual C++ 6, I'm used to working with the String Table resource to store unicode strings for localization. Is there a resource within Visual Studio 2005 that provides the same? Are there any third party libraries or tools?</p>
<p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.resources.resourcemanager" rel="nofollow noreferrer">ResourceManager</a> is your friend - and yes, Visual Studio still has support for it all in the editor. You might also want to read &quot;<a href="https://learn.microsoft.com/en-us/dotnet/standard/global...
<p>The short answer is "resources.resx" -- if you used a template for your new project, you probably have one already. Open it up, then drop down the "resource type" picker and select Strings. You can access them as (project namespace).Properties.Resources.(string name), though you may need to prepend a "global::" to...
28,450
<p>How can I create unicode console application with Delphi 2009?</p> <p>If I do like this:</p> <pre><code>{$APPTYPE CONSOLE} uses SysUtils; begin writeln('öüğşç سيمانتت'); end. </code></pre> <p>I get the following:</p> <pre><code>ougsc ??????? </code></pre>
<p>I'm not sure that is what you're after, but you can create Unicode console applications in all 32-bit Delphi versions by using the Windows API functions. I just tried with Delphi 4:</p> <pre><code>program test; {$APPTYPE CONSOLE} uses Windows; var s: WideString; i: integer; Written: Cardinal; begin Se...
<p>Windows console cannot display unicode charactes, so try to send output to file with:</p> <pre><code>my_app.exe &gt; unicode_file.txt </code></pre> <p>and try viewing unicode_file.txt with good text editor.</p>
33,205
<p>I have a query that has a list of base values and a list of language values. Each value has a key that matches to the other. The base values are stored in one table and the language values in another. My problem is that I need to get all matching base values removed from the QUERY except for one. Then, I export ...
<p>Hrm, still not real clear on what the issue truly is, but let me give it a go.</p> <p>Tables:</p> <pre> BASE_VALUES ------------------ BASE_VALUE_RK BASE_VALUE_NAME RESOURCE_VALUES (these are the translations, I'm guessing) ----------------------- RESOURCE_KEY RESOURCE_LANGUAGE_ID RESOURCE_VALUE </pre> <p>You wa...
<p>If you need to remove all matches except for one, why not delete all the matching ... matches ... we need better terms ... and then insert the correct one. EG, if you need to update the matches between items 12 and 13 in the base pair table, do something like</p> <pre><code>delete from matchtable where (id1 = 12 a...
25,201
<p>I am trying to run a VB application that was coded long back on Windows 2000. My current OS is windows XP SP2. </p> <p>The error message is: "Component 'MSCOMCT2.OCX' or one of its dependencies not correctly registered: a file is missing or invalid"</p> <p>I searched my computer for this file (this is different ...
<p>You can also check out this Microsoft-based 'Help and Support' page that details where you can 'officially' download this page from.</p> <p><a href="http://support.microsoft.com/kb/297381" rel="noreferrer">http://support.microsoft.com/kb/297381</a></p> <p>Microsoft tends to move around its content, making old page...
<p>I think, you need the runtime files for Visual Basic (<a href="http://www.microsoft.com/downloads/details.aspx?familyid=bf9a24f9-b5c5-48f4-8edd-cdf2d29a79d5&amp;displaylang=en" rel="nofollow noreferrer">available here</a>).</p>
35,916
<p>Microsoft Access is a slick way to access data in a MS SQL Server backend database, but I've always had problems accessing (so to speak) large tables of data, especially when trying to toggle between results and design mode in Access.</p> <p>Access gives me a number of nifty things, not the least of which is Crosst...
<p>The ODBC driver will pass as much work as possible to SQL Server but as soon as you use a vba function like Nz or non-SQL Server syntax like PIVOT then the ODBC driver must pull back more data and indexes to get the work done on the client side.</p> <p>As per other answer either build your views in SQL Server and l...
<p>Unfortunately Access is not able to push a lot of that work to the server, and yes, it will do huge table scans when designing queries against multiple tables or views in SQL Server.</p> <p>You can build and tweak queries (views) in SQL Server using SSMS and store the views in SQL Server for a massive performance b...
24,821
<p>Here is an example:</p> <pre><code> &lt;h:outputText value="#{myBean.myMoney}"&gt; &lt;f:convertNumber type="currency" currencySymbol="$" /&gt; &lt;/h:outputText&gt; </code></pre> <p>Given that I have $1.006, will this output $1.00 or $1.01?</p> <p>Doesn't say here: <a href="http://java.sun.com/java...
<p>Answer=Rounded</p> <p>Hmmm....does that sound right? I don't think its a good idea to be rounding up money. Hopefully no banking apps are going to rely on this one.</p> <p>Brings to mind this scene from One Flew Over the Cuckoo's Nest...</p> <blockquote> <p>[the inmates are playing cards and betting with ciga...
<p>Currency can be set only to 2 decimal places, setting it to more than 2 decimal places is wrong. If the input is with more than 2 decimal places the output would be truncated to 2 decimal places. </p> <p>Logically $1.001 would not make any sense as $1 and 1 cent would be $1.01 not $1.001.</p>
49,653
<p>I've been trying to SSL working on my IW program for the last little while and I keep running up against the 'Could not load SSL Library'. I've followed every piece of advice I could find on the subject, but still no joy. I've tried the suggested DLLs in both the local directory and in system32.</p> <p>Does anyone ...
<p>You need the OpenSSL dlls (0.9.8i worked for me, but I'm not using Vista), which you can download <a href="http://www.slproweb.com/products/Win32OpenSSL.html" rel="nofollow noreferrer">here</a> (as I think you're suggesting, the Indy dlls don't work with IW9, which is the version bundled with D2007).</p> <p>After i...
<p>I am the one who has built the aforementioned special build of IntraWeb SSL dlls. To complete the answers above let me explain why there has been the need for a special build:</p> <p>Previous Indy and IntraWeb editions used a slightly modified version of OpenSSL. The modifications include several functions related ...
26,185
<p>I am using several NSButtonCell objects in an NSTableView. They are simple square buttons with custom images on them.</p> <p>These buttons draw properly when they are not highlighted: all that is visible is the image, and the rest of the button rectangle is transparent. However, when I click on them, the entire but...
<p>Try setting your cell's <code>highlightsBy</code> property to <code>NSContentsCellMask</code>. I think you'll have to do this in code (probably in <code>awakeFromNib</code>); I don't see a way to do it in IB alone.</p>
<p>You can do it in Interface Builder too. I use "<code>Square Button</code>" so the button alters between two images (so the image is not inverted at all).</p> <p>Your buttons behaviour is probably set to "<code>Momentary Light</code>" or "<code>Momentary Push In</code>".</p> <p>Set the <code>Behaviour</code> to "<c...
38,592
<p>How can I refer a custom function in xml? Suppose that I have a function written in Java and want it to refer by the xml tag, how is this possible?</p> <p>Current senario: I am using XACML2.0 which contains xml tags and I want to refer some function in Java that will talk to the backend data, I'm unable to refer a...
<p>You should read up on Reflection in Java.</p> <p>The following example would invoke the method </p> <p>myObjectThatContainsMethod#methodNameAsString(Integer arg1, Integer arg2)</p> <pre><code>Integer[] params = {new Integer(123),new Integer(567)}; Class cl=Class.forName("stringParsedFromYourXML"); Class[] par=n...
<p>First, you need to choose an implementation of XACML. You should take one that is written in Java, to make things simpler.</p> <p>Everything else depends on the chosen implementation. The implementation should document how to add custom functions. If it's not documented, ask the authors.</p>
34,961
<p>When a web application running and on close the browser window then which event raise?</p>
<p><strong>onunload</strong> is the event raised when closing the browser window. </p> <p>How ever this event isn't fired only when closing the browser, that's just one case.</p>
<p>The web browser doesn't send any notification to the web server when the user closer the window.</p>
40,945
<p>I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects.</p> <p>In OpenGL light positions get transformed just like everything else with the MODELVIEW...
<p>The answer I discovered eventually was that while OpenGL only has its one amalgamated <code>MODELVIEW</code> matrix, in D3D the "world" and "view" transforms are kept separate, and placing lights seems to be the major reason for this. So the answer is you use <code>D3DTS_VIEW</code> to set up matrices that should a...
<p>For the fixed function pipeline, the lights position and direction are set in world space. The docs for the light structures do tell you that, but I'm not surprised that you missed it in the docs. There's not much information on the fixed function pipeline anymore as the focus has to programmable shaders.</p>
9,724
<p>I'm assigned to a project where my code is supposed to perform uploads and downloads of some files on the same FTP or HTTP server simultaneously. The speed is measured and some conclusions are being made out of this.</p> <p>Now, the problem is that on high-speed connections we're getting pretty much expected result...
<p>CDMA 1x consists of up to 15 channels of 9.6kbps traffic. This results in a total throughput of 144kbps.</p> <p>Two channels are used for command and control signals (talking to base stations, associating/disassociating, SMS traffic, ring signals, etc).</p> <p>That leaves you with up to 124.8kbps.</p> <p>--> Eac...
<p>I think the whole drama with high equal speeds on both directions is because my higher body thinks that they have 144 kbps on uplink AND 144 kbps on DOWNLINK (== TWO pipes). Whereas in reality we have 144 kbps of ONE pipe which is switching directions when I transfer files.</p> <p>Comment me if I right or wrong, pl...
40,127
<p>I started an application in Google App Engine right when it came out, to play with the technology and work on a pet project that I had been thinking about for a long time but never gotten around to starting. The result is <a href="http://www.bowlsk.com" rel="noreferrer">BowlSK</a>. However, as it has grown, and fe...
<p>First, I would suggest you have a look at "<a href="http://sites.google.com/site/io/rapid-development-with-python-django-and-google-app-engine" rel="noreferrer">Rapid Development with Python, Django, and Google App Engine</a>"</p> <p>GvR describes a general/standard project layout on page 10 of his <a href="http://...
<p>I am not entirely up to date on the latest best practices, et cetera when it comes to code layout, but when I did my first GAE application, I used something along your second option, where the code and templates are next to eachother.</p> <p>There was two reasons for this - one, it kept the code and template nearby...
7,089
<p>I have now worked on two different teams that use the Agile/Scrum approach in the last two years and both teams were eager to improve the way they approach software development. In the first team, we could easily convince our product owner to get time for internal things like improving the build system, setting up b...
<p>Great question. I think there are several flavors of "action items" from retrospectives that deserve different approaches.</p> <p>1) technical tasks to address things like technical debt or infrastructure improvements - like "We should ensure we have no database calls in the view layer of our application, cuz that ...
<p>No, one shall <em>not</em> create technical user stories: theoretically, and since they generally bring no direct value to the customer, they have very few chances to be selected in an iteration. Convincing the Product Owner is an option to alleviate this, but there is another tool that can be used here : slack.</p>...
26,161
<p>Writing the code for the user authentication portion of a web site (including account registration, logins, and password resets) is pretty simple, but what do you need to make a really <em>good</em> user authentication setup? For example, I'd consider not storing plaintext passwords to be a bare minimum requirement...
<p><strong>Encryption</strong></p> <p>There was a question about this yesterday - "<a href="https://stackoverflow.com/questions/287597/why-should-i-care-about-hashing-passwords-anyway">Why should I care about hashing passwords anyway?</a>" which covers all the reasons why you should do this. </p> <p><strong>Captcha</...
<p>MSDN ran an article that touches on some of these issues; a copy is available <a href="http://www.jeffblankenburg.com/2008/10/6-tips-for-making-website-registration.aspx" rel="nofollow noreferrer">here</a>. Most of the suggestions mirror ideas here; one additional idea off of that article is to "track the traffic t...
37,102
<p>sorry about the title :)</p> <p>Here is my basic problem, I trying to implement an SEO type query for a location.</p> <p>Here are my examples</p> <ul> <li>/Leeds</li> <li>/Leeds_England</li> <li>/Hampshire_England</li> <li>/England_Leeds</li> <li>/Europe_England</li> </ul> <p>I am trying to get the location, now...
<p>The concern that I have with unordered splitting is the possibility of running into duplicates. Please forgive my Yankee ignorance regarding European geography, and give it to you in the US geography that I am more familiar with.</p> <p>Las Vegas is a good place to start. People think of Las Vegas, that tropical ...
<p>Logic aside, I do have one recommendation. When building location based URLs, I have always found it easier to work with the largest geographical location and work to the smallest. It is a logical assumption that the each additional "refinement" is more targeted than the parent. Define a strict pattern and stick ...
40,707
<p>Recently Jeff has <a href="http://blog.codinghorror.com/deadlocked/" rel="noreferrer">posted</a> regarding his trouble with database deadlocks related to reading. <a href="https://en.m.wikipedia.org/wiki/Multiversion_concurrency_control" rel="noreferrer">Multiversion Concurrency Control (MVCC)</a> claims to solve t...
<p>Oracle has had an excellent multi version control system in place since very long(at least since oracle 8.0)</p> <p>Following should help.</p> <ol> <li>User A starts a transaction and is updating 1000 rows with some value At Time T1</li> <li>User B reads the same 1000 rows at time T2.</li> <li>User A updates row 5...
<p>DB2 version 9.7 has a licensed version of postgress plus in it. This means that this feature (in the right mode) supports this feature. </p>
4,710
<p>I am sure there are many developers out here who have team spread across different time zones. What are some of the challenges people face and whats the best way to tackle them?</p>
<p>In all honesty, any company that has split development of a project across time zones is out of touch with the realities of engineering. The MBAs, in an attempt to save themselves a buck or two, foist upon their engineers the unenviable position of altering the schedules of their lives - leading to high stress, lon...
<p>We have these kinds of issues with support - we are using 3 commercial SDKs and the support teams are in distant time zones (8-10 hours difference). Moreover, not all work days overlap.</p> <p>This fact had a big impact on my reverse engineering abilities :)</p>
40,661
<p>It's possible, but is it appropriate to use SHFileOperation within a Windows service? All those SHxxx API functions in shell32.dll seem to have been written with user level programs in mind. Can I be certain SHFileOperation won't display GUI ever?</p>
<p>I would say, not it's not appropriate or advisable. Most of the shell32 APIs were written with a basic understanding that they would be used in interactive processes. I don't think there is any way you can guarantee that SHFileOperation will never display a UI component. In fact, if you look at <a href="http://msdn....
<p>I had this issue as well and working at implementing a secure and reliable network file copy between servers and network shares ( most of these shares are CIFS / NetApp filer based ) and <code>SHFileOperation</code> fails from time to time.</p> <p>now started using <code>ROBOCOPY</code> (available by default in all...
24,690
<p>gnuplot is giving the error: "sh: kpsexpand: not found." </p> <p>I feel like the guy in Office Space when he saw "PC LOAD LETTER". What the heck is kpsexpand?</p> <p>I searched Google, and there were a lot of pages that make reference to kpsexpand, and say not to worry about it, but I can't find anything, anywhere...
<p>kpsexpand, kpsetool and kpsepath are all wrappers for kpsewhich that deals with finding tex-related files kpsexpand is used to expand environment varibles. Say $VAR1 is "Hello World" and $VAR2 is "/home/where/I/belong" then</p> <pre><code>$ kpsexpand $VAR1</code></pre> <p>will return</p> <pre><code>Hello World</c...
<p>This is on the first page of google search results for "kpexpand gnuplot":</p> <p><a href="http://dschneller.blogspot.com/2007/06/visualize-hard-disk-temperature-with.html" rel="nofollow noreferrer">http://dschneller.blogspot.com/2007/06/visualize-hard-disk-temperature-with.html</a></p> <p>It says that you do not ...
9,493
<p>Can someone explain how PHP implements associative arrays? What underlying data structure does PHP use? Does PHP hash the key and store it in some kind of hash map? I am curious because I was wondering what the performance of associative arrays where when inserting and searching for keys.</p>
<p>Well, for what it is worth, <strong>all</strong> PHP arrays are Associative arrays.</p>
<p>It's all hash tables, according to sources in various web forums: <a href="http://www.usenet-forums.com/php-language/15348-zend-engine-array-implementation.html" rel="nofollow noreferrer">http://www.usenet-forums.com/php-language/15348-zend-engine-array-implementation.html</a></p> <p>If you want to be sure, read th...
30,738
<p>I have a block of code that works and I wanted to ask what exactly is happening here?</p> <pre><code>Class&lt;?&gt; normalFormClass = null; </code></pre> <p>---added---</p> <p>The wildcard "<code>&lt;?&gt;</code>" is the part that is confusing for me. Why would this be used rather than not using it (generics)?</...
<p>That means it can be a Class of any type. ? is a wildcard denoting the set of all types, or 'any'. So you can later do</p> <pre><code>Integer normalForm = new Integer(); normalFormClass = normalForm.getClass(); </code></pre> <p>or</p> <pre><code>String normalForm = new String(); normalFormClass = normalForm.getCl...
<p>I doubt this is homework, since I've never been in a class that talked about reflection.</p> <p>But this is a simple null assignment. It doesn't do anything.</p>
37,107
<p>Let's say I've got Alpha things that may or may not <em>be</em> or be <em>related to</em> Bravo or Charlie things.</p> <p>These are one-to-one relationships: No Alpha will relate to more than one Bravo. And no Bravo will relate to more than one Alpha.</p> <p>I've got a few goals:</p> <ul> <li>a system that's eas...
<p>If you want each Alpha to be related to by only one Bravo I would vote for the possibility with using a combined FK/PK:</p> <pre><code> Bravos -------- FK PK AlphaId BravoOne BravoTwo BravoThree </code></pre> <p>This way one and only one Bravo may refer to your Alphas.</p> <p>If the B...
<p>I'd go with option 1 unless I had a significant reason not to. It might not cost you as much space as you think, esp. if you are using varchars in Bravo. Don't forget that splitting it will cost you for foreign keys, secondary identity and needed indexes. <p>A place where you might run into trouble is if Bravo is un...
8,135
<p>How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++?</p> <p>The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu private functions and data, and ext...
<p>Having just started on pretty much the same thing a few months ago (on a ten-year-old commercial project, originally written with the "C++ is nothing but C with smart <code>struct</code>s" philosophy), I would suggest using the same strategy you'd use to eat an elephant: take it one bite at a time. :-)</p> <p>As mu...
<p>If you have a small or academic project (say, less than 10,000 lines), a rewrite is probably your best option. You can factor it however you want, and it won't take too much time.</p> <p>If you have a real-world application, I'd suggest getting it to compile as C++ (which usually means primarily fixing up function ...
24,338
<p>I'm using TNMHTTP in Delphi to retrieve the code from a webpage. The code is relatively simple:</p> <pre><code>NMHTTP1 := TNMHTTP.Create(Self); NMHTTP1.InputFileMode := FALSE; NMHTTP1.OutputFileMode := FALSE; NMHTTP1.ReportLevel := Status_Basic; NMHTTP1.TimeOut := 3000; URL := 'http://www....'; NMHTTP1.Get(URL); ...
<p>The wireup isn't done at compile-time. It's done at runtime. As described in this article:</p> <p><a href="http://odetocode.com/Blogs/scott/archive/2006/02/16/2914.aspx" rel="noreferrer">http://odetocode.com/Blogs/scott/archive/2006/02/16/2914.aspx</a></p> <p>There IS a performance penalty because of the calls to ...
<p>The performance is 0, because once wired up (once your application is compiled in memory), it never has to do it again. What I mean by that is, the ASP.NET framework isn't constantly itterating through every method by name to see if it should be wired up.</p> <p>But, I strongly suggest you turn it off, because it u...
32,085
<p>I have been doing some java development lately and have started using Eclipse. For the most part, I think it is great, but being a C/C++ guy used to doing all of his editing in vim, I find myself needlessly hitting the Esc key over and over.</p> <p>It would be really nice if I got all the nice features of Eclipse,...
<p><a href="http://vrapper.sourceforge.net/home/" rel="noreferrer">Vrapper</a>:</p> <blockquote> <p>an Eclipse plugin which acts as a wrapper for Eclipse text editors to provide a Vim-like input scheme for moving around and editing text.</p> <p>Unlike other plugins which embed Vim in Eclipse, Vrapper imitates t...
<p><a href="https://marketplace.eclipse.org/content/viable-vim-eclipse" rel="nofollow noreferrer">Viable</a> has pretty much what you are looking for along with some extra features which none of the other plugins for eclipse seem to have, like some support for visual block mode, command line history, window splitting, ...
4,841
<p>I'm using the <code>QMdiArea</code> in Qt 4.4.</p> <p>If a new project is created, I add a number of sub windows to a <code>QMdiArea</code>. I'd like to disallow the user to close a sub window during runtime. The sub windows should only be closed if the whole application is closed or if a new project is created.</p...
<p>You need to define your own <code>subWindow</code>. create a subclass of <code>QMdiSubWindow</code> and override the <code>closeEvent(QCloseEvent *closeEvent)</code>. you can control it by argument. for example:</p> <pre><code>void ChildWindow::closeEvent(QCloseEvent *closeEvent) { if(/*condition C*/) closeEv...
<p>You'd do this the same as for a top-level window: process and ignore the QCloseEvent it sent. QMdiArea::closeActiveSubWindow/QMdiArea::closeAllSubWindows just call QWidget::close, which sends a closeEvent and confirms that it was accepted before proceeding.</p> <p>You can process this event by subclassing QMdiSubWi...
40,701
<p>I work on communication devices for people with disabilities that prevent them from speaking. This can be anything from a board with symbols on, to a relatively sophisticated app. </p> <p>Some potential users also have sight issues and have to distinguish symbols by feel (these particular users have cognitive dis...
<p>If you install inkscape, pstoedit and ghostscript version 9.21 (not the latest as pstoedit is incompatible) you can get the file into a format that openscad can import using two commands in a cmd file </p> <pre><code>"C:\Program Files\Inkscape\inkscape" -E "traffic lights.eps" "traffic lights.svg" "C:\Program Fi...
<p>Nothing thats works via scripting BUT is really simple and easy.</p> <ol> <li>register on tinkercad.com (I know register is a bummer but its a great tool)</li> <li>open a new design</li> <li>import *.svg file</li> <li>adjust height or size of the converted object</li> <li>download .stl</li> </ol> <p>Thats going to...
759
<p>A mutex is a programming concept that is frequently used to solve multi-threading problems. My question to the community: </p> <p>What is a mutex and how do you use it?</p>
<p>When I am having a big heated discussion at work, I use a rubber chicken which I keep in my desk for just such occasions. The person holding the chicken is the only person who is allowed to talk. If you don't hold the chicken you cannot speak. You can only indicate that you want the chicken and wait until you get...
<p>Mutex: Mutex stands for <strong>Mut</strong>ual <strong>Ex</strong>clusion. It means only one process/thread can enter into critical section at a given time. In concurrent programming multiple threads/process updating the shared resource (any variable, shared memory etc.) may lead to some unexpected result. ( As the...
5,483
<p>According to <em>Cocoa Programming for Mac OS X, 3rd Edition,</em> on page 202 (chapter 13):</p> <blockquote> <p>You will be registering, reading, and setting defaults in several classes in your application. To make sure that you always use the same name, you should declare those strings in a single fil...
<p>Just to be clear, the recommendation is to create <em>immutable</em> global variables instead of in-line string constants (hard to refactor and no compile-time checking) or #defines (no compile-time checking). Here's how you might do so...</p> <p>in MyConstants.h:</p> <pre><code>extern NSString * const MyStringCon...
<p>It depends on the design of your software. Suppose you have a job management software and one of your "defaults" is a list of directories in which various items can be saved. </p> <p>For each Job you can have a storagefile member that is a singleton that load up the user preferred locations at startup. </p> <p>Or ...
43,893
<p>I am to take up the task of porting a C++ networking application code base of quite a size from Solaris to Linux platform. The code also uses third party libraries like ACE. The application when written initially was not planned for a possible porting in future. </p> <p>I would like to get some advice and suggestio...
<p><strong>"There is no such thing as a portable application only applications that have been ported"</strong></p> <p>First start with using the same tools on both platforms, if you can. I.E. if the Solaris version has not been changed to use GCC and GNU make etc, I advise you to change this first and get the Solaris ...
<p>List what your current external dependencies are. Find what of these are available on Linux. For those that aren't, you have to find a replacement. If the references to those external dependencies aren't abstracted away behind functions or objects, refactor the code so it is so. Then replace the dependencies, so you...
48,944
<p>I'm experimenting with adding icons to a shell extension. I have this code (sanitized for easy reading), which works:</p> <pre><code>InsertMenu(hmenu, index, MF_POPUP|MF_BYPOSITION, (UINT)hParentMenu, namestring); </code></pre> <p>The next step is this code:</p> <pre><code>HICON hIconLarge, hIconSmall; ICONINFO o...
<p><a href="http://capify.org/" rel="noreferrer">Capistrano</a> is pretty handy for that. There's a few people using it (<a href="http://www.simplisticcomplexity.com/2006/8/16/automated-php-deployment-with-capistrano/" rel="noreferrer">1</a>, <a href="http://www.contentwithstyle.co.uk/Blog/178" rel="noreferrer">2</a>, ...
<p>I had marked a post on how to deploy your websites using Subversion : <a href="http://blog.lavablast.com/post/2008/02/I2c-for-one2c-welcome-our-new-revision-control-overlords!.aspx" rel="nofollow noreferrer">http://blog.lavablast.com/post/2008/02/I2c-for-one2c-welcome-our-new-revision-control-overlords!.aspx</a></p>...
12,202
<p>Say I have a line in an emacs buffer that looks like this:</p> <pre><code>foo -option1 value1 -option2 value2 -option3 value3 \ -option4 value4 ... </code></pre> <p>I want it to look like this:</p> <pre><code>foo -option1 value1 \ -option2 value2 \ -option3 value3 \ -option4 value4 \ ... </cod...
<p>Nobody had what I was looking for so I decided to dust off my elisp manual and do it myself. This seems to work well enough, though the output isn't precisely what I asked for. In this version the first option goes on a line by itself instead of staying on the first line like in my original question.</p> <pre class...
<p>Personally, I do stuff like this all the time.</p> <p>But I don't write a function to do it unless I'll be doing it every day for a year.</p> <p>You can easily do it with query-replace, like this:</p> <p>m-x (query-replace " -option" "^Q^J -option")</p> <p>I say ^Q^J as that is what you'll type to quote a new...
9,443
<p>Is it possible to add an image overlay to a google map that scales as the user zooms?</p> <p>My current code works like this:</p> <pre><code>var map = new GMap2(document.getElementById("gMap")); var customIcon = new GIcon(); customIcon.iconSize = new GSize(100, 100); customIcon.image = "/images/image.png"; map.a...
<p>There is a zoomend event, fired when the map reaches a new zoom level. The event handler receives the previous and the new zoom level as arguments.</p> <p><a href="http://code.google.com/apis/maps/documentation/reference.html#Events_GMap" rel="nofollow noreferrer">http://code.google.com/apis/maps/documentation/refe...
<p>There is a zoomend event, fired when the map reaches a new zoom level. The event handler receives the previous and the new zoom level as arguments.</p> <p><a href="http://code.google.com/apis/maps/documentation/reference.html#Events_GMap" rel="nofollow noreferrer">http://code.google.com/apis/maps/documentation/refe...
30,978
<p>I was always wondering if there is operator for deleting multi dimensional arrays in the standard C++ language.</p> <p>If we have created a pointer to a single dimensional array</p> <pre><code>int *array = new int[size]; </code></pre> <p>the delete looks like:</p> <pre><code>delete [] array; </code></pre> <p>Th...
<p>Technically, there aren't two dimensional arrays in C++. What you're using as a two dimensional array is a one dimensional array with each element being a one dimensional array. Since it doesn't technically exist, C++ can't delete it.</p>
<p>delete[] applies to any non-scalar (array).</p>
24,117
<p>I've been reading through a few tutorials about css, and I saw two different ways to state which css file should be used to style the page:</p> <pre><code>&lt;style type="text/css"&gt;@import url("style.css");&lt;/style&gt; </code></pre> <p>and</p> <pre><code>&lt;link rel="stylesheet" type="text/css" href="style....
<p>According to <a href="http://developer.yahoo.com/performance/rules.html#csslink" rel="nofollow noreferrer">Yahoo's "Best Practices for Speeding Up Your Web Site"</a> using <strong>@include</strong> behaves like putting the &lt;link&gt; at the bottom of the page in <em>Internet Explorer</em>.</p> <p>Having the CSS l...
<p>the first one is, in fact, an embedded CSS that refers to another file; while the second one is a direct refer from HTML to CSS.</p> <p>i can't think of a reason to use the first one.</p>
41,612
<pre><code>function holiday_hitlist($tablename, $hit_user){ global $host, $user, $pass, $dbname; $link = mysql_connect($host, $user, $pass, $dbname); print "&lt;div class=\"hit_list\"&gt; &lt;h3&gt;My Holiday Hitlist&lt;/h3&gt; &lt;p&gt;Five things I want the most, based on my des...
<p>See the line </p> <pre><code>$output = print "&lt;li&gt;&lt;a href=\"$url\" target=\"_blank\"&gt;$title&lt;/a&gt; $price&lt;/li&gt;"; </code></pre> <p>you should probably remove the print after the $output =</p> <p>Or maybe you just need to remove the $output =</p> <p>I am not quite sure what you intend.</p> <p...
<p>From what you've written i think you are doing something like:</p> <pre><code>function holiday_hitlist($tablename, $hit_user){ /* connections etc */ while($row = mysql_fetch_array($result)) { $title = $row['title']; $url = $row['URL']; $price = "$" . $row['price']; $output = print "&lt;li&gt...
47,234
<p>I'm setting up a User Control driven by a XML configuration. It is easier to explain by example. Take a look at the following configuration snippet:</p> <pre><code>&lt;node&gt; &lt;text lbl="Text:"/&gt; &lt;checkbox lbl="Check me:" checked="true"/&gt; &lt;/node&gt; </code></pre> <p>What I'm trying to achieve t...
<p>One weekend later, here is what I came with as a solution. My main goal was to find something that will both work and allow you to keep specifying the exact content of the Item Template in markup. Doing things from code would work but can still be cumbersome.</p> <p>The code should be straight forward to follow, bu...
<p>You need something that looks more like this:</p> <pre><code>&lt;ItemTemplate&gt; &lt;%# GetContent(Page.GetDataItem()) %&gt; &lt;/ItemTemplate&gt; </code></pre> <p>And then have all your controls generated in the code-behind. </p>
34,529
<p>Here's a very simple Prototype example.</p> <p>All it does is, on window load, an ajax call which sticks some html into a div.</p> <pre class="lang-html prettyprint-override"><code>&lt;html&gt; &lt;head&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;scriptaculous/lib/prototype.js&quot;&gt;&lt;...
<p>The first letter of AJAX stands for "asynchronous". This means that the AJAX call is performed in the background, i.e. the AJAX request call <em>immediately returns</em>. This means that the code immediately after it is normally actually executed <em>before</em> the onSuccess handler gets called (and before the AJAX...
<p>Without having tried your code: The AJAX call is executed asynchronously. Meaning that your Ajax.Request fires, then goes on to the click1() call that tells you the div is empty. At some point after that the Ajax request is finished and content is actually put into the div. At this point the onSuccess function is ex...
10,080
<p>I'm implementing an audit log on a database, so everything has a CreatedAt and a RemovedAt column. Now I want to be able to list all revisions of an object graph but the best way I can think of for this is to use unions. I need to get every unique CreatedAt and RemovedAt id.</p> <p>If I'm getting a list of countrie...
<p>You have most likely already implemented your solution, but to address a few issues; I would suggest considering Aleris's solution, or some derivative thereof. <br/></p> <p><li> In your tables, you have a "removed at" field -- well, if that field were active (populated), technically the data shouldn't be there -- ...
<p>You could probably do it with a cross join and coalesce, but the union is probably still better from a performance standpoint. You can try testing each though.</p> <pre><code>SELECT COALESCE(C.CreatedAt, P.CreatedAt) FROM dbo.Countries C FULL OUTER JOIN dbo.Provinces P ON 1 = 0 WHERE C.LocalID =...
27,227
<p>I am printing a print using PLA on a Prusa i3 printer and an MK8 extruder, at 210 degrees celsius, 60 mm/sec, sliced with slic3r. The print consists of a base, with 4 tower-like projections that then join with a near-vertical overhang slope that isn't posing a problem for my printer.</p> <p>However, even before the...
<p>Stringing is often a result of too-high a temperature, or insufficient retraction. When there is highly liquid filament in the nozzle tip, it can adhere to the remainder of the print while dripping as the nozzle moves, leading to a thin string of the filament forming. As further travel moves are performed in each la...
<p>Here's just a few of the things you might want to look into.</p> <ul> <li>plastic - some plastic types are more stringy than others and there's also variation between brands and colors.</li> <li>moisture in filament - water turning to steam tends to cause the extruder to ooze when it isn't printing, which can cause...
99
<p>I'm in the process of trying to hack together the first bits of a kernel. I currently have the entire kernel compiled down as C code, and I've managed to get it displaying text in the console window and all of that fine goodness. Now, I want to start accepting keyboard input so I can actually make some use of the th...
<p>If you are compiling with gcc, unless you are using the crazy ".code16gcc" trick the linux kernel uses (which I very much doubt), you cannot be in real mode. If you are using the GRUB multiboot specification, GRUB itself is switching to protected mode for you. So, as others pointed out, you will have to talk to the ...
<p>Just an idea: looking at <a href="https://gna.org/projects/grub4dos/" rel="nofollow noreferrer">GRUB for DOS</a> source (asm.s), the <code>console_checkkey</code> function is using BIOS <code>INT 16H Function 01</code>, and not function 00, as you are trying to do. Maybe you'd want to check if a key is waiting to be...
26,755
<p>How do I drop a Groovlet into a Grails app? Say, for example, in web-app/groovlet.groovy</p> <pre> import java.util.Date if (session == null) { session = request.getSession(true); } if (session.counter == null) { session.counter = 1 } println """ &lt;html> &lt;head> &lt;title>Groovy Servlet&lt;/...
<ol> <li><code>grails install-templates</code></li> <li>Edit <code>src/templates/web/web.xml</code> to include your groovlet</li> <li><code>grails war</code></li> <li>deploy</li> </ol> <p>I've not personally done this to incorporate a groovlet, but this is the documented way to modify the deployed Grails <code>web.xml...
<p>The way I understand it, groovlets are used when you have a Servlet container with Groovy scripting support, </p> <p>I think in Grails you would need to move your business logic code to a <a href="http://grails.org/Controllers" rel="nofollow noreferrer">controller</a> and leave the view part to an HTML or a <a href...
29,952
<p>Is there an easy way to get a conflict summary after running a <code>cvs update</code>? </p> <p>I work on a large project and after doing some work I need to do an update. The list of changes coming back from the cvs update command is several pages long and I'd like to see only the list of conflicts (starts with ...
<p>Given the specification, it seems that you need a minor adaptation of Martin York's solution (because that only shows the conflicts and not the normal log information). Something like this - which might be called 'cvsupd':</p> <pre><code>tmp=${TMPDIR:-/tmp}/cvsupd.$$ trap "rm -f $tmp; exit 1" 0 1 2 3 13 15 cvs upd...
<p>I don't have cvs handy what is the exact format of the output of cvs update</p> <p>I seem to remember C &lt;filename&gt;<br> If so you could use:</p> <blockquote> <p>cvs update | tee log | grep "^C"</p> </blockquote> <p>The full output of cvs is saved into log for use at another point. Then we grep for all line...
14,876
<p>I'm not a full-time software guy. In fact, in the last ten years, 90 % of my work was either on the hardware or doing low-level (embedded) code.</p> <p>But the other 10% involves writing shell scripts for development tools, making kernel changes to add special features, and writing GUI applications for end-users.<...
<ul> <li>Ask developers you know that work in the environment that you are interested in.</li> <li>Search the web a lot.</li> <li>Ask specific questions in relevant IRC channels (Freenode is great).</li> <li>Ask specific questions on StackOverflow and other sites.</li> </ul> <p>There really isn't any substitue for bei...
<p>The best solution I think is to get a book on the topic / environment you need to catch up on.</p> <p>Ask questions from developers who you know who have the experience in that area.</p> <p>You can also check out news groups (Google Groups makes this easy) and forums. You can ask questions, but even reading 10 mi...
20,688
<p>So, one commonly heard comment when talking about performance is that you write your code with whatever language gets the job done fastest. If performance in specific areas is a problem, then rewrite those bits in C/C++.</p> <p>But, what if you're starting with a native C++ app? What options do you have if you want...
<p>As <a href="https://stackoverflow.com/questions/147378/options-for-refactoring-bits-of-code-away-from-native-c#147446">Aaron Fischer</a> suggests, try recompiling your C++ application with the /clr option turned on and then start leveraging the .Net platform.</p> <p>CLI/C++ is pretty easy to pick up if you know C# ...
<p>In the .NET world you always have the option of crreating a COM/ActiveX interop layer for your C#/VB.NET assembly. </p> <p>You can then use the normal COM API from your C++ application to create an instance of this COM server that actually wraps your .NET assembly. </p> <p>Good thing about this is that simple pa...
17,743
<p>There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps?</p> <p><strong>Linq</strong></p> <p>Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq...
<p>I would recommend either NHibernate or Entity Framework. For large sites, I'd use ADO.NET Data Services. I wouldn't do anything large with LINQ to SQL. I think Stack Overflow might end up with some interesting scale problems being 2-tier rather than 3-tier, and they'll also have some trouble refactoring as the physi...
<p>This post is from 2008 before the cloud really took off. It seems like an update to the answer is required. I will just provide some links and an overview. I am sure that there are more up-to-date posts at this site on this topic, and if I find them, then I will add the links here.</p> <p>When it comes to data scal...
9,339
<p>I am trying to get my development environment up and running, and I am having trouble with Tomcat trying to load JSF classes for some reason. My application does not use JSF; in fact, I haven't even deployed my application to tomcat yet. I am getting a number of stack traces in the startup logs and I cannot load t...
<p>Is your tomcat installation totally clean, or is it one you have inherited?</p> <p>Check if the webapps contains existing wars/directories which may be referencing JSF classes?</p> <p>UPDATE: Ah -- I see you found this was the case :-)</p> <p>Not sure why tomcat doesn't include all its dependencies. Perhaps you d...
<p>You might have to clean the Tomcat work directory.</p>
32,376
<p>I have a ASP.NET <code>GridView</code> with a column mapped to a boolean. I want do display "Yes"/"No" instead of "True"/"False". Well actually I want "Ja"/"Nej" (in Danish).</p> <p>Is this possible? </p> <pre><code>&lt;asp:gridview id="GridView1" runat="server" autogeneratecolumns="false"&gt; &lt;columns&gt; ...
<p>I use this code for VB:</p> <pre><code>&lt;asp:TemplateField HeaderText="Active" SortExpression="Active"&gt; &lt;ItemTemplate&gt;&lt;%#IIf(Boolean.Parse(Eval("Active").ToString()), "Yes", "No")%&gt;&lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>And this should work for C# (untested):</p> <p...
<p>This works:</p> <pre><code>Protected Sub grid_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grid.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.Cells(3).Text = "True" Then e.Row.Cells(3).Text = "Si" Else ...
26,658
<p>I want to filter a <code>java.util.Collection</code> based on a predicate.</p>
<p>Java 8 (<a href="https://www.oracle.com/java/technologies/javase/8-whats-new.html" rel="noreferrer" title="What's New in JDK 8">2014</a>) solves this problem using streams and lambdas in one line of code:</p> <pre><code>List&lt;Person&gt; beerDrinkers = persons.stream() .filter(p -&gt; p.getAge() &gt; 16).collec...
<p>With Guava:</p> <pre><code>Collection&lt;Integer&gt; collection = Lists.newArrayList(1, 2, 3, 4, 5); Iterators.removeIf(collection.iterator(), new Predicate&lt;Integer&gt;() { @Override public boolean apply(Integer i) { return i % 2 == 0; } }); System.out.println(collection); // Prints 1, 3, 5...
14,842
<p>I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far:</p> <pre><code>db.Models.Order order = DB.Models.Order.CreateOrder( apple ); order.CustomerReference.A...
<p><em>(Thanks John for the grammar fixes)</em></p> <p>So I figured it out. This is what you have to do:</p> <pre><code>db.Models.Order order = DB.Models.Order.CreateOrder( apple ); order.Customer = (from c in db.Customer where c.Id == custId select c).First(); db.SaveChanges(); </code></pre> <p>I hope that helps pe...
<p>For update here is some sample code: </p> <pre><code>using (var ctx = new DataModelEntities()) { var result = (from p in ctx.UserRole.Where(o =&gt; o.UserRoleId == userRole.UserRoleId) select p).First(); result.RolesReference.EntityKey = new EntityKey("DataM...
24,063
<p>Every time I use the "at" command, I get this message:</p> <pre><code>warning: commands will be executed using /bin/sh </code></pre> <p>What is it trying to warn me about? More importantly, how do I turn the warning off?</p>
<p>It serves as a good warning to those of us that don't use bash as our shell, because we we'll forget that a feature that's in our day-to-day shell isn't going to be available when this code is run at the appointed time.</p> <p>i.e. </p> <pre><code>username@hostname$ at 23:00 warning: commands will be executed...
<p>If you wish to get around that message, have 'at' run a script that calls a specified environment, be it ksh, bash, csh, zsh, perl, etc.</p> <p><strong>addition</strong> - see the 'at' man page <a href="http://www.rt.com/man/at.1.html" rel="nofollow noreferrer">http://www.rt.com/man/at.1.html</a> for more informati...
21,873
<p>So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at <a href="http://activemq.apache.org/" rel="noreferrer">ActiveMQ</a> bu...
<p>ActiveMQ works well with C# using the Spring.NET integrations and NMS. A post with some links to get you started in that direction <a href="http://thefreakparade.com/2008/04/15/two-message-exchange-patterns-using-activemq-and-nms-via-springnet/" rel="noreferrer">is here</a>. Also consider using MSMQ (The System.Mess...
<p>Sorry if this isn't what you are asking for... Have you considered some sort of cache behind the scenes that acts a bit like the "bucket system" when using asynchronous sockets in c/c++ using winsock? Basicly, it works by accepting requests, and sends an immediate response back to the web app, and when it finally g...
2,625
<p>Is there a simple way to hook into the standard '<strong>Add or Remove Programs</strong>' functionality using PowerShell to <strong>uninstall an existing application</strong>? Or to check if the application is installed?</p>
<pre class="lang-ps prettyprint-override"><code>$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Software Name" } $app.Uninstall() </code></pre> <p><strong>Edit:</strong> Rob found another way to do it with the Filter parameter:</p> <pre class="lang-ps prettyprint-override"><code>$app...
<p>Use:</p> <pre class="lang-ps prettyprint-override"><code>function remove-HSsoftware{ [cmdletbinding()] param( [parameter(Mandatory=$true, ValuefromPipeline = $true, HelpMessage="IdentifyingNumber can be retrieved with `"get-wmiobject -class win32_product`"")] [ValidatePattern('{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F...
13,865
<p>I'm working on scripts that apply database schema updates. I've setup all my SQL update scripts using start transaction/commit. I pass these scripts to psql on the command line.</p> <p>I now need to apply multiple scripts at the same time, and in one transaction. So far the only solution I've come up with is to rem...
<p>Well you have the possibility to use nested transactions inside postgresql using SavePoints.</p> <p>Take this code example:</p> <pre><code>CREATE TABLE t1 (a integer PRIMARY KEY); CREATE FUNCTION test_exception() RETURNS boolean LANGUAGE plpgsql AS $$BEGIN INSERT INTO t1 (a) VALUES (1); INSERT INTO t1 (a) V...
<p>I've ended up 'solving' my problem out of band - I use a perl script to re-work the input scripts to eliminate their start transaction/commit calls, then push them all into one file, which gets it's own start transaction/commit.</p>
25,042
<p>In C++ I'm generating a PDF report with <a href="http://libharu.org" rel="nofollow noreferrer">libHaru</a>. I'm looking for someway to append two pages from an existing PDF file to the end of my report. Is there any free way to do that?</p> <p>Thanks.</p>
<p>This will hardly be a Smarty problem. Just save both HTML pages and locally and compare. What's the difference? Maybe you could even use a diff tool for this. Have you tried to validate the <a href="http://validator.w3.org/" rel="nofollow noreferrer">HTML</a> and the <a href="http://jigsaw.w3.org/css-validator/" rel...
<p>you can see what's wrong using FireBug with Firefox.</p>
48,407
<p>I'm writing a service that will only get calls from the local host. Performance is important so I thought I'd try the <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.netnamedpipebinding.aspx" rel="noreferrer">NetNamedPipeBinding</a> instead of <a href="http://msdn.microsoft.com/en-us/library/sys...
<p>My experience is that, when using NetNamedPipes, the "ReceiveTimout" on the binding functions like an "Inactivity Timeout" rather than a receive timout. Note that this different than how a NetTCPBinding works. With TCP, it really is a receive timeout and there's a separate inactivity timeout you can configure via r...
<p>I haven't used NetNamedPipes in WCF but I spent more time than I cared to learning the timeout values for NetTcp. I use the following configs for my NetTcpBindings and had good luck with the connection staying active.</p> <p>Server:</p> <pre><code>&lt;binding name="MyBindingName" sendTimeout="00:00:30" receiveTim...
44,244
<p>I'm looking for the best JavaScript editor available as an Eclipse plugin. I've been using Spket which is good. But, is there more better one?</p>
<p><a href="http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor" rel="nofollow noreferrer">Eclipse HTML Editor Plugin</a></p> <p>I too have struggled with this totally obvious question. It seemed crazy that this wasn't an extremely easy-to-find feature with all the web development happeni...
<p>Oracle Workshop for WebLogic (formally BEA Workshop) has excellent support for JavaScript and for visually editing HTMLs. It support many servers, not only WebLogic, including Tomcat, JBoss, Resin, Jetty, and WebSphere. </p> <p>It recently became free, check out <a href="http://blog.zvikico.com/2008/08/the-best-js...
4,433
<p>What are the best practices and rules-of-thumb to follow while maintaining code? Is it good practice to have only the production ready code in the development branch, or should untested latest code be available in the development branch?</p> <p>How do you guys maintain your development code and production code?</p...
<p>Update 2019:</p> <p>These days, the question would be seen in a context using Git, and 10 years of using that <a href="https://stackoverflow.com/a/2563917/6309">distributed</a> development <a href="https://stackoverflow.com/a/2705286/6309">workflow</a> (collaborating mainly <a href="https://github.blog/2018-04-10-t...
<p>I use git and I have 2 branches: <em>master</em> and <em>maint</em></p> <ul> <li>master - development code</li> <li>maint - production code</li> </ul> <p>when I release code to production, I tag it and I merge <em>master</em> to <em>maint</em> branch. I always deploy from <em>maint</em> branch. Patches from develo...
26,587
<p>So let's say you wanted to make a copy of a Web Form page within a .Net Project. </p> <p>Is there an easier way than:</p> <ol> <li>Copy Source Page</li> <li>Page Source Page within project to get new page</li> <li>Exclude Source Page </li> <li>Rename code behind class for new page</li> <li>Add Source Page Back</l...
<p>I do this:</p> <ol> <li>Select the original ASPX file in solution explorer</li> <li>Ctrl+C followed by Ctrl+V (quick copy paste)</li> <li>Rename new ASPX file (let's say NewFile.aspx)</li> <li>Rename code-behind class name to NewFile</li> <li>Rename <code>Inherits</code> attribute of <code>Page</code> directive wit...
<p>Can you make that form a User Control, and then insert it as needed? Then you can save yourself the trouble of editing every instance of it that you copy.</p>
36,057
<p>I'm trying to use the Visitor Pattern and I have as follows:</p> <pre><code>public class EnumerableActions&lt;T&gt; : IEnumerableActions&lt;T&gt; { private IEnumerable&lt;T&gt; itemsToActOn; public EnumerableActions ( IEnumerable&lt;T&gt; itemsToActOn ) { this.itemsToActOn = itemsToActOn; } public void VisitAl...
<p>For that to work, firstly "newItem" would have to be "ref". Secondly, you'd need to do something with the updated value after the delegate invoke (an enumerator doesn't offer any ability to update contents). But most updates to collections will break enumerators anyway!</p> <p>Your replacing "newItem" will not be v...
<p>Yes, you're right - but I'm using an IEnumerable in that place so can't really do a for on it. </p> <p>However I guess it's more correct to return a new list instead of affecting the current one. So I'm using a ValueReturningVisitor - inspired(taken?:) ) from Jean-Paul S. Boodhoo. </p>
35,914
<p>I'm running SQL Server 2008 Express on Windows XP on a VirtualPC instance inside a Windows XP host. I want to be able to connect to databases on the guest instance using SSMS on the host. When I go to connect from SSMS on the host, and browse for servers, I see the instance of SQL Server on the guest. Yet when I ...
<p><strong>SELF-ACCEPTED ANSWER</strong> </p> <p>Thanks for the ideas. After much fiddling I got things working. It turned out that I had not gone into the Sql Server Configuration Manager and enabled TCP/IP and Named Pipes as network protocols. So even though SSMS said remote connections were enabled, there was n...
<p>To add some steps that are not explicitly called out above, what worked in my experience was to set up the Virtual PC's Networking to my physical network adapter. </p> <p>Then disabled Windows Firewall for the Public Profile. </p> <p>Hopefully could actually lock that down to port 1433.</p> <p>Also, on the gues...
39,990
<p>I'm a C++ developer with basic Python skills. Here's the task, a friend of mine is running a small company and he asked me if I can make a website for him. I have no real deadline so I think it's a perfect opportunity to try sth new and do some web development.</p> <p>User has to be able to add photos, change texts...
<p>You may be interested in Google App Engine (<a href="http://code.google.com/appengine/" rel="nofollow noreferrer">http://code.google.com/appengine</a>) which recently exhibited a rise in popularity. The application runs on Google's servers, eliminating the need to maintain Apache and worry about up-time. You basical...
<p>You may try to install and customize Joomla (<a href="http://www.joomla.org/" rel="nofollow noreferrer">http://www.joomla.org/</a>) It's full of stuff, easy to use and easy to customize also.</p>
37,336
<p>Is there an ASP.NET AJAX framework other than just using UpdatePanel &amp; Friends or the ASP.NET AjaxControlToolkit?</p> <p>Currently I am using plain ICallbackEventHandler calls but it gets quite complicated a while as a lot of serialization needs to be done.</p> <p>Any suggestions?</p>
<p>After some trial and error I have found out that the best way (for me) for handling Ajax in an ASP.NET Web forms application.</p> <ul> <li>ASP.NET AJAX Script services for all AJAX calls. Returns JSON for complex types </li> <li>jQuery for the GUI and for the Effects.</li> </ul> <p>Works really nice, and I am in f...
<p><a href="http://www.telerik.com" rel="nofollow noreferrer">Telerik</a> has a nice library of AJAX controls.</p>
32,751
<p>Working with VS.NET 2008, output type Class Library, Target Framework .NET 2.0</p> <p>I've come up with a simplified scenario to ask this question.</p> <p>I have a <code>Button</code> user control, its a simple panel with a single big button on it.</p> <p>I want to create a <code>RedButton</code> control that ext...
<p>Truthfully, your example should work just fine. Just ensure that you provide a default constructor for your derived class. Also ensure that you do not use generic controls as the designer will have no clue how to create an instance of it.</p>
<p>Is your assembly setup to be delay signed? Look for the delay signing attribute as well as the checkbox in project properties. I've seen delay signing cause this sort of problem with VS2005 perhaps its still a problem in VS2008.</p>
48,531
<p>I'm exploring the iPhone SDK and want to create and use a UI component like the figure below. A rounded table with cells in which each cell can have some label text, maybe an input text field and an action button that would take it to the next screen. The table should not be screen filling.</p> <p>But... I can't fi...
<p>Try looking at the "5_CustomTableViewCell" project of the <a href="https://developer.apple.com/iphone/library/samplecode/TableViewSuite/index.html" rel="nofollow noreferrer">TableViewSuite</a> code sample from Apple. It should how to create custom subclasses of UITableViewCell.</p> <p>The short answer is, as allude...
<p>As mentioned by other answers, what you want is a grouped TableView with custom UITableViewCells. Take a look at the <a href="https://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/Introduction/chapter_1_section_1.html" rel="nofollow noreferrer">Table View Programming Gui...
29,020
<p>I am rather new to complex CSS, and have a question- I have a page which positions a floating element along the bottom of the page. It does so by setting the Bottom: 0, and Position: Absolute. </p> <p>When the user resizes their browser to a very-small size, this element covers up other content on the page.</p> <p...
<p>You could set <code>html, body { min-width: 800px; min-height: 600px; }</code></p> <p>YMMV in different browsers though.</p>
<p>It really depends on whether the floating footer needs to always be visible or if it can scroll off the bottom when the browser window is small.</p> <p>I think some javascript might be easier to manage than a css solution. Keep in mind that min-width and min-height don't work in all browsers.</p> <p>You can use jq...
33,875
<p>I searched for this subject on Google and got some website about an experts exchange...so I figured I should just ask here instead.</p> <p>How do you embed a <code>JApplet</code> in HTML on a webpage?</p>
<p>Here is an example from <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html" rel="nofollow noreferrer">sun's website</a>:</p> <pre><code>&lt;applet code="TumbleItem.class" codebase="examples/" archive="tumbleClasses.jar, tumbleImages.jar" width="600" height="95"&...
<p>Use the &lt;applet&gt; tag. For more info: <a href="http://java.sun.com/docs/books/tutorial/deployment/applet/html.html" rel="nofollow noreferrer">http://java.sun.com/docs/books/tutorial/deployment/applet/html.html</a></p>
6,356
<p>I am begging to use jquery. I have the following call that works in IE7 but not FF 3.0.4. But if I change the <code>null</code> to <code>{}</code> it works fine. Is null not valid for this case and I just got lucky that it worked in IE or is this an error with jquery.</p> <pre><code>$.post("complexitybar.ashx?a=...
<p>Try <a href="http://docs.jquery.com/Ajax/jQuery.get" rel="nofollow noreferrer"><code>$.get()</code></a> for query-string requests:</p> <pre><code>$.get('complexitybar.ashx?a=init&amp;vc=...') </code></pre> <p>POST requests expect the URL and key-value pairs to be seperate:</p> <pre><code>$.post('complexitybar.ash...
<p>try $.ajajx with th e method "POST" , will be better </p>
46,119
<p>I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using <code>mvn deploy</code>, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only have FTP access to server I want to host the M...
<p>You might want to have a look at <a href="http://nexus.sonatype.org/" rel="noreferrer">Nexus,</a> a Maven repository manager. We've replaced our local Maven repository with a Nexus-based one and find it tremendously useful.</p>
<p><a href="https://maven.apache.org/wagon/wagon-providers/wagon-ftp/" rel="nofollow">https://maven.apache.org/wagon/wagon-providers/wagon-ftp/</a> will tell you that you can use ftp to read from an existing repository, but not to create a new one. I don't think that it is impossible in principle, but no one has cared ...
19,047
<p>I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html().</p> <pre><code>$("[id$=" + endOfIdT...
<p>Just one jQuery too much:</p> <pre><code>$("[id$=" + endOfIdToMatch + "]").each(function () { alert(this.tagName); }); </code></pre>
<p>Yet another solution, arguably more elegant, is to write two separate functions for each element type:</p> <pre><code>$("input#" + id).each(function() { alert(this + " is an input"); }); $("label#" + id).each(function() { alert(this + " is a label"); }); </code></pre>
44,436
<p>What is the easiest way to extract the original exception from an exception returned via Apache's implementation of XML-RPC?</p>
<p>It turns out that getting the cause exception from the Apache exception is the right one. </p> <pre><code>} catch (XmlRpcException rpce) { Throwable cause = rpce.getCause(); if(cause != null) { if(cause instanceof ExceptionYouCanHandleException) { handler(cause); } else ...
<p>According to the <a href="http://www.xmlrpc.com/spec" rel="nofollow noreferrer">XML-RPC Spec</a> it returns the "fault" in the xml.</p> <p>Is this the "Exception" you are referring to or are you refering to a Java Exception generated while making the XML-RPC call?</p> <p><strong>Fault example</strong></p> <pre><c...
7,476
<p>Today, I ran into this weird problem with a user using Mac OS X. This user always had a failed upload. The form uses a regular "input type=file". The user could upload using any browser except Firefox 3 on his Mac. Only this particular user was seeing this error.</p> <p>Obviously, the problem is only with this one ...
<p>User corrected this weird problem by recreating their FireFox profile. <a href="http://support.mozilla.com/en-US/kb/Managing+profiles" rel="nofollow noreferrer">How to manage FireFox profiles</a></p> <p>I imagine a re-install of FireFox would have corrected the problem as well.</p>
<blockquote> <p>I imagine a re-install of FireFox would have corrected the problem as well.</p> </blockquote> <p>Profile related problems cannot usually be solved by re-installing Firefox since reinstalling (or upgrading) would re-use the same "damaged" profile.</p>
2,707
<p>Is it possible to reflectively instantiate a generic type in Java? Using the technique described <a href="http://www.velocityreviews.com/forums/t149816-generics-and-forname.html" rel="noreferrer">here</a> I get an error because class tokens cannot be generic. Take the example below. I want to instantiate some subcla...
<p>The generic information is lost in runtime. There is no runtime equivalent of a Creator&lt;String>.class. You could create a type between Creator and StringCreator which fixes the generic type:</p> <pre><code>public interface Creator&lt;T&gt; { T create(); } public interface StringCreator extends Creator&lt...
<p>Not quite sure why you're using generics here.</p> <p>The instantiation of the object using reflection would suggest a general use but presumably you're going to call <code>create</code> at some point and assign the result to a <code>String</code>, otherwise why use the generics to control the return type.</p> <p>...
46,493
<p>C#: How would you cycle through items in a listview using next and previous buttons?</p> <p>Background:</p> <p>Let's say you have 10 items in a listview.</p> <p>Next to the listview there are two buttons titled previos and next.</p> <p>Problem:</p> <p>How would you cycle through those listview items after click...
<p>If you just want to select the next item (so with items a, b, c, go from b selected to c selected), you can do this:</p> <pre><code> if (listView.SelectedIndices.Count &gt; 0) { int oldSelection = listView.SelectedIndices[0]; listView.SelectedIndices.Clear(); if (...
<p>Without testing it, I'm guessing this would work:</p> <pre><code> for(int i=0;i&lt;listView.Items.Count;i++) listView.Items[i] </code></pre>
36,779
<p>I have an app that is a combination of asp/asp.net, and both sides depend on the same cookies (they are in the same domain). There are some values in the cookies that I don't want going to the client anymore due to security concerns. What I was hoping to accomplish is to take out these values so they no longer go ...
<p>LabVIEW makes <em>implementing</em> concurrency/parallel programming easier, true. It does <em>not</em>, however, make debugging, testing, or <em>thinking</em> about concurrency/parallelism any easier. You can still write buggy, concurrent code in LabVIEW, and (as with <em>any</em> language, platform, or toolset) th...
<p>In Labview I can't find the callers of VI if they are not opened first.</p>
48,699
<p>I had a Z probe installed but the wires came out of the header so I am trying to use software endstops, but any time I <code>G28</code> the nozzle will always ram into the bed. I am using Marlin Firmware. Which I am relatively new with. I'm used to having hardware endstops, but,</p> <p><strong>I don't have a hardwa...
<p>If you want to mirror the print to get the top to the bottom, and visa versa, you just need to rotate the part using the XYZ rotation tool. Mirroring is used to make a mirror image in the X-Z or Y-Z plane, not the X-Y plane. </p> <p>You might just caught a bug, you could post that of their forum.</p> <p>Update: <...
<p>If you want to mirror the print to get the top to the bottom, and visa versa, you just need to rotate the part using the XYZ rotation tool. Mirroring is used to make a mirror image in the X-Z or Y-Z plane, not the X-Y plane. </p> <p>You might just caught a bug, you could post that of their forum.</p> <p>Update: <...
978
<p>What essential things (functions, aliases, start up scripts) do you have in your profile?</p>
<p>I often find myself needing needing some basic agregates to count/sum some things., I've defined these functions and use them often, they work really nicely at the end of a pipeline :</p> <pre><code># # useful agregate # function count { BEGIN { $x = 0 } PROCESS { $x += 1 } END { $x } } function produc...
<p>Great question. Because I deal with several different PowerShell hosts, I do a little logging in each of several profiles, just to make the context of any other messages clearer. In <code>profile.ps1</code>, I currently only have that, but I sometimes change it based on context:</p> <pre><code>if ($PSVersionTabl...
16,718
<p>I'm trying to get a webservice up and running that actually requires to check whois databases. What I'm doing right now is ugly and I'd like to avoid it as much as I can: I call gwhois command and parse its output. Ugly.</p> <p>I did some search to try to find a pythonic way to do this task. Generally I got quite m...
<p>There's nothing wrong with using a command line utility to do what you want. If you put a nice wrapper around the service, you can implement the internals however you want! For example:</p> <pre><code>class Whois(object): _whois_by_query_cache = {} def __init__(self, query): """Initializes the inst...
<pre><code>import socket socket.gethostbyname_ex('url.com') </code></pre> <p>if it returns a gaierror you know know it's not registered with any DNS</p>
7,319
<p>This one's a tough one - I have a JFrame that generates JTextFields. When I go from generating 2 JTextFields to 12 JTextfields (for example), I see some error where there is an extra differently-sized JTextField at the end. It seems to be a repaint error.</p> <p><strong>Main.java code:</strong> </p> <pre><code>im...
<p>Since I'm also looking for an answer for question I did a bit of research, and I haven't find any simple (simple like calling one function) way to play an audio file. But with some lines of code, it is possible even in a portable way using the already mentioned portaudio and libsndfile (LGPL).</p> <p>Here is a smal...
<p>I like <a href="http://www.fmod.org/" rel="nofollow noreferrer">FMOD</a>. The <a href="http://www.fmod.org/index.php/sales" rel="nofollow noreferrer">license</a> is free for personal use, and very reasonable for small shareware or commercial projects</p>
49,701