instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Does MySQL index foreign key columns automatically?</p>
<p>Yes, but only on <a href="/questions/tagged/innodb" class="post-tag" title="show questions tagged &#39;innodb&#39;" rel="tag">innodb</a>. Innodb is currently the only shipped table format that has foreign keys implemented.</p>
<p>It's not possible to get index key automatically use</p> <pre><code>ALTER TABLE (NAME OF THE TABLE) ADD INDEX (FOREIGN KEY) </code></pre> <p>Name of the table which you have created for example photographs and FOREIGN KEY for example <code>photograph_id</code>. The code should be like this</p> <pre><code>ALTER TA...
39,099
<p>Maybe this applied to other Delphi's (I've only used 7). We've got our code broken up so that nearly every DLL in our fairly massive app is in a different folder. <p> 99% of the open source stuff I've downloaded to plug into Delphi have had all their source munged into one folder. <p> It seems like this was an assu...
<p>I don't think so. In fact, In more recent versions they've added features to the project manager to make it easier to deal with the fact that code is spread around different directories (such as the flatten directories option), so I think it is accepted that this is how many people organize their code.</p> <p>I sus...
<p>It would seem that having all the units in one folder would save you headaches in doubly named units. <li>On the other hand, it might be handier to keep your projects in different folders when checking in and out of your version control. <li>On the other hand it really doesn't promote code reuse to have them separa...
15,964
<p>I was browsing the SGI STL documentation and ran into <a href="http://www.sgi.com/tech/stl/project1st.html" rel="nofollow noreferrer"><code>project1st&lt;Arg1, Arg2&gt;</code></a>. I understand its definition, but I am having a hard time imagining a practical usage.</p> <p>Have you ever used project1st or can you i...
<p>My guess is that if you were using the strategy pattern and had a situation where you needed to pass an identity object, this would be a good choice. For example, there might be a case where an algorithm takes several such objects, and perhaps it is possible that you want one of them to do nothing under some situat...
<p>I assume that <em>someone</em> had a practical use for it, or it wouldn't have been written, but I'm drawing a blank on what it might have been. Presumably its use-case is similar to the <code>identity</code> function that the description mentions, where there's no real need for processing but the syntax requires a ...
45,023
<p>I have to change some connection strings in an incredibly old legacy application, and the programmers who made it thought it would be a great idea to plaster the entire app with connection strings all over the place.</p> <p>Visual Studio's "current project" search is incredible slow, and I don't trust Windows Searc...
<p>I'm a fan of the <strong>Find-In-Files</strong> dialog in <a href="http://notepad-plus.sourceforge.net/uk/download.php" rel="noreferrer">Notepad++</a>. <em>Bonus</em>: It's free.</p> <p><img src="https://i.stack.imgur.com/nLZrv.png" alt="enter image description here"></p>
<p>If you don't want to install Non-Microsoft tools, please <a href="https://learn.microsoft.com/en-us/sysinternals/downloads/strings" rel="nofollow noreferrer">download STRINGS.EXE</a> from Microsoft Sysinternals and make a procedure like this one:</p> <pre><code>@echo off if '%1' == '' goto NOPARAM if '%2' == '' got...
41,077
<p>How would you write a prepared MySQL statement in PHP that takes a differing number of arguments each time? An example such query is:</p> <pre class="lang-sql prettyprint-override"><code>SELECT `age`, `name` FROM `people` WHERE id IN (12, 45, 65, 33) </code></pre> <p>The <code>IN</code> clause will have a differen...
<p>I can think of a couple solutions.</p> <p>One solution might be to create a temporary table. Do an insert into the table for each parameter that you would have in the in clause. Then do a simple join against your temporary table.</p> <p>Another method might be to do something like this.</p> <pre><code>$dbh=new ...
<p>I had a similiar problem today and I found this topic. Looking at the answers and searching around the google I found a pretty solution.</p> <p>Although, my problem is a little bit more complicated. <strong>Because I have fixed binding values and dynamic too</strong>.</p> <p>This is the mysqli solution.</p> <pre><c...
42,406
<p>I have a base page, BasePage, that raises an event that displays messages to the user. Works great on all pages derived from BasePage. I want to do the same thing from user controls, but they don't inherit from BasePage. </p> <p>What I want is a central place that I can call from anywhere and in that code it will...
<p>For MS SQL 2000, you can use:</p> <pre><code>CREATE FUNCTION Test (@top integer) RETURNS TABLE AS SET ROWCOUNT @top RETURN SELECT * FROM SomeTable </code></pre>
<p>Oops a variable TOP is not available in SQL Server 2000. Nor is Dynamic SQL supported in any version.</p>
36,094
<p>I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns.</p> <p>So with MVP, the Presenter handles events raised by the View. Here's some code that I have in place to deal with the creation...
<p>That sounds just right to me. Exceptions are preferable as they can be thrown up to the top of the service layer from anywhere inside the service layer, no matter how deeply nested inside the service method implementation it is. This keeps the service code clean as you know the calling presenter will always get noti...
<p>In reply to the follow-up question:</p> <p>As for creating exceptions becoming tedious, you kinda get used to it. Use of a good code generator or template can create the exception class with minimal hand editing within about 5 or 10 seconds. </p> <p>However, in many real world applications, error handling can be 7...
4,181
<p>Does BeautifulSoup work with Python 3? </p> <p>If not, how soon will there be a port? Will there be a port at all?</p> <p>Google doesn't turn up anything to me (Maybe it's 'coz I'm looking for the wrong thing?)</p>
<p>About two months after I asked this question, a port has been released:</p> <p><a href="http://groups.google.com/group/beautifulsoup/browse_thread/thread/f24882cc17a0625e" rel="noreferrer">http://groups.google.com/group/beautifulsoup/browse_thread/thread/f24882cc17a0625e</a></p> <p>It'll bet BS working, but that's...
<p>yes,beautiful soup work in python 3,</p> <p>Linux</p> <pre><code>apt-get install python3-bs4 </code></pre> <p>Windows</p> <pre><code>pip install beautifulsoup4 </code></pre> <p>For more information see <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-beautiful-soup" rel="nofollow nore...
18,027
<p>I'm working on a Grails project using Hibernate (GORM). I have the following Domain Models:</p> <pre><code>ClientContact { static hasMany = [owners: Person] static belongsTo = [Person] } Person { static hasMany = [clientContacts: ClientContact] } </code></pre> <p>When I try to retrieve all the <code>Clie...
<p>I know this thread is very old, but I just encountered exactly the same problem today and the solution seems to be usage of aliases, so instead:</p> <pre><code>def query = { owners { eq("id", Long.parseLong(params.ownerId)) } } </code></pre> <p>one can try:</p> <pre><code>def query...
<p>Two quick observations:</p> <ol> <li>The [Grails Documentation](<a href="http://grails.org/doc/1.0.x/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.2.1.3" rel="nofollow noreferrer">http://grails.org/doc/1.0.x/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.2.1.3</a> Many-to-many) says that a <str...
31,841
<p>I am novice in sharepoint programming. I have a following code:</p> <pre><code>SPWorkflowTask task = some_getter(); task["Status"] = "Canceled"; task.Update(); </code></pre> <p>and I am getting SPException:</p> <pre><code>Microsoft.SharePoint.SPException: "This task is currently locked by a running workflow ...
<p>here is an expert comment on this problem : <a href="http://geek.hubkey.com/2007/09/locked-workflow.html" rel="nofollow noreferrer">http://geek.hubkey.com/2007/09/locked-workflow.html</a> </p> <p>And, if you have edited the columns on the task list, this link may help : <a href="http://social.msdn.microsoft.com/For...
<p>You can not modify a Workflow Task from outside the workflow sadly. You somehow have to tell the workflow to modify the task. I'm not 100% sure what the best approach to that would be, and I'm really interested in answers for that as well :)</p>
48,563
<p>I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the peer IP and rejects it if it is not the loopback address, but I know that peer...
<p>Peer IP addresses cannot be spoofed in this manner, have you nothing to fear from using the technique of inspecting the peer and deciding to drop the connection during establishment.</p> <p>However: binding to 127.0.0.1 should work, and cause the operating system to tell the connecting host that there is nothing li...
<p>When you bind your ServerSocket, specifying localhost should make the TCP/IP stack reject the connection. Even if this isn't working on your system, localhost can't (okay, maybe if someone hacked your TCP/IP stack and the default gateway router) be spoofed, since that address isn't routed through the physical inter...
12,430
<p>This is a part algorithm-logic question (how to do it), part implementation question (how to do it best!). I'm working with Django, so I thought I'd share with that.</p> <p>In Python, it's worth mentioning that the problem is somewhat related to <a href="https://stackoverflow.com/questions/773/how-do-i-use-pythons-...
<p>Have you tried sorting the list first? The algorithm you proposed should work, albeit with lots of database hits.</p> <pre><code>import itertools cars = [ {'car': 'X2', 'mods': [1,2]}, {'car': 'Y2', 'mods': [2]}, {'car': 'W2', 'mods': [1]}, {'car': 'X1', 'mods': [1,2]}, {'car': 'W1', 'mods': [1...
<p>Thank you all for the helpful replies. I've been plugging away at this problem. A 'best' solution still eludes me, but I've some thoughts.</p> <p>I should mention that the statistics of the data-set I'm working with. In 75% of the cases there will be one Mod. In 24% of the cases, two. In 1% of the cases there will ...
19,385
<p>The ListView doesn't seem to support the Scroll event. I need to call a function whenever the list is scrolled; how would I go about that?</p>
<p>Why do you need to call a function when the list is scrolled? </p> <p>If you are changing the items as it's scrolled i would recommend setting the listview to virtual.</p> <p>Or you could override the listview and do this:</p> <pre><code>public class TestListView : System.Windows.Forms.ListView { private con...
<p>it seems the best approach is the brian's solution. However, its only responds to events generated by scrollbars, but no to events from mouse midbuttton.</p> <p>if you change the conditional:</p> <pre><code> if (m.Msg == WM_HSCROLL || m.Msg == WM_VSCROLL) this.OnScroll(); </code></pre> <p>by:</p> ...
48,627
<p>I am writing an application which opens USB devices and transfer some data. I am following the UsbSimpleNotificationExample from the Developer Examples. The example adds notifications and assigns callbacks for a unique Vendor ID and Product ID. But for my application I have multiple PIDs and a single VIDs. How can I...
<p>Why don't you try only adding the vendor ID?</p> <p>Then your matches should include all the product IDs.</p>
<p>6 years late...sorry.</p> <p>Here's how you do it:</p> <pre><code>CFMutableDictionaryRef matchingDict = IOServiceMatching ( kIOUSBDeviceClassName ); if ( matchingDict ) { UInt32 usbVendor = k_MyVendorID; CFNumberRef refVendorId = CFNumberCreate ( kCFAllocatorDefault, kCFNumberIntType, &amp;usbVen...
45,507
<p>Can share with me any of this script?</p>
<p>The default one is called commit-email.pl and is included when you install Subversion. But <a href="http://blog.hungrymachine.com/2007/11/5/pretty-svn-commit-emails" rel="nofollow noreferrer">here</a> is one in ruby:</p> <pre><code>#!/usr/bin/ruby -w # A Subversion post-commit hook. Edit the configurable stuff bel...
<p>Try this</p> <p><code>/usr/bin/svnnotify --revision "$REV" --repos-path "$REPOS" \ --subject-cx --subject-prefix "[Project:commit] " --max-sub-length 128 \ --with-diff --handler Alternative --alt HTML::ColorDiff \ --to 'abc@xyz.com' --from 'svn@xyz.com' --set-sender</code></p>
17,816
<p>I would like to use Pylons with Elixir, however, I am not sure what is the best way to get about doing this. There are several blog posts (<a href="http://cleverdevil.org/computing/68/" rel="nofollow noreferrer" title="cleverdevil&#39;s technique">cleverdevil</a>, <a href="http://beachcoder.wordpress.com/2007/05/11/...
<p>You can use a dynamic proxy (<a href="http://www.castleproject.org/dynamicproxy/index.html" rel="nofollow noreferrer">Castle's DynamicProxy</a> for example) to intercept the call, run whatever code you wish, and then either invoke your method or not, depending on your needs.</p>
<p>You would have to use some form of AOP framework like <a href="http://www.springframework.net/doc-latest/reference/html/aop-quickstart.html" rel="nofollow noreferrer">SpringFramework.NET</a> to do that.</p>
23,377
<p>A team member has run into an issue with an old in-house system where a user double-clicking on a link on a web page can cause two requests to be sent from the browser resulting in two database inserts of the same record in a race condition; the last one to run fails with a primary key violation. Several solutions ...
<p>Put a unique identifier on the page in a hidden field. Only accept one response with a given unique identifier.</p>
<p>It seems you already replied to your own question there; #1 seems to be the only viable option.</p> <p>Otherwise, you should really do all three steps -- data integrity should be handled at the database level, but extra checks (such as the explicit transaction) in the code to avoid roundtrips to the database could ...
20,311
<p>What is the most reliable way to find out CPU architecture when compiling C or C++ code? As far as I can tell, different compilers have their own set of non-standard preprocessor definitions (<code>_M_X86</code> in MSVS, <code>__i386__</code>, <code>__arm__</code> in GCC, etc).</p> <p>Is there a <em>standard</em> w...
<p>There's no inter-compiler standard, but each compiler tends to be quite consistent. You can build a header for yourself that's something like this:</p> <pre><code>#if MSVC #ifdef _M_X86 #define ARCH_X86 #endif #endif #if GCC #ifdef __i386__ #define ARCH_X86 #endif #endif </code></pre> <p>There's not much point to...
<p>If you need a fine-grained detection of CPU features, the best approach is to ship also a CPUID program which outputs to stdout or some "cpu_config.h" file the set of features supported by the CPU. Then you integrate that program with your build process.</p>
18,329
<p>Is it best practice to <em>not</em> use C:\Inetpub\wwwroot\wss\ for SharePoint? My concern is that the configuration wizard seems to look for this C: path and it may be too complicated to <em>not</em> use the default path(s),</p>
<p>What would be the reason for using an alternate location? </p>
<p>We've always let the configuration wizard pick that location for us. There's a lot of aspects of the underlying configuration that rely on that location and it's never seemed worthwhile to explore changing the home directory.</p>
17,292
<p>How do I sort a list of dictionaries by a specific key's value? Given:</p> <pre><code>[{'name': 'Homer', 'age': 39}, {'name': 'Bart', 'age': 10}] </code></pre> <p>When sorted by <code>name</code>, it should become:</p> <pre><code>[{'name': 'Bart', 'age': 10}, {'name': 'Homer', 'age': 39}] </code></pre>
<p>The <a href="https://docs.python.org/library/functions.html#sorted" rel="noreferrer"><code>sorted()</code></a> function takes a <code>key=</code> parameter</p> <pre><code>newlist = sorted(list_to_be_sorted, key=lambda d: d['name']) </code></pre> <p>Alternatively, you can use <a href="https://docs.python.org/library...
<p>sorting by multiple columns, while in descending order on some of them: the cmps array is global to the cmp function, containing field names and inv == -1 for desc 1 for asc</p> <pre><code>def cmpfun(a, b): for (name, inv) in cmps: res = cmp(a[name], b[name]) if res != 0: return res *...
9,850
<p>Is there any free hosting for Javascript? Recently google has been hosting jQuery,etc... and Yahoo hosts it's YUI, which is great, but it'd be even better if there was a service that could host user scripts and things like that.</p> <p>Any ideas?</p>
<p>You can turn Google AppEngine in to your own CDN. Which will definitely give you the effect you are looking for.</p> <p><a href="http://www.coderjournal.com/2008/06/turn-google-app-engine-into-a-content-delivery-network-cdn/" rel="nofollow noreferrer">http://www.coderjournal.com/2008/06/turn-google-app-engine-into...
<p>i found another great free javascript file hosting. www.yourjavascript.com they have a nice feature to access the file for specific domains.</p>
19,716
<p>As a contractor, out-sourcer and shareware author,I have about 5-10 projects going on at any one time. Each project has a todo list, requirements need to be communicated to other outsources and employees, status needs to be given to clients, and developer's questions need to be answered.</p> <p>Sometimes it is too ...
<p>This may sound really old-tech, but a different set of notepads for each project. Now, hear me out.</p> <p>I know that notepads aren't searchable, and they aren't indexed, etc. But they will have meeting dates and times (if you've been taking notes during meetings, even on the phone), they have the ability of nev...
<p>I should say that we use Mantis now, but I wish it was better. I wish I could use it for customer-facing queries, I with I could open and assign issues by email.</p> <p><a href="http://danube.com/scrumworks/pro" rel="nofollow noreferrer">ScrumWorks Pro</a> looks promising, but amazingly expensive for me, with 15 de...
15,942
<p>Currently this expression <code>"I ([a-zA-z]\d]{3} "</code> returns when the following pattern is true:</p> <pre> I AAA I Z99 </pre> <p>I need to modify this so it will return a range of alphanumerics after the I from 2 to 13 that do not have a space.</p> <p>Example:</p> <pre> I AAA I A321 I ASHG310310 </pr...
<p>Without the quotes:</p> <pre> "I ([a-zA-Z\d]{2,13}) " </pre>
<p>The {} brackets allow two parameters seperated by a comma, which indicates the minimum and maximum number of repetitions. Also, I'm not sure if your original regex gets what you intend - as it's written, it accepts 3 groups of a letter and a number. </p> <p>You may want to try</p> <pre><code>I ([a-zA-Z]|\d){2,13}...
39,848
<p>I'm new to Flex SDK and trying to implement a simple project using <a href="http://dougmccune.com/blog/2007/11/19/flex-coverflow-performance-improvement-flex-carousel-component-and-vertical-coverflow/" rel="nofollow noreferrer">Doug Mccune's CoverFlow</a> widget. Most of the documentation out there on how to do thi...
<p>Here is a <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_13.html" rel="noreferrer">link to the mxmlc command line tool docs from Adobe</a> and a <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html#157203" rel="noreferrer">direct link to the command line opti...
<p>I finally got my project to build. The use of library-path was part of the solution, but I also had to take a closer look at the Doug Mccune library's sources so I could use the correct path information and type names in my mxml.</p> <p>The winning command line is</p> <pre><code>mxmlc -library-path+=lib coverflow...
23,656
<p>Using C# and WPF under .NET (rather than <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> or console), what is the correct way to create an application that can only be run as a single instance?</p> <p>I know it has something to do with some mythical thing called a mutex, rare...
<p>Here is a very good <a href="http://sanity-free.org/143/csharp_dotnet_single_instance_application.html" rel="noreferrer">article</a> regarding the Mutex solution. The approach described by the article is advantageous for two reasons.</p> <p>First, it does not require a dependency on the Microsoft.VisualBasic assem...
<p>Based Matt Davis' answer, wrapped into a class for convenience.</p> <pre><code>public static class SingleAppInstanceChecker { /// &lt;summary&gt; /// Arbitrary unique string /// &lt;/summary&gt; private static Mutex _mutex = new Mutex(true, &quot;0d12ad74-026f-40c3-bdae-e178ddee8602&quot;); publ...
3,963
<p>I have determined that my JSON, coming from the server, is valid (making the ajax call manually), but I would really like to use JQuery. I have also determined that the "post" URL, being sent to the server, is correct, using firebug. However, the error callback is still being triggered (parse error). I also tried da...
<p>Here are a few suggestions I would try:</p> <p>1) the 'datatype' option you have specified should be 'dataType' (case-sensitive I believe)</p> <p>2) try using the 'contentType' option as so:</p> <pre><code>contentType: "application/json; charset=utf-8" </code></pre> <p>I'm not sure how much that will help as it'...
<p>The data parameter is wrong. Here is an example that works:</p> <p>data: { index: ddl.selectedIndex },</p> <p>This contructs an object with property called index with value ddl.selectedIndex.</p> <p>You need to remove the quotes from your data parameter line</p> <p>Good luck A</p>
10,491
<p>After I was convinced that labeled breaks/continues are a total "nono" over <a href="https://stackoverflow.com/questions/15481/java-coding-standard-best-practices-labeled-brakecontinue#15501">here</a>, I need help to remove the label out of my code.</p> <p>I have a square matrix and a vector that has the same lengt...
<p>Looking at the solutions presented so far:</p> <ul> <li><p>They all look less readable than the original, in that they involve spending more code on the mechanism of the code rather than on the algorithm itself</p></li> <li><p>Some of them are broken, or were before they were edited. Most damning is the fact that p...
<p>Does this work for you? I extracted the inner loop into a method CheckedEntireMatrix (you can name it better than me) - Also my java is a bit rusty.. but I think it gets the message across</p> <pre><code>for( int idx = 0; idx &lt; vectorLength; idx++) { if( conditionAtVectorPosition( v, idx ) || !CheckedEn...
3,666
<p>I attempted to open a C#/VB form in designer mode, and instead of the form, I got an ugly error message saying "The path is not of a legal form". This form used to work! What happened?</p> <hr> <p><em>Thanks to all who have answered. This question is a problem I hit a while back, and I struggled with it for a l...
<p>I don't know what this error message means, but it seems to be associated with third-party controls on the form. Anyway, the solution is almost as absurd as the problem:</p> <ol> <li>Close the designer/error message.</li> <li>Open the form code.</li> <li>Right-click on the form code and select "View Designer".</li...
<p>By path, it might be referring to a path to a file or folder. There could be a malformed path that you are trying to reference, i.e. forward slash instead of backslash. Also, what changed since the error came up? Did you move any files around? Did you save any previously unsaved code? Update from a version cont...
10,566
<p>I have a few users setup in the web.config of an asp.net site to handle authentication. Without getting into details I'm not using the full membership/role provider and would rather not have to implement it at the moment do to time constraints. However I do need the ability to assign a role to a user so that securit...
<p>This is not possible to do via the web.config, you will need to setup the membership provider, but using the .exe to create the database tables, the whole process literally takes under 5 minutes to complete!</p>
<p>I've had the same "issue" a couple of times now, so I finally implemented a simple iRoleProvider implementation that uses web.config. Check it out on Codeplex, <a href="http://webconfigroles.codeplex.com/" rel="nofollow noreferrer">Web.Config Role Provider </a>.</p>
43,422
<p>Our company currently runs two Windows 2003 servers (a web server &amp; a MSSQL 8 database server). We're planning to add another couple of servers for redundancy / availability purposes in a web farm setup. Our web sites are predominately ASP.NET, we do have a few PHP sites, but these are mainly static with no DB.<...
<p>If you have dynamic load balancing (i.e. My first request goes to server X, but my next Request may go to server Y or Z), you will find out that In-Proc Sessions do not work. So you will either need sticky Sessions (your load balancer will ALWAYS send me (=my session) to server X) or out-of-process sessions (i.e. st...
<p>In addition to what others have said, you might want to consider looking into Richard Campbell's (of .NET Rocks!) product:</p> <p><a href="http://www.strangeloopnetworks.com/" rel="nofollow noreferrer">http://www.strangeloopnetworks.com/</a></p>
40,150
<p>My macro updates a large spreadsheet with numbers, but it runs very slowly as excel is rendering the result as it computes it. How do I stop excel from rendering the output until the macro is complete?</p>
<p>I use both of the proposed solutions:</p> <pre><code>Application.ScreenUpdating = False Application.Calculation = xlCalculationManual ... ... ... Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True </code></pre>
<p>You can turn off automatic calculation in the options dialog, it sets it so that it only calculates when you press F9.</p>
17,385
<p>When I first heard about StackOverflow, and heard that it was being built in ASP.Net MVC, I was a little confused. I thought ASP.Net was always an example of an MVC architecture. You have the .aspx page that provides the view, the .aspx.vb page that provides the controller, and you can create another class to be t...
<p>.aspx doesn't fulfill the MVC pattern because the aspx page (the 'view') is called before the code behind (the 'controller').</p> <p>This means that the controller has a 'hard dependency' on the view, which is very much against MVC principles.</p> <p>One of the core benefits of MVC is that it allows you to test yo...
<p>ASP.Net with it's code behind is <em>almost</em> MVC - but not - the one big thing that makes it not is that the codebehinds are tied directly to the aspx's - which is a big component of MVC. If you are thinking of the codebehinds as the controller - the should be completely decoupled from the view. The new .NET M...
11,441
<p>Is there a way I can export my Silverlight DataGrid data to excel or csv?</p> <p>I searched the web but can't find any examples!</p> <p>Thanks a lot </p>
<p>Silverlight 3 changes the answer to this question because it gives the ability of the user to create a file on the user's desktop in a location that they specify. I adapted the code submitted by DaniCE, split things into a few methods for readability and am using a loosely defined CSV format that Excel should recogn...
<p>Here's a nice approach that worked for me <a href="http://forums.silverlight.net/forums/p/179321/404357.aspx" rel="nofollow noreferrer">http://forums.silverlight.net/forums/p/179321/404357.aspx</a></p>
39,102
<p>Is there any way that I can reference a var or const as the default value for a function argument in actionscript 3.</p> <p>I can define default values like null, string, int.</p> <pre>function a( b = null ) { blah... }</pre> <p>But what I want to do is <pre>function a( b = function(){} ) { blah... }</pre>...
<p>Oddly enough it seems you can't do that, atleast I couldn't get it to work, it won't accept any references to static functions as a default value.</p> <p>The best I could do was this:</p> <pre><code>public function myFunction(functionArgument:Function = null):void { if (functionArgument != null) { func...
<p>Parameter defaults must be compile-time constants, because the compiler has to put in the default value when the code is compiled. This means static functions, no matter how predictable they are, cannot be used as parameter defaults. Compile-time constants are values the compiler knows about by inspecting your code,...
47,488
<p>I want to implement Generics in my Page Class like :</p> <pre><code>Public Class MyClass(Of TheClass) Inherits System.Web.UI.Page </code></pre> <p>But for this to work, I need to be able to instantiate the Class (with the correct Generic Class Type) and load the page, instead of a regular Response.Redirect. Is the...
<p>I'm not sure to fully understand what you want to do. If you want something like a generic Page, you can use a generic BasePage and put your generic methods into that BasePage:</p> <pre><code>Partial Public Class MyPage Inherits MyGenericBasePage(Of MyType) End Class Public Class MyGenericBasePage(Of T As New...
<p>The answer that says to derive a type from the generic type is a good one. However, if your solution involves grabbing a page based upon a type determined at runtime then you should be able to handle the PreRequestHandlerExecute event on the current HttpApplication.</p> <p>This event is called just before a Request...
13,807
<p>When is it appropriate to use an unsigned variable over a signed one? What about in a <code>for</code> loop?</p> <p>I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. </p> <pre><code>for (unsigned int i = 0; i &lt; someThing.length(); i++) { SomeThing var = ...
<p>I was glad to find <a href="https://web.archive.org/web/20170323034837/http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2004-02/1382.html" rel="noreferrer">a good conversation</a> on this subject, as I hadn't really given it much thought before.</p> <p>In summary, signed is a good general choice - even when you...
<p>In your example above, when 'i' will always be positive and a higher range would be beneficial, unsigned would be useful. Like if you're using 'declare' statements, such as: </p> <pre><code>#declare BIT1 (unsigned int 1) #declare BIT32 (unsigned int reallybignumber) </code></pre> <p>Especially when these values wi...
2,283
<p>Does anyone have any practical suggestions about how to manage feature creep in GUIs? </p> <p>I'm getting strong pressure from both internal and external sources to add, modify, tweak, etc. I always cringe when someone approaches me with the words "wouldn't it be nice if...?". I can't just turn around and yell "NO"...
<p>Have feature requests handled in a formal process, normally through the project manager and whoever analyzed the requirements originally. Its always better to palm those sorts of decisions off to someone that isn't the developer, assuming that whoever is going to do that job is actually capable of it.</p> <p>If yo...
<p>Create work mandates that define the problem that needs solving. Your work is constrained by only needing to implement that which is necessary to solve the problem.</p> <p>Any further refinement of the problem then becomes change control.</p>
10,860
<p>Using Visual Studio 2008 / C# / VS Unit Testing.</p> <p>I have a very straightforward extension method, that will tell me if an object is of a specific type:</p> <pre><code>public static bool IsTypeOf&lt;T, O&gt;(this T item, O other) { if (!(item.GetType() is O)) return false; else return ...
<p>Usually, a <code>MissingMethodException</code> means that you are loading a different version of the dll to the one you referenced during build, and the actual dll you are loading (at run-time) doesn't have the method the compiler found (at compile-time).</p> <p>Check that you haven't somehow got various versions o...
<p>I am speculating here.</p> <p>Put a constraint on the method to see if that helps <code> Pseudocode</p> <p>public static bool IsTypeOf(this T item, O other) Where T: object, O: Type { } </code></p> <p>Also, which class is this method in?</p> <p>EDIT: Is this class, part of the assembly which is being tested?</p>...
45,686
<p>I'm developing a an eclipse plugin that uses an SWT interface. I need to display text, and within that text there needs to be links. The only two widgets that I've found that will allow me to include clickable links in text are Link and Browser. Browser, however, is overkill for my needs, and I couldn't properly ...
<p>Mark your thread as BackgroundThread, and it will stop running as soon as you close the window.</p>
<p>Yes, you need to kill the thread first.</p> <p>This really has nothing to do with debug mode though. This has to do with basic threading.</p> <p>EDIT: Per your update, you should not be aborting the thread. The thread should be getting signaled and exiting on it's own. I am not sure what your thread or code looks ...
19,708
<p>I've tried <a href="http://www.vim.org/scripts/script.php?script_id=159" rel="noreferrer">MiniBufExplorer</a>, but I usually end up with several windows showing it or close it altogether. What I'd like is something like <a href="http://www.vim.org/scripts/script.php?script_id=2050" rel="noreferrer">LustyJuggler</a> ...
<p>I used to use a combination of tabs and multiple <code>gvim</code> instances, keeping groups of related files as tabs in each instance. So long as I didn't end up with too many tabs in one instance, the tab bar shows you the name of each file you're editing at a glance.</p> <p>Then I read a post by Jamis Buck on ho...
<p>i use simple :vsplit with ^W+w/^W+r and :tabnew with Ctrl+Alt+PgUp/PgDown key combinations.</p>
42,426
<p>I'm not a SQL expert, and I'm reminded of the fact every time I need to do something beyond the basics. I have a test database that is not large in size, but the transaction log definitely is. How do I clear out the transaction log?</p>
<p>Making a log file smaller should really be reserved for scenarios where it encountered unexpected growth which you do not expect to happen again. If the log file will grow to the same size again, not very much is accomplished by shrinking it temporarily. Now, depending on the recovery goals of your database, these a...
<p>DB Transaction Log <strong>Shrink to min size</strong>:</p> <ol> <li>Backup: Transaction log</li> <li>Shrink files: Transaction log</li> <li>Backup: Transaction log</li> <li>Shrink files: Transaction log</li> </ol> <p>I made tests on several number of DBs: <strong>this sequence works</strong>. </p> <p>It usually ...
8,058
<p>In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original?</p> <p>I usually just copy the string to a new variable then bind it to the <code>s///</code> regex that does the replacement on the new string, but...
<p>This is the idiom I've always used to get a modified copy of a string without changing the original:</p> <pre><code>(my $newstring = $oldstring) =~ s/foo/bar/g; </code></pre> <p>In perl 5.14.0 or later, you can use the new <code>/r</code> <a href="https://metacpan.org/pod/release/FLORA/perl-5.14.2/pod/perl5140delta....
<p>If you write Perl with <code>use strict;</code>, then you'll find that the one line syntax isn't valid, even when declared.</p> <p>With:</p> <pre><code>my ($newstring = $oldstring) =~ s/foo/bar/; </code></pre> <p>You get:</p> <pre><code>Can't declare scalar assignment in "my" at script.pl line 7, near ") =~" Exe...
4,287
<p>How do I concatenate two <code>std::vector</code>s?</p>
<pre><code>vector1.insert( vector1.end(), vector2.begin(), vector2.end() ); </code></pre>
<p>To be honest, you could fast concatenate two vectors by copy elements from two vectors into the other one or just only append one of two vectors!. It depends on your aim.</p> <p><strong>Method 1:</strong> Assign new vector with its size is the sum of two original vectors' size.</p> <pre><code>vector&lt;int&gt; con...
24,640
<p>I have a very basic question about MVC web applications in Java.</p> <p>Since the olden days of raw JSP up until current technologies like Seam, a very basic pattern has always been the internal dispatch from the controller that initially accepted the request to the view layer that creates the output to be sent to ...
<p>You can prevent access to internal resources by using a <a href="http://wiki.metawerx.net/wiki/Web.xml.SecurityConstraint" rel="nofollow noreferrer"><code>security-constraint</code></a> in your <code>web.xml</code> deployment descriptor.</p> <p>For example, I use the following configuration to prevent direct access...
<p>I would not recommend allowing Internet requests to directly access your appserver. I'd throw a webserver in front, then in it, allow the request of certain kinds of URLs. Don't want people to go to foo.com/jsps? Restrict it once and for all there.</p> <p>There's a bit of a conversation on the topic here: <a href="...
18,874
<p>In your “enterprise” work environment, how are engineers held accountable for performing code inspections and unit testing? What processes do you follow (formal methodology or custom process) to ensure the quality of your software? Do you or have you tried implementing a developer "signoff" sheet for deliverables?...
<p>• Our company uses peer code reviews. We conduct them as Over-The-Shoulder reviews and invite the team’s tester to participate in the meeting to gain a better understanding of the changes. We use Source Control software that requires check-in, code-review rules to be signed off. Nothing big, just another developer'...
<p>We use three basic rules</p> <p>1) The developer is responsible for fixing bugs in code when unit tests don't exist. In cases where there is a test, the person breaking the test is responsible for fixing it.</p> <p>2) Code reviews. There are some code review smells that are a good warning sign, over defensiveness ...
33,768
<p>I have a class with a nullable int? datatype set to serialize as an xml element. Is there any way to set it up so the xml serializer will not serialize the element if the value is null? </p> <p>I've tried to add the [System.Xml.Serialization.XmlElement(IsNullable=false)] attribute, but I get a runtime serializati...
<p>XmlSerializer supports the <code>ShouldSerialize{Foo}()</code> pattern, so you can add a method:</p> <pre><code>public bool ShouldSerializeID() {return ID.HasValue;} </code></pre> <p>There is also the <code>{Foo}Specified</code> pattern - not sure if XmlSerializer supports that one.</p>
<p>Unfortunately, the behaviours you describe are accurately documented as such in the docs for XmlElementAttribute.IsNullable.</p>
30,390
<p>My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix:</p> <pre><code>select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); </code></pre>...
<blockquote> <p>Here's the query (simplified version) </p> </blockquote> <p>I think by simplifying the query you removed the real cause of the bug :-)</p> <p>What oracle version are you using? Oracle 10g ( 10.2.0.1.0 ) gives: </p> <pre><code>create table parts (ptno number , ptnm number , catcd number); create...
<p>It is generally advised to be specific and fully qualify all column names anyway, as it saves the optimizer a little work. Certainly in SQL Server.</p> <p>From what I can gleen from the <a href="http://www.oracle.com/technology/index.html" rel="nofollow noreferrer">Oracle docs</a>, it seems it will only throw if yo...
8,328
<p>I have a start of a webapp that I wrote without using the Object Oriented features of PHP.</p> <p>I don't really know if it is worth it to go back and rewrite the parts I have finished. Is object oriented PHP worth rewriting all or part of a decent working app?</p>
<p>Given that you have an incomplete app I would say that reworking it into an Object based app will probably be helpful. </p> <p>One thing to consider is the expected size of the end application. Below a certain complexity Object based may be overkill except for the learning experience.</p> <p>I started out avoiding...
<p>I would say try and go OO just because what you have can be reused much easier than procedural <em>if done right</em> </p> <p>I will also say that OO is much more organized then procedural. When your at a small scale it's easy to get away with sloppy code OO or not. But when you get to larger projects your procedur...
8,197
<p>I want to develop a very simple 2D game in Python. Pygame is the most popular library for game development in Python, but I'm already quite familiar with wxPython and feel comfortable using it. I've even written a <a href="http://eli.thegreenplace.net/2008/05/31/a-tetris-clone-in-python-wxpython/" rel="noreferrer">T...
<p>Well, in theory there is nothing you can do with Pygame that you can't with wxPython. The point is not what but how. In my opinion, it's easier to write a game with PyGame becasue:</p> <ul> <li><p>It's faster. Pygame is based on SDL which is a C library specifically designed for games, it has been developed with sp...
<p>wxPython is based on <a href="http://wxwidgets.org/" rel="noreferrer">wxWidgets</a> which is a GUI-oriented toolkit. It has the advantage of using the styles and decorations provided by the system it runs on and thus it is very easy to write portable applications that integrate nicely into the look and feel of whate...
44,670
<p>I have a Visual Studio 2008 Setup Project that when compiled in the past would generate a Setup.exe in the output directory along with the .msi output file. Now it no longer generates the Setup.exe which I actually do need.</p> <p>Did I change a project setting without realizing? How do I get it to generate it agai...
<p>Try opening project properties, click Prerequisites button there and check "Create setup program to install prerequisite components". </p> <p>This is for Visual Studio 2005, not sure if it works for Visual Studio 2008.</p>
<p>1, Go to file menu > click Add > new project >now “Add New Project” Dialog appear.</p> <p>2.Select “Other Project Types” and click “Setup and Deployment” projects,Choose “Setup Project”give name project name in name text box finally click OK.</p> <p>3.New project appear in solution explorer,for example you give th...
25,483
<p>I have read some PL SQL programming books, and they recommend me to group procedures, functions, cursors, and so on in a package. Packages provide modularity and information hiding, which is the OO design. However, I'm just familiar with stand alone procedures. Would anyone kindly provide some examples in code and h...
<p>If you're familiar with calling stand alone procedures, calling procedures in packages is not very different. Just prefix the procedure name with the package name like this: package_name.procedure_name.</p>
<p>To follow up, you might have a standalone like</p> <pre><code>create or replace procedure foo (i_something in varchar2) as begin -- do some stuff; end foo; </code></pre> <p>which you call with "foo('bar');"</p> <p>That would become a package and a package body as</p> <pre><code>create or replace package my_pa...
37,626
<p>I am trying to develop a plug-in for <a href="http://trac.webkit.org/wiki/QtWebKit" rel="nofollow noreferrer">QtWebkit</a>. But I am not able to find how to develop a plugin for QtWebKit, hopefully one that can be invoked by JavaScript. Does anyone know of any tutorials or documents that explain how to do this?</p>...
<p>The simple answer is to write a subclass of <code>QWebPage</code> and set this on your <code>webview</code>. Then you can show your own HTML page and react to the appropriate object tag in the <a href="http://doc.qt.io/archives/4.6/qwebpage.html#createPlugin" rel="nofollow noreferrer"><code>createPlugin</code></a> m...
<p><a href="http://developer.apple.com/documentation/InternetWeb/Conceptual/WebKit_PluginProgTopic/WebKitPluginTopics.html" rel="nofollow noreferrer">Introduction to WebKit Plug-in Programming Topics</a> is for WebKit, is QtWebKit that special?</p>
39,114
<p>I am a MFC programmer who is new to C# and am looking for a simple control that will allow number entry and range validation.</p>
<p>Look at the "NumericUpDown" control. It has range validation, the input will always be numeric, and it has those nifty increment/decrement buttons.</p>
<p>You can use a regular textbox and a Validator control to control input.</p>
10,257
<p>I'm using <code>urllib2</code> to read in a page. I need to do a quick regex on the source and pull out a few variables but <code>urllib2</code> presents as a file object rather than a string.</p> <p>I'm new to python so I'm struggling to see how I use a file object to do this. Is there a quick way to convert this ...
<p>You can use Python in interactive mode to search for solutions.</p> <p>if <code>f</code> is your object, you can enter <code>dir(f)</code> to see all methods and attributes. There's one called <code>read</code>. Enter <code>help(f.read)</code> and it tells you that <code>f.read()</code> is the way to retrieve a str...
<p>Michael Foord, aka Voidspace has an excellent tutorial on urllib2 which you can find here: <a href="http://www.voidspace.org.uk/python/articles/urllib2.shtml" rel="noreferrer">urllib2 - The Missing Manual</a></p> <p>What you are doing should be pretty straightforward, observe this sample code:</p> <pre><code>impo...
45,053
<p>I realize that this would be COMPLETELY bad practice in normal situations, but this is just for a test app that needs to be taking input from a bar code scanner (emulating a keyboard). The problem is that I need to start up some scripts while scanning, so I need the window to regain focus directly after I click the...
<p>I struggled with a similar problem for quite a while. After much experimentation and guessing, this is how I solved it:</p> <pre><code>// Get the window to the front. this.TopMost = true; this.TopMost = false; // 'Steal' the focus. this.Activate(); </code></pre>
<p>You might try focusing on a specific input, or try the setting .TopMost property to true (and then unsetting it again).</p> <p>But I suspect your problem is that these methods all just place messages in the windows event queue, and your program has to wait for all existing events to finish processing before it will...
35,130
<p>Windows Programming: How to put a file that is frequently accessed in the OS cache?</p>
<p>Disclaimer : I dont work all that much under Windows</p> <p>In the general case, you shouldnt mess with your OS cache. It should be smart enough to cache data that are accessed often. If it isnt, you should use an application level cache. I dont know which language you are using, but most probably there is a good c...
<p>If your in .net and the file is a dll, look into the <a href="http://en.wikipedia.org/wiki/Global_Assembly_Cache" rel="nofollow noreferrer">Global Assembly Cache (GAC)</a>.</p>
40,500
<p>I want to get the method <code>System.Linq.Queryable.OrderyBy&lt;T, TKey&gt;(the IQueryable&lt;T&gt; source, Expression&lt;Func&lt;T,TKey&gt;&gt; keySelector)</code> method, but I keep coming up with nulls.</p> <pre><code>var type = typeof(T); var propertyInfo = type.GetProperty(group.PropertyName); var propertyTyp...
<p>Solved (by hacking LINQ)!</p> <p>I saw your question while researching the same problem. After finding no good solution, I had the idea to look at the LINQ expression tree. Here's what I came up with:</p> <pre><code>public static MethodInfo GetOrderByMethod&lt;TElement, TSortKey&gt;() { Func&lt;TElement, TSort...
<p>I think that it mabe be made with class like so:</p> <pre><code>public static class SortingUtilities&lt;T, TProperty&gt; { public static IOrderedQueryable&lt;T&gt; ApplyOrderBy(IQueryable&lt;T&gt; query, Expression&lt;Func&lt;T, TProperty&gt;&gt; selector) { return query.OrderBy(selector); } ...
33,865
<p>Every so often I get the impression that my knowledge of mathematics (as it pertains to the field of software development) has some gaps. I'm an educated person. I have a college degree. I've always enjoyed learning, which is why I would like to try to fill in these gaps.</p> <p>My job is in the financial industry,...
<p>One area of math that's very useful for programming is Discrete Math. A good reference for that is the MIT Open Courseware course on "Mathematics for Computer Science", which is <a href="http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-042JMathematics-for-Computer-ScienceFall2002/Readings/inde...
<p>As someone doing a major in mathematics, I think that mathematics is best learned from a good teacher, with some pressure to succeed (such as tuition fees). I find it easy to learn computing by myself, but mathematics is much harder. I still enjoy it immensely.</p>
37,977
<p>This is what I've got. It works. But, is there a simpler or better way?</p> <p>ASPX Page&hellip;</p> <pre><code>&lt;asp:Repeater ID="RepeaterBooks" runat="server"&gt; &lt;HeaderTemplate&gt; &lt;table class="report"&gt; &lt;tr&gt; &lt;th&gt;Published&lt;/th&gt; ...
<p>@Geoff</p> <p>That sort of Eval statement was actually added in 2.0, but if performance is important Eval should be avoided since it uses Reflection.</p> <p>The repeater is a pretty good way of doing it, although it might be faster to generate the table in code:</p> <p>ASPX Page:</p> <pre><code>&lt;table class="...
<blockquote> <p><strong><a href="https://stackoverflow.com/users/1249/alassek">ALassek</a></strong> wrote:</p> <p>&hellip;generate the table in code&hellip;</p> </blockquote> <p>I like the look of that! It seems MUCH less likely to produce a run-time exception due to a typo or field name change.</p>
6,539
<p>Does anyone have metrics on the utility of formal Unit Testing? I see a lot of attention being paid to unit testing tools and I was curious why?</p> <p>I stopped formal unit testing over 5 or 6 years ago and the net gain in productivity seems quite high. I stopped unit testing because I noticed that it never caug...
<p>I acknowledge your superiority as human being and a coder.</p> <p>I, however, am a mere moron, and without Python unittest, I would be lost. </p> <p>I cannot refactor without unit tests, it just takes too much thinking.</p> <p>I can barely code without unit tests, it's too hard to be absolutely sure I absolutely...
<p>Remember the rise in popularity of 70's and 80's haircuts and clothes... that didn't work out so well for those of us who lived in those decades.</p> <p>Formal unit testing takes considerable work and effort to maintain. I'd guess that it takes 20-50% of the time it takes to actually develop the software. What I...
43,288
<p>In a method, I want to be able to insert a value into a div which is part of the html document I choose to parse.</p> <pre><code>public void AddToDiv(string div) { //Code to read the html document and look for the div //(name specified as the parameter of this method). } </code></pre> <p>Question is, I c...
<p>Personally, I'd check for existence, rather than allowing the exception to be thrown, it's easier to determine the flow of logic, and fits better with the intent of your code.</p> <p>See these questions and answers for a broader discussion</p> <p><a href="https://stackoverflow.com/questions/77127/when-to-throw-an-...
<p>throwing and catching are two opposite sides of exception handling. The component that encounters a disaster and can't recover from it throws the Exception. Somewhere lower down on the stack, a calling component can catch the Exception and handle it. </p> <p>The difference is in this case, the pattern would be AddT...
47,459
<p>I'm regularly creating an XSD schema by transforming a proprietary data model of a legacy system. This works out pretty good. However, the legacy system only allows me to specify very basic attributes of a parameter, such as the data type (<code>int</code>, <code>string</code> etc.).</p> <p>I would like to enhance ...
<p>The best solution would be to modify the legacy data by adding the missing metadata. </p> <p>An instance of the modified "datamodel" vocabulary may be something like this:</p> <pre><code>&lt;datamodel xmlns:nm="my:new.meta"&gt; &lt;customer&gt; &lt;firstName type="string" nm:nillable...
<p>"What do you think of that?"</p> <p><strike>Two</strike>Three things.</p> <ol> <li><p>Fix the legacy metadata. It's XML. Add stuff to it. Add a namespace if you have to.</p></li> <li><p>If you can't fix the legacy metadata, who will maintaint he second set of metadata that isn't in XML notation? Who will do th...
35,478
<p>I have a page with many forms on it. could be 1..200. None of these forms have buttons and they are built programatically. I am using jquery to submit all the forms that are checked.</p> <pre><code> function FakeName() { $("input:checked").parent("form").submit(); } </code></pre> <p>My forms l...
<p>The <code>onsubmit</code> handler is deliberately not triggered when you programatically submit the form. This is to avoid infinite recursion if an event handler would cause the event to be triggered again (and therefore the event handler to be called again)</p> <p>However, of course you can call the <code>processR...
<p>Look up <a href="https://developer.mozilla.org/index.php?title=En/DOM/Element.dispatchEvent" rel="nofollow noreferrer">dispatchEvent</a> and it's equivalent <a href="http://msdn.microsoft.com/en-us/library/ms536423(VS.85).aspx" rel="nofollow noreferrer">fireEvent</a>. It's not the easiest thing in the world to use, ...
31,128
<p>I'm trying to select a random 10% sampling from a small table. I thought I'd just use the RAND() function and select those rows where the random number is less than 0.10:</p> <pre><code>SELECT * FROM SomeTable WHERE SomeColumn='SomeCondition' AND RAND() &lt; 0.10 </code></pre> <p>But I soon discovered that ...
<p>This type of approach (shown by ΤΖΩΤΖΙΟΥ) will not guarantee a 10% sampling. It will only give you all rows where Rand() is evaluated to &lt; .10 which will not be consistent. </p> <p>Something like</p> <pre><code>select top 10 percent * from MyTable order by NEWID() </code></pre> <p>will do the trick.</p> <p>...
<p>Did you see this question?</p> <p><a href="https://stackoverflow.com/questions/94906/how-do-i-return-random-numbers-as-a-column-in-sql-server-2005">How do I return random numbers as a column in SQL Server 2005?</a></p> <p>Adam posted a UDF you can use in place of Rand() that works much better.</p>
19,780
<p>I've two tables TAB_A and TAB_B. TAB_A is master table and TAB_B is child / transaction table. TAB_A is having COL_A (Primary key) and TAB_B is having COL_B (Primary key) and also COL_A.</p> <p>For some business reason, Foreign key is not defined between TAB_A and TAB_B on column COL_A.</p> <p>There are four recor...
<p>Both queries should return the same rows. If this really behaves as you describe, you have found a bug in DB2.</p> <p>What are you trying to accomplish with this query? If the values (1,2,3,4) of B.COL_A are orphan records, then this query should return no rows. If you meant to be searching for the orphans, you ...
<p>You should use an ON clause instead of a WHERE clause in your inner join. The ON clause relates to the actual join, whereas WHERE typically is used for extra conditions not relating to the join.</p> <p><a href="http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/sqlp/rbafymstinj.htm" rel="nofollow nore...
31,506
<p>Does anyone know of a .NET date/time parser similar to <a href="http://chronic.rubyforge.org/" rel="noreferrer">Chronic for Ruby</a> (handles stuff like "tomorrow" or "3pm next thursday")?</p> <p>Note: I do write Ruby (which is how I know about Chronic) but this project must use .NET.</p>
<p>We developed exactly what you are looking for on an internal project. We are thinking of making this public if there is sufficient need for it. Take a look at this blog for more details: <a href="http://precisionsoftwaredesign.com/blog.php" rel="noreferrer">http://precisionsoftwaredesign.com/blog.php</a>.</p> <p>Fe...
<p>@ Burton: I think he meant the other way, at least from the example on the linked page:</p> <pre><code> Chronic.parse('tomorrow') #=&gt; Mon Aug 28 12:00:00 PDT 2006 Chronic.parse('monday', :context =&gt; :past) #=&gt; Mon Aug 21 12:00:00 PDT 2006 Chronic.parse('this tuesday 5:00') #=&gt; Tue Aug...
4,356
<p>Is entity framework just a fancy name for another CRUD code generator?</p> <p>Or is there more to it?</p>
<p>(Copy/paste of an <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c?answer=90432#90432">answer I provided elsewhere</a>)</p> <p>Falling through <code>switch</code>-<code>case</code>s can be achieved by having no code in a <code>case</code> (see <code>case 0</code>), or using the special <code>g...
<p>You forgot to add the "break;" statement into case 3. In case 2 you wrote it into the if block. Therefore try this:</p> <pre><code>case 3: { ans += string.Format("{0} hundred and ", numbers[number / 100]); break; } case 2: { int t = (number / 10) % 10; if (t == ...
20,983
<p>A friend and I are going back and forth with brain-teasers and I have no idea how to solve this one. My assumption is that it's possible with some bitwise operators, but not sure.</p>
<p>In C, with bitwise operators:</p> <pre class="lang-c prettyprint-override"><code>#include&lt;stdio.h&gt; int add(int x, int y) { int a, b; do { a = x &amp; y; b = x ^ y; x = a &lt;&lt; 1; y = b; } while (a); return b; } int main( void ){ printf( "2 + 3 = %d", a...
<p>Python codes: (1)</p> <pre><code>add = lambda a,b : -(-a)-(-b) </code></pre> <p>use lambda function with '-' operator</p> <p>(2)</p> <pre><code>add= lambda a,b : len(list(map(lambda x:x,(i for i in range(-a,b))))) </code></pre>
47,722
<p>I have a quite old templating system written on top of ERB. It relies on ERB templates stored in database. Those are read and rendered. When I want to pass data from one template to another I use the :locals parameter to Rails render method. For setting default variables of those variables in some templates I use th...
<p>First: actually, <a href="http://ruby-doc.com/docs/ProgrammingRuby/html/tut_expressions.html#UG" rel="noreferrer"><code>defined?</code> is an operator</a>.</p> <p>Second: if I understand your question correctly, the way to do it is with this Ruby idiom:</p> <pre><code>perex ||= true </code></pre> <p>That'll assig...
<p>Taking into considerationg <a href="https://stackoverflow.com/questions/238615/defined-method-in-ruby-and-rails/633927#633927">mislav's original answer</a> and <a href="https://stackoverflow.com/questions/238615/defined-method-in-ruby-and-rails/1924195#1924195">KenB's elaboration</a>, I think the following is the ab...
29,513
<p>We all know you can't do the following because of <code>ConcurrentModificationException</code>:</p> <pre><code>for (Object i : l) { if (condition(i)) { l.remove(i); } } </code></pre> <p>But this apparently works sometimes, but not always. Here's some specific code:</p> <pre class="lang-java pretty...
<p><a href="https://docs.oracle.com/javase/9/docs/api/java/util/Iterator.html#remove--" rel="noreferrer"><code>Iterator.remove()</code></a> is safe, you can use it like this:</p> <pre><code>List&lt;String&gt; list = new ArrayList&lt;&gt;(); // This is a clever way to create the iterator and call iterator.hasNext() li...
<p>this might not be the best way, but for most of the small cases this should acceptable:</p> <blockquote> <p><em>"create a second empty-array and add only the ones you want to keep"</em></p> </blockquote> <p><sub>I don't remeber where I read this from... for justiness I will make this wiki in hope someone finds i...
27,654
<p>When trying to distribute work that requires a multiple stage processing pipeline what are the communication, synchronization and throughput costs limitations in JMS vs JavaSpaces?</p>
<p>If you want SEDA, sending messages from stage to stage, then JMS implementations are typically much faster and more scalable, since MOMs are designed to not require locks so they can be highly asynchronous and concurrent. With JMS you can setup a consumer on startup and the message broker will typically push message...
<p>One other point to consider, JMS queues don't provide the ability to block based on size so a pure SEDA implementaion has a hard time working with pure JMS queues as it relies on the queues 'filling up' and applying back pressure on upstream stages.</p>
15,531
<p>How can I test my iphone application on iPhone device before submittimg it to Apple Store?</p>
<p>You need to join the <a href="http://developer.apple.com/iphone/" rel="nofollow noreferrer">iPhone Developer Program</a>. This will give you a digital certificate that you can use to sign your application and allow it to both run on your own iPhone and submit it to the App Store. The docs are available when you sign...
<p>You can use the iPhone emulator built into the latest XCode</p> <p>You can attach an iPhone or iPod touch to your Mac and XCode will run your app directly on the device, with debugging support.</p>
48,019
<p>using the Code Snippet for sending email in VB.Net I have successfully sent an email from my local machine, but when I Upload it to my server I get a message that the email failed. We have a national relay server that is running SMTP and I am pointed at that server in both instances. The only differance that jump ...
<p>You shouldn't need SMTP running locally, as the VB.Net code should just be using basic TCP/IP to communicate directly to the relay server.</p> <p>It would be useful to see the error message, it is possible that the server does not have access to port 25 on the relay server (eg. due to the firewall configuration). N...
<p>You should not need an smtp server on the server if you specify the relay server. Double check that My.Settings.EmailServerAddress is indeed pointing to the relay server.</p>
48,517
<p>Following on from my <a href="https://stackoverflow.com/questions/19454/enforce-attribute-decoration-of-classesmethods">previous question</a> I have been working on getting my object model to serialize to XML. But I have now run into a problem (quelle surprise!).</p> <p>The problem I have is that I have a collectio...
<h2>Problem Solved!</h2> <p>OK, so I finally got there (admittedly with a <strong>lot</strong> of help from <a href="http://www.codeproject.com/KB/XML/xmlserializerforunknown.aspx" rel="noreferrer">here</a>!).</p> <p>So summarise:</p> <h3>Goals:</h3> <ul> <li>I didn't want to go down the <em>XmlInclude</em> route due t...
<p>I've done things similar to this. What I normally do is make sure all the XML serialization attributes are on the concrete class, and just have the properties on that class call through to the base classes (where required) to retrieve information that will be de/serialized when the serializer calls on those properti...
4,044
<p>Consider an indexed MySQL table with 7 columns, being constantly queried and written to. What is the advisable number of rows that this table should be allowed to contain before the performance would be improved by splitting the data off into other tables?</p>
<p>Whether or not you would get a performance gain by partitioning the data depends on the data and the queries you will run on it. You can store many millions of rows in a table and with good indexes and well-designed queries it will still be super-fast. Only consider partitioning if you are already confident that you...
<p>While after the fact you could point to the table size at which performance became a problem, I don't think you can predict it, and certainly not from the information given on a web site such as this!</p> <p>Some questions you might usefully ask yourself:</p> <ul> <li>Is performance currently acceptable?</li> <li>...
13,390
<p>I know I can get this to technically work but I'd like to implement the cleanest possible solution. Here's the situation:</p> <p>I have a managed library which wraps an unmanaged C-style library. The C-style library functionality I'm currently wrapping does some processing involving a list of strings. The librar...
<p>.NET can auto-convert the delegate to a pointer to function if it is declared right. There are two caveats</p> <ol> <li>The C function must be built STDCALL</li> <li>The pointer to function does not count as a reference to the object, so you must arrange for a reference to be kept so that the underlying object is ...
<p>You want to do something like this:</p> <pre><code>typedef void (__stdcall *w_InvalidStringFilter) (int lineNumber, string message); GCHandle handle = GCHandle::Alloc(InvalidStringFilter); w_InvalidStringFilter callback = static_cast&lt;w_InvalidStringFilter&gt;( Marshal::GetFunctionPointerForDelegate(Inval...
20,344
<p>How can I show a grey transparent overlay in C#?<br> It should overlay other process which are not owned by the application doing the overlay.</p>
<p>Ah. Found a comment on php.net that reminded me of the answer; you need to wildcard your value before the bindParam is evaluated, and not worry about quoting it. So for example this works fine:</p> <pre><code>$str = "%$str%"; $query = $db-&gt;prepare("select * from comments where comment like :search"); $query-&gt;...
<p>5 years later, in case anyone else stumbles upon this, there is an alternative method I've discovered. The accepted solution wasn't really feasible for my situation, but this method seems to get the job done as well:</p> <pre><code>$query = $db-&gt;prepare("select * FROM table WHERE field LIKE CONCAT('%',:search,'%...
8,580
<p>How can I extract the list of available SQL servers in an SQL server group? I'm planning to put that list in a combo box in VB.NET.</p>
<p>The only way I knew to do it was using the command line:</p> <pre><code>osql -L </code></pre> <p>But I found the below article which seems to solve your specific goal filling a combobox:</p> <p><a href="http://www.sqldbatips.com/showarticle.asp?ID=45" rel="nofollow noreferrer">http://www.sqldbatips.com/showarticl...
<p>In C# I've used calls to odbc32.dll</p> <p>For example:</p> <pre><code>[DllImport("odbc32.dll", CharSet = CharSet.Ansi)] private static extern short SQLBrowseConnect( IntPtr hconn, StringBuilder inString, short inStringLength, StringBuilder outString, short outStringLength, out short outLengthNeeded); </code></p...
17,781
<p>How do I check if a column exists in SQL Server 2000?</p>
<pre><code>IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='tablename' AND COLUMN_NAME='columname' ) </code></pre>
<p>I don't know if this script will work in sqlserver 2000, but in 2008 works:</p> <pre><code>SELECT COLUMNS.* FROM INFORMATION_SCHEMA.COLUMNS COLUMNS, INFORMATION_SCHEMA.TABLES TABLES WHERE COLUMNS.TABLE_NAME=TABLES.TABLE_NAME AND UPPER(COLUMNS.COLUMN_NAME)=UPPER('column_name') </code></pre>
28,781
<p>I have a Tevo Tornado that I've outfitted with an official BL-Touch auto level sensor. I can see the bed probing run, and I can see the Z axis slowly adjust during x/y moves, so it's doing <em>something</em>. However, you can see that there appears to be a systematic tilt:</p> <p><a href="https://i.stack.imgur.com/...
<p>The problem with the Tevo Tornado design is that the design is as such that the Z-axis is powered by a single stepper (under the assumption that you have not added a second Z stepper).</p> <p>This means that the level relies on the rigidity of the X-axis assembly, more specific the play on the guide wheels. Apparen...
<p>I know this is incredibly old at this point, but in case anyone stumbles upon this post like I did, I wanted to point out that there is no semicolon behind your G29 code, so it's not being read properly</p>
1,316
<p>I am using master page on some pages. And that master page is loading the user control. So I want to disable or enable user control on some page load which has master page. </p> <hr> <p>Is there anyway can I disable User control on master page Page_load()</p> <hr> <pre><code>&lt;div class="ucTabCtrl" &gt; &...
<p>Your question is kinda hard to understand, but i think what you are looking for is something like this:</p> <pre><code>public partial class Site1 : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { if (Page is WebForm1 || Page is WebForm2) { webUse...
<p>You want to disable it on the child page? You could do something like this in the Page_Load() method:</p> <pre><code>if (null != this.Master) { userControl.Enabled = false; } </code></pre>
46,996
<p>More than about LINQ to [insert your favorite provider here], this question is about searching or filtering in-memory collections. </p> <p>I know LINQ (or searching/filtering extension methods) works in objects implementing <code>IEnumerable</code> or <code>IEnumerable&lt;T&gt;</code>. The question is: <em>because ...
<p>Even with parallelisation, it's still O(n). The constant factor would be different (depending on your number of cores) but as n varied the total time would still vary linearly.</p> <p>Of course, you could write your own implementations of the various LINQ operators over your own data types, but they'd only be appro...
<p>Yes, it has to be, because the only way of accessing any member of an <code>IEnumerable</code> is by using its methods, which means O(n).</p> <p>It seems like a classic case in which the language designers decided to trade performance for generality.</p>
17,367
<p>Does anyone know if there is a debug visualiser for this yet along the same lines and the linq to SQL debug visualiser?</p>
<p>There isn't one that I'm aware of at the moment (hope to be shown otherwise by other answers here), but Julie Lerman has a post <a href="http://www.thedatafarm.com/blog/2008/04/29/AnExtensionMethodForVisualizingObjectStateEntries.aspx" rel="nofollow noreferrer">"An extension method for visualizing ObjectStateEntries...
<p>Here is a link to a visualizer that does what you are looking for I think - <a href="http://www.thinqlinq.com/Post.aspx/Title/LINQ-to-Entity-Visualizer#close=1" rel="nofollow noreferrer">Visualizer</a></p>
28,964
<p>When I make relationsships with JPA using hibernate, some terrible long and ackward column names are generated.<br> Eg. I have the following <code>actionPlan_actionPlanPK</code>, which means that the column <code>actionPlan</code> is a FK that points to <code>actionPlanPK</code>.<br> To make it look just a little bi...
<p>When you are using ASP.NET Ajax, a AJAX request will still process all code-behind code, however, the only rendering updates will be those to items inside your update panel.</p>
<p>It also depends on whether by using the term AJAX, you are referring to real AJAX or the AJAX .NET toolkit, which mostly is a set of javascript functions, in which 90% or so of them aren't really ajax. In most of those later controls, the entire page is called, and the output is only parsed for the particular infor...
26,882
<p>I'd like to know whether this approach is correct or if their are better ways of doing this.</p> <p>I have what is basically a Person class which has a number of other classes as variables, each of the custom classes is instantiated by passing the Person ID and then that class retrieves the data it needs using that...
<p>You are defining two different relationships inside of your "set" element. What you probably want is just the many-to-many element.</p> <p>If this still doesn't work, try saving the UserRole itself to see if you can persist it on its own. If you can, then the ConstraintViolationException is being thrown while try...
<p>The contraint violation on UserRole might be a cause of trying to insert a row with a duplicate key. Maybe experiment with using other types of generators, such as "sequence".</p>
41,715
<p>Many C++ books contain example code like this...</p> <pre><code>std::cout &lt;&lt; "Test line" &lt;&lt; std::endl; </code></pre> <p>...so I've always done that too. But I've seen a lot of code from working developers like this instead:</p> <pre><code>std::cout &lt;&lt; "Test line\n"; </code></pre> <p>Is there a ...
<p>The varying line-ending characters don't matter, assuming the file is open in text mode, which is what you get unless you ask for binary. The compiled program will write out the correct thing for the system compiled for.</p> <p>The only difference is that <a href="http://en.cppreference.com/w/cpp/io/manip/endl" re...
<p>With <a href="http://en.cppreference.com/w/cpp/io/manip/endl" rel="nofollow noreferrer">reference</a> This is an <strong>output-only I/O manipulator</strong>.</p> <p><strong><code>std::endl</code></strong> Inserts a newline character into the output sequence os and flushes it as if by calling <code>os.put(os.widen(...
26,296
<p>Using remote desktop in full-screen, what is the shortest way to move to another app? (Without using the mouse, of course. I hate mice).</p> <p>I currently use one of the following:</p> <p><kbd>ctrl</kbd>-<kbd>alt</kbd>-<kbd>del</kbd>, <kbd>alt</kbd>-<kbd>t</kbd> (get to local machine's taskmgr), <kbd>alt</kbd>-<k...
<p><kbd>CTRL</kbd>-<kbd>ALT</kbd>-<kbd>PAUSE</kbd>, then you may use <kbd>ALT</kbd>-<kbd>TAB</kbd>.</p>
<p>Follow Berzerk's advice above to set <kbd>Alt</kbd>-<kbd>Tab</kbd> to always run on the local computer. Then use <kbd>Alt</kbd>-<kbd>PageUp</kbd> in the remote computer -- it works like <kbd>Alt</kbd>-<kbd>Tab</kbd> inside of an RDP session.</p>
37,719
<p>I have an method which save files to the internet, it works but just slow. Then I'd like to make the user interface more smooth, so I create an NSThread to handle the slow task. </p> <p>I am seeing a list of errors like:</p> <pre><code>_NSAutoreleaseNoPool(): Object 0x18a140 of class NSCFString autoreleased with n...
<p>Well first of all, you are both creating a new thread for your saving code and then using NSUrlConnection asynchronously. NSUrlConnection in its own implementation would also spin-off another thread and call you back on your newly created thread, which mostly is not something you are trying to do. I assume you are j...
<p>Within the thread, you need to create a new autorelease pool before you do anything else, otherwise the network operations will have issues as you saw.</p>
30,954
<p>So I have some XML in the following format:</p> <pre><code>&lt;somenode&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title/&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;P one&lt;/p&gt; &lt;p&gt;Another p&lt;/p&gt; &lt;/body...
<p>I've noticed Safari handles Asian characters better than Chrome. Also Chrome and Safari rely on the same Webkit for rendering pages, but their Javascript engines are totally different, so if you use Javascript in your pages you need to check both.</p>
<p>In a word, No. You can't assume that because it works in one it will definitely work in all cases in the other. Sure, 99% of the time, it might be the same - but 99% isn't 100% - at least, it wasn't last time I checked. Call me a pedantic git if you like.</p>
48,867
<p>Kicked off the second long print in a series (printing Lack enclosure components). First 10 hour print was flawless. Started this one, saw the first layer laid down well, went to bed. Woke up to this (you can see the successful prints in the background):</p> <p><a href="https://i.stack.imgur.com/HYYcU.jpg" rel="nor...
<h2>Yes</h2> <p>I had a somewhat similar clog once, and I could fix it back up. However, it is a lot of work.</p> <h2>Hobbyist Way</h2> <h3>Step 1: heat</h3> <p>As long as the heater cartridge is still ok, just fire up the printer, move up the print head by 50 mm and wait some two or three minutes till the goop is warm...
<p>If you can remove the hot-end it is easier. If not, carefully use hot air to soften (not melt) the PLA so you can more easily pull away chunks.</p> <p>When the hot-end is removed from the other plastic parts, you can get more aggressive with hot air. BUT, be careful of the thermistor and heater wires. They are f...
1,220
<p>My web application is relying on container-managed security and I'm wondering if it's possible to use salted passwords at all. As far as I can tell it's easy enough to store digested passwords in a database by just configuring a JDBC or DataSource Realm, but there's no way to add a salt to those digest. </p> <p>Any...
<p>If you're creating and storing the digests you can create and store the salts at the same time.</p> <p>Your auth table would contain .... pwdDigest varchar(64), -- or int256 if you have one hashSalt int64, ....</p> <p>Then depending on the auth protocol you're using you either send the hashSalt to the client when...
<p>Passord-based encryption in JCE uses salt as per PKCS#5. See <a href="http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html#PBEEx" rel="nofollow noreferrer">http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html#PBEEx</a> for an example. </p>
25,128
<p>LinkedIn are very cautious of applications using their APIs. I have tried and failed to get access to them. </p> <p>Has anyone actually built any real applications with them yet? If yes, what strategy did you employ to get access to their API?</p> <p>BTW I am talking about first class value added applications o...
<p>The LinkedIn API is now public.</p> <p>Get access here: <a href="http://developer.linkedin.com" rel="noreferrer">http://developer.linkedin.com</a></p>
<p>I am wondering the same thing. I tried to gain access to ad a resume section to my website that would be driven off LinkedIn's supposedly "open" API. But I never heard anything back from them. Not cool. Apparently they need to approve your usage of the API. I think someone needs to read to them the definition of the...
23,140
<p>Does anyone know where to find good online resources with examples of how to make grammars and parse trees? Preferably introductory materials. Info that is n00b friendly, haven't found anything good with Google myself.</p> <p><strong>Edit:</strong> I'm thinking about theory, not a specific parser software.</p>
<p>Well, here's where I learned it...</p> <p><a href="http://www.cs.uiuc.edu/class/sp08/cs273/" rel="nofollow noreferrer">http://www.cs.uiuc.edu/class/sp08/cs273/</a></p> <p>Click on the lectures tag, scroll through till you find the lectures on the material you are talking about.</p> <p>Love my alma mater. God ble...
<p><a href="http://www.goldparser.com" rel="nofollow noreferrer">www.goldparser.com</a></p> <p>The tools are free and good to work on. It has technical and theoretical tutorials, lots of info, tools and code generators for many langs.</p>
10,874
<p>I have a project consisting of two files, main.c and logoff.c. When I try to compile them I get this error:</p> <pre><code>gcc -c -g -Wall main.c gcc -c -g -Wall logoff.c gcc -o main -g -Wall main.o logoff.o ld: duplicate symbol _logoff in logoff.o and main.o</code></pre> <p>I have a function named logoff in logo...
<p>I don't believe there is a best/correct way, but the way I'd do it is...</p> <p>Each wizard gets its own page. Each step gets its own div. All steps are in the same form.</p> <p>The previous/next buttons would essentially hide/show the div in each step of the process. The last step's submit button submits the e...
<p>You can use the simple component MVCWizard.Wizard available on NuGet. The WizardController allows you to create a wizard using partial view. There is also the AutoWizardController that renders the entire wizard in a single view. All these components operate with the session to store the model state.</p>
38,013
<p>I'm using Asp.Net 2.0. I have a scenario where i need to check a user input against any of two ranges. For e.g. I need to check a textbox value against ranges 100-200 or 500-600. I know that i can hook up 2 Asp.Net RangeValidators to the TextBox, but that will try to validate the input against both the ranges, an A...
<p>A CustomValidator should work. I'm not sure what you mean by "pass the 2 ranges values from the server-side". You could validate it on the server-side using a validation method like this:</p> <pre><code>void ValidateRange(object sender, ServerValidateEventArgs e) { int input; bool parseOk = int.TryParse(e...
<p>You can use the RegularExpressionValidator with the ValidationExpression property set to</p> <p>Edit: (whoops, 650 and 201 etc. were valid with the old pattern)</p> <pre><code>^(1\d{2}|200|5\d{2}|600)$ </code></pre> <p>This will test the entered text for 100-200 and 500-600.</p>
31,376
<p>Is there any way I can use AS400 style library/file style naming over JDBC with jt400? I want to be able to run queries like:</p> <pre><code>SELECT * FROM MYLIBRARY/MYFILE </code></pre> <p>Thanks</p>
<p>Set the jdbc naming property to "system".</p> <p><a href="http://javadoc.midrange.com/jtopen_6_3/com/ibm/as400/access/doc-files/JDBCProperties.html" rel="noreferrer">http://javadoc.midrange.com/jtopen_6_3/com/ibm/as400/access/doc-files/JDBCProperties.html</a></p>
<p>There is a way to do this on the 400 with STRSQL but not as far as I know with JDBC </p>
45,413
<pre><code>&lt;td title="this is a really long line that I'm going to truncate"&gt;this is a really long line that I'm going to trunc ...&lt;/td&gt; </code></pre> <p>Is this the correct way to do it?</p>
<p>The <code>title</code> attribute doesn't work inside the <code>td</code> tag. Enclose the text within a span tag instead:</p> <pre><code>&lt;td&gt; &lt;span title="this is a really long line that I'm going to truncate"&gt;this is a really long line that I'm going to trunc ...&lt;/span&gt; &lt;/td&gt; </code></p...
<p>Yes, that's how you supposed to assign tooltips to html elements. I wouldn't use it on &lt;td&gt; though. Although I haven't tested it, I have the feeling that you might run into issues on some browsers if you use it on table rows/cells directly since these elements have somewhat different behaviour from other eleme...
27,826
<p>I'm trying to create a self signed certificate for use with Apache Tomcat 6. Every certificate I can make always results in the browser connecting with AES-128. The customer would like me to demonstrate that I can create a connection at AES-256.</p> <p>I've tried java's keytool and openssl. I've tried with a var...
<p>Okie doke, I think I just figured this out.</p> <p>As I said above, the key bit of knowledge is that the cert doesn't matter, so long as it's generated with an algorithm that supports AES 256-bit encryption (e.g., RSA). Just to make sure that we're on the same page, for my testing, I generated my self-signed cert ...
<p>danivo, so long as the server's cert is capable of AES encryption, the level of encryption between the browser and the server is independent of the cert itself -- that level of encryption is negotiated between the browser and server. In other words, my understanding is that the cert doesn't specify the level of enc...
11,793
<p>I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so :</p> <p>What is a good browser that I can use as a client to a web application?</p> <p>General functiona...
<p><a href="http://developer.mozilla.org/en/Prism" rel="noreferrer">Mozilla Prism</a> seems ideal for your purposes.</p> <p>It shares code with Firefox but is designed to run web applications without the usual Browser interface to make them appear more like desktop applications. So no back button or address bar to wo...
<p>When you run into serious issues, with Firefox you can trace it down to the code and maybe get someone to fix it. With IE, you can't.</p>
5,916
<p>I'm trying to use a dll, namely libcurl, with my program, but, it's not linking. Libcurl comes with .h files that I can include (takes care of dllimport), but then I guess I must specify which dll to actually use when linking somehow... How do I do that? I'm compiling with Borland C++ builder, but I really want to k...
<p>As mentioned, you will need the static .lib file that goes with the .dll which you run through implib and add the result lib file to your project.</p> <p>If you have done that then:</p> <ul> <li>You may need to use the stdcall calling convention. You didn't mention which version of Builder you are using, but it is...
<p>Have you tried adding the .h file to your project?</p>
48,025