instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>every time i create a FileInfo object and access it's lastaccesstime property, it's always a few minutes off. the file property window remains constant, however the application shows that it is usually a few minutes after the property window time.</p> <p>Also, i noticed that if i drag the file to the cmd window to ...
<p>In my experience, last access time is notoriously unreliable. According to <a href="http://technet.microsoft.com/en-us/library/cc781134.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc781134.aspx</a>... </p> <blockquote> <p>The Last Access Time on disk is not always current because NT...
<p>Hmm, possibly <a href="http://msdn.microsoft.com/en-us/library/system.io.filesysteminfo.lastaccesstime.aspx" rel="nofollow noreferrer">this from MSDN</a>:</p> <blockquote> <p>When first called, FileSystemInfo calls Refresh and returns the cached information on APIs to get attributes and so on. On subsequent...
31,741
<p>Can I programatically set the position of a WPF ListBox's scrollbar? By default, I want it to go in the center.</p>
<p>To move the vertical scroll bar in a ListBox do the following: </p> <ol> <li>Name your list box (x:Name="myListBox")</li> <li>Add Loaded event for the Window (Loaded="Window_Loaded")</li> <li>Implement Loaded event using method: ScrollToVerticalOffset</li> </ol> <p>Here is a working sample:</p> <p>XAML:</p> <pr...
<p>I don't think ListBoxes have that, but ListViews have the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.ensurevisible.aspx" rel="nofollow noreferrer">EnsureVisible</a> method that moves the scrollbar to the place needed in order to make sure an item is shown.</p>
19,292
<p>I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol.</p>
<p>The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol when running tests.</p> <pre>; Define functions for running Guile-written tests under the TAP protocol. ; Copyright &#169; 2008 by Omer Zak ; Released under the GNU LGPL 2.1 or (at your option) any ...
<p>The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol when running tests.</p> <pre>; Define functions for running Guile-written tests under the TAP protocol. ; Copyright &#169; 2008 by Omer Zak ; Released under the GNU LGPL 2.1 or (at your option) any ...
9,763
<p>Wow, I just got back a huge project in C# from outsourced developers and while going through my code review my analysis tool revealed bunches of what it considered bad stuff. One of the more discouraging messages was:</p> <pre><code>Exceptions.DontSwallowErrorsCatchingNonspecificExceptionsRule : 2106 defects </c...
<p>While there are some reasonable reasons for ignoring exceptions; however, generally it is only specific exceptions that you are able to safely ignore. As noted by <a href="https://stackoverflow.com/questions/204814/is-there-any-valid-reason-to-ever-ignore-a-caught-exception#204827">Konrad Rudolph</a>, you might have...
<p>I think the best rule of thumb is only ignore an exception if you're completely aware of what the exception means and the possible ramifications of it. In the case of some isolated module that doesn't affect the rest of your system I think it would be okay to just catch the generic Exception as long as you know not...
25,084
<p>For testing purposes I have to generate a file of a certain size (to test an upload limit). </p> <p>What is a command to create a file of a certain size on Linux?</p>
<p>For small files:</p> <pre><code>dd if=/dev/zero of=upload_test bs=file_size count=1 </code></pre> <p>Where <code>file_size</code> is the size of your test file in bytes.</p> <p>For big files:</p> <pre><code>dd if=/dev/zero of=upload_test bs=1M count=size_in_megabytes </code></pre>
<p>Kindly run below command for quickly creating larger file with certain size in linux</p> <pre><code>for i in {1..10};do fallocate -l 2G filename$i;done </code></pre> <p>explanation:-Above command will create 10 files with 10GB size in just few seconds.</p>
16,852
<p>I'm using <code>FontMetrics.getHeight()</code> to get the height of the string, but it gives me a wrong value, cutting off the descenders of string characters. Is there a better function I can use?</p>
<p>The <code>getStringBounds()</code> method below is based on the <code>GlyphVector</code> for the current <code>Graphics2D</code> font, which works very well for one line string of text:</p> <pre><code>public class StringBoundsPanel extends JPanel { public StringBoundsPanel() { setBackground(Color.wh...
<p><code>getHeight()</code> can't cut off the descenders of a string, only drawing the string can do that. You are using the height returned from <code>getHeight</code> to draw the string somehow, and likely you are misusing the height. For example, if you position the start point of the string at the bottom of a box...
48,080
<p>I'm working on a Spring MVC project, and I have unit tests for all of the various components in the source tree.</p> <p>For example, if I have a controller <code>HomeController</code>, which needs to have a <code>LoginService</code> injected into it, then in my unit test <code>HomeControllerTest</code> I simply ins...
<p>I can't speak to being a best practice, but here's what I've done in the past.</p> <p><strong>Unit tests:</strong></p> <ul> <li>Create unit tests for non-trivial beans (ie, most of your Spring related beans) </li> <li>Use Mocks for injected services where practical (ie, most if not all the time).</li> <li>Use a st...
<p>When I've created integration tests for web applications, I've put them in a separate directory. They are built using jUnit or TestNG and interact with the system under test using something like <a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a> that hits the web pages as if they were users...
35,662
<p>I develop a variety of applications and have 3-4 miscellaneous libraries that I reuse across these apps (one for math, one for database functions etc.).</p> <p>Currently I have one master source directory with each project as a top level directory (including my helper projects). And each project that needs a helper...
<p>Please see my answers at <a href="https://stackoverflow.com/questions/296643/projects-folder-structure-recommendation#296793">Projects folder structure recommendation</a> and <a href="https://stackoverflow.com/questions/222827/how-do-you-organize-your-version-control-repository#304036">How do you organize your versi...
<p>I've never used subversion but I can provide some info outside of the repository question. My answer is it really depends on the scenairo and the company. For one of the largest projects I was involved we used the following structure. This project consisted of roughly 20 core assemblies which would be shared amongst...
42,727
<p>On Windows I can do:</p> <pre><code>HANDLE hCurrentProcess = GetCurrentProcess(); SetPriorityClass(hCurrentProcess, ABOVE_NORMAL_PRIORITY_CLASS); </code></pre> <p>How can I do the same thing on *nix?</p>
<p>Try:</p> <pre><code>#include &lt;sys/time.h&gt; #include &lt;sys/resource.h&gt; int main(){ setpriority(PRIO_PROCESS, 0, -20); } </code></pre> <p>Note that you must be running as superuser for this to work.</p> <p>(for more info, type 'man setpriority' at a prompt.)</p>
<p>@ allain <blockquote>Can you lower your own process' priority without being superuser?</blockquote></p> <p>Sure. Be aware, however, that this is a one way street. You can't even get back to where you started. And even fairly small reductions in priority can have startlingly large effects on running time when there ...
4,926
<p>In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year?</p> <p>Let's say that I have a date of <strong>2008-09-17 12:56:53.430</strong>, then the output of flooring should be:</p> <ul> <li>Year: 2008-01-01 00:00:00.000</li> <li>Month: 2008-09-01 00:00:00.000</li> <li>Day: 2008-09-17 00:00:0...
<p>The key is to use <a href="http://msdn.microsoft.com/en-us/library/ms186819.aspx" rel="noreferrer">DATEADD</a> and <a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx" rel="noreferrer">DATEDIFF</a> along with the appropriate SQL timespan enumeration.</p> <pre><code>declare @datetime datetime; set @dateti...
<p>Since PostgreSQL is also a "SQL Server", I'll mention </p> <pre><code>date_trunc() </code></pre> <p>Which does exactly what you're asking gracefully.</p> <p>For example:</p> <pre> select date_trunc('hour',current_timestamp); date_trunc ------------------------ 2009-02-18 07:00:00-08 (1 row) </pre>
11,091
<p>How can I change the <strong>background color</strong> of a <strong>Tab Control</strong>. I changed the forms color, but the tabs stay the same.</p> <p>Thanks.</p>
<p>Check the Back Style of the Tab Control. If it's Normal. you'll get a gray background (with normal Windows settings). If it's Transparent then it will inherit the background colour of the form.</p> <p>If you want it to be an entirely different colour, you might have to add a rectangle to the form (make the backgrou...
<p>Extending Duane Rochelle's helpful answer for Access 2010: </p> <p>The problem seems to be that the names that Microsoft has given the properties that control the tab colours are contra-intuitive.</p> <p>Basically, the color of the tabs can be controlled using the <em>Pressed Color</em> property. Look for it in th...
32,403
<p>I'm looking for a wrapper that distills zlib to:</p> <ol> <li>OpenZipFile()</li> <li>GetItemInfo(n)</li> <li>UnzipItem(n) // Bonus points for unzipping recursively if item n is a directory.</li> </ol> <p>I see a lot of wrappers around the zlib library on, say, codeproject.com but they are all platform-specific in...
<p>In boost::iostreams there is the possibility to use zlib, gzip and bzip2 formats.</p> <p>You find it from <a href="http://www.boost.org/" rel="noreferrer">http://www.boost.org/</a></p>
<p>You can check also this C++ Zlib wrapper with auto-detection of input format: <a href="https://github.com/mateidavid/zstr" rel="nofollow noreferrer">https://github.com/mateidavid/zstr</a></p>
33,546
<p>I'm getting some strange, intermittent, data aborts (&lt; 5% of the time) in some of my code, when calling <code>memset()</code>. The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act.</p> <p>I'm using the following code:</p> <pre><code>cha...
<p><code>malloc</code> can return <code>NULL</code> if no memory is available. You're not checking for that.</p>
<p>Have you tried using Valgrind? That is usually the fastest and easiest way to debug these sorts of errors. If you are reading or writing outside the bounds of allocated memory, it will flag it for you.</p>
4,247
<p>How to convert Unicode string into a utf-8 or utf-16 string? My VS2005 project is using Unicode char set, while sqlite in cpp provide </p> <pre><code>int sqlite3_open( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); int sqlite3_open16( const void ...
<p>Short answer: </p> <p>No conversion required if you use Unicode strings such as CString or wstring. Use sqlite3_open16(). You will have to make sure you pass a WCHAR pointer (casted to <code>void *</code>. Seems lame! Even if this lib is cross platform, I guess they could have defined a wide char type that depends ...
<p>utf-8 and utf-16 are both "unicode" character encodings. What you probably talk about is utf-32 which is a fixed-size character encoding. Maybe searching for </p> <p><code>"Convert utf-32 into utf-8 or utf-16"</code></p> <p>provides you some results or other papers on this.</p>
35,447
<p>What is the Python equivalent of the following code in Ruby?</p> <pre><code>def loop cont=nil for i in 1..4 puts i callcc {|continuation| cont=continuation} if i==2 end return cont end &gt; c=loop 1 2 3 4 &gt; c.call 3 4 </code></pre> <p>Reference: <a href="http://www-128.ibm.com/developerworks/ja...
<p>The article you quoted contains a link to <a href="http://www.ps.uni-sb.de/~duchier/python/continuations.html" rel="noreferrer">Continuations Made Simple And Illustrated</a> in the Resources section, which talks about continuations in the Python language.</p>
<pre><code>def loop(): def f(i, cont=[None]): for i in range(i, 5): print i if i == 2: cont[0] = lambda i=i+1: f(i) return cont[0] return f(1) if __name__ == '__main__': c = loop() c() </code></pre>
40,315
<p>I've been following <a href="http://msdn.microsoft.com/en-us/library/aa337460(SQL.90).aspx" rel="nofollow noreferrer">this tutorial</a> (lesson 6) in order to build and deploy a sample report with an embedded subreport which reads its parameters' values from the parent report. This subreport is embedded in one of th...
<p>I'm beginning to think this could be an issue with the browser. I'm currently using Internet Explorer 8 Beta and I'm also experiencing weird behavior from the Report Manager. I've tried with Google Chrome and Firefox 3 and, although the navigation is not as smooth as I like, the problem seems fixed.</p>
<p>This may or may not be related, but I had a similar problem some time ago (except that in my case the reports were accessed through a custom web page) and it turned out we had an older version of the report viewer control (the version that came with Sql 2005 RTM). After upgrading to the latest version the issue went...
19,135
<p>I have parsed XML using both of the following two methods...</p> <ul> <li>Parsing the XmlDocument using the object model and XPath queries.</li> <li>XSL/T</li> </ul> <p>But I have never used...</p> <ul> <li>The Linq Xml object model that was new to .Net 3.5</li> </ul> <p>Can anyone tell me the comparative effici...
<p>The absolute fastest way to query an XML document is the hardest: write a method that uses an XmlReader to process the input stream, and have it process nodes as it reads them. This is the way to combine parsing and querying into a single operation. (Simply using XPath doesn't do this; both XmlDocument and XPathD...
<p>I haven't actually tested it, but Linq is primarily a compiler code-gen type feature, and so it should be comparable to using an XmlDocument and XPath queries.</p> <p>The primary value of Linq is that it provides compile-time verification of your query statements, which neither XPath nor XSLT can provide.</p> <p>I...
22,108
<p>Starting with a already existing installscript 11.5 installer, we created a update installer (differential installer).</p> <p>Given:</p> <ul> <li>V1 (first version of the software)</li> <li>V2 (second version of the software)</li> <li>V2P (differential installer between V1 and V2</li> </ul> <p>If I install V1 and...
<p>Have you tried running PendMoves from Sysinternals/Microsoft? According to the documentation, it should list the particular file(s) being moved or deleted. I'm assuming this will work for file renames as well</p> <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx" rel="nofollow noreferrer">...
<p>Have you created a log file when uninstalling to see what file rename operation is being performed? I would strongly suggest using verbose logging for this problem.</p>
49,046
<p>I am trying to create a test suite of some of the existing pages I have developed using fitnesse. Does the tool support to change or refactor the pages to sub-wikis to make a part of newly created test suite?</p>
<p>Not sure if I understand your question exactly.</p> <p>You can refactor a test suite to be "reparented" to another wiki. Just go to the page and select the "refactor" button. In the text box, select the new parent page path in the form of "MyWiki.MySubPage.EtcEtc".</p>
<p>You can use symbolic links for that.</p> <p>Click Properties on the sidebar, then at the bottom you can symlink your pages from other suites into the suite.</p> <p>This feature can be used also to run tests with different setup/teardown variations.</p>
44,484
<p>I'm doing some research on what types of LCD displays can be used to filter and pass UV light for resin curing - specifically in the context of building a DIY 3D SLA printer.</p> <p>The community commonly uses the Sharp LS055R1SX03 module. Looking through the datasheet, there doesn't seem to be any information pert...
<p>Hmm I seen videos off people pealing filters off of lcd screens to let uv pass through.</p> <p>I believe the sharp unit maybe popular because not all lcds have square pixels and have poor pixel alignment towards the edges, (the focus of the eye can only take in so much information why waste materials producing inpe...
<p>I am not an expert by any stretch but I hope this helps, but these are regular old TFT LCD screens. You can even get 4K ones and use them for the same process. You can for example pick up 4K displays such as the H546UAN01.0 and do the same with them. </p>
1,432
<p>Hopefully, I can get answers for each database server.</p> <p>For an outline of how indexing works check out: <a href="https://stackoverflow.com/questions/1108/how-does-database-indexing-work">How does database indexing work?</a></p>
<p>The following is SQL92 standard so should be supported by the majority of RDMBS that use SQL:</p> <pre><code>CREATE INDEX [index name] ON [table name] ( [column name] ) </code></pre>
<p>Since most of the answers are given for SQL databases, I am writing this for NOSQL databases, specifically for MongoDB.</p> <p>Below is the syntax to create an index in the MongoDB using mongo shell.</p> <pre><code>db.collection.createIndex( &lt;key and index type specification&gt;, &lt;options&gt; ) </code></pre>...
2,357
<p>I'd like to create a text field with a dropdown list that lets the user choose some predefined values. The user should also be able to type a new value or select a predefined one from a dropdown list. I know that I can use two widgets for that but in my app it would be more ergonomnic if it was unified in a one widg...
<p>You can accomplish this by using the <code>&lt;datalist&gt;</code> tag in HTML5.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" name="product" l...
<p>Simple HTML + Javascript approach without CSS <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function editDropBox() { var cSelect = document.getElementById('changingList');...
33,154
<p>I'm working on a control to tie together the view from one ListView to another so that when the master ListView is scrolled, the child ListView view is updated to match. </p> <p>So far I've been able to get the child ListViews to update their view when the master scrollbar buttons are clicked. The problem is that...
<p>I wanted to do the same thing, and after searching around I found your code here, which helped, but of course didn't solve the problem. But after playing around with it, I have found a solution.</p> <p>The key came when I realized that since the scroll buttons work, that you can use that to make the slider work. In...
<p>A naive solution to your problem can be handling the paint message in the parent list view and checking if the linked list views are displaying the correct data. If they don't, then update them to display the correct data by calling the EnsureVisible method.</p>
19,333
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
<p>I ended up finding java code from IBM that solved it: <a href="http://www.ibm.com/developerworks/java/library/j-coordconvert/index.html" rel="noreferrer">http://www.ibm.com/developerworks/java/library/j-coordconvert/index.html</a></p> <p>Just for reference, here is my python implementation of the method I needed:</...
<p>There is a perl module via CPAN called Geography::NationalGrid which can convert easting/northing to lat/longs. That may help.</p> <p>Alternatively there are lots of scripts on the <a href="http://www.movable-type.co.uk/scripts/latlong-gridref.html" rel="nofollow noreferrer">movable-type site</a> that let you conve...
44,720
<p>I am interested if there is a port for the server implementation.</p>
<p>Windows Server ports:</p> <ul> <li><a href="http://www.splinedancer.com/memcached-win32/" rel="noreferrer">memcached for Win32</a> </li> <li><a href="http://code.jellycan.com/memcached/" rel="noreferrer">Jellycan Code - memcached</a></li> </ul> <p>Memcached .NET Client ports:</p> <ul> <li><a href="http://sourc...
<p>And you might want to check our <a href="http://blogs.msdn.com/velocity/" rel="nofollow noreferrer">Velocity</a> - Microsoft's distributed cache.</p>
34,933
<p>I am synchronizing tables using a stored PL/SQL procedure as part of a web application - when they hit a button it does the sync. The PL/SQL is executing as user A, but needs to disable indexes and sync a couple of tables in schema B. I can't get user A to 'alter index B.indexName unusable' despite granting it 'al...
<p>Are you granting the ALTER ANY INDEX privilege via a role? Or is the privilege being granted directly to user A?</p> <p>Privileges granted through a role (such as DBA) are not available to definer's rights stored procedures (the default). Only privileges that are granted directly to the user are available in a de...
<p>Does the index exist? More than once, I've lost time by not taking an error message at face value.</p>
31,268
<p>I'm just a one-man software shop, and I currently have an MSDN subscription. It is coming up for renewal soon, and it looks like it's going to cost a small fortune. I see that TechNet subscriptions cost significantly less money, and seem to include all of the same software. Am I missing something here? What is the d...
<p>If memory serves the TECHNET subscription is licenses for EVALUATION purposes, while the MSDN subscription is licenses for use as a Developer.</p>
<p>Evaluation purposes? Are they going to show up at your door to check to make sure you're using the software they gave you full license keys the way they want you to?</p> <p>When you say evaluation people might infer that you are saying that the software expires or something. Sort of like the term. "Evaluation Perio...
31,271
<p>I'm wondering what is the best way to handle error messages in my application. </p> <p>Currently I'm working on a web application and all error messages are stored in the database and we get them by ID, negative is an error , and positive are success messages.</p> <p>the problem is that is hard to maintain and kee...
<p>Generally speaking, I keep the text of the error messages in resource files. If you're using .NET 2.0 or higher (Visual Studio 2005 or higher), resource files are automatically compiled into strongly-typed classes, making the code which accesses said messages much more clear and readable. </p> <p>(EDIT: Having seen...
<p>Generally speaking, I keep the text of the error messages in resource files. If you're using .NET 2.0 or higher (Visual Studio 2005 or higher), resource files are automatically compiled into strongly-typed classes, making the code which accesses said messages much more clear and readable. </p> <p>(EDIT: Having seen...
14,196
<p>I have a ASP.NET project and when building the project it is showing build suceessfull. But when I am building the deployment project, it is showing build failed with an error message </p> <pre><code>Error 5 "aspnet_compiler.exe" exited with code 1 </code></pre> <p>I rechecked my project and found that when ...
<p>You can't mix ASP.NET and ASP in the same page. The ASP.NET compiler is returning an error because it doesn't understand the ASP code.</p> <p>As for why the project builds okay, that's because include-directives are a function of the webserver, not Visual Studio or even ASP.NET. When you build in Visual Studio, the...
<p>Does it work successfully on other pages? Also is the Topstyle.asp page a ASP.NET page? If not it will not work as you can't mix the two technologies like that.</p> <p>In ASP.NET the include syntax is discouraged. Try using a user control instead, or the &lt;%= Globals.MyConstantThatContainsTheStyles %>.</p> <p>If...
37,475
<p>What options do you have to communicate between the WARs in an EAR? We have several WARs providing different webservices deployed within one EAR. For their tasks they need to communicate with the other WARs. Of course they could communicate using webservices. What other, perhaps more efficient, options are there?</...
<p>First, you should be clear about what is that you are sharing. You should differentiate between the service and a library. Library lets you share the common functionality, this is what you achieve when you use log4j library for example. In that case, you setup log4j in each project that is using it. On the other ha...
<p>Two things come to mind</p> <ol> <li>There's JMS for sending signals. </li> <li>EJB could record shared information.</li> <li>A lib jar in the EAR's lib directory.</li> </ol> <p>If you just need shared methods, 3 is what you want. But your edit points tells me you've got shared functionality that operates on share...
46,902
<p>I have a 3018 Pro CNC and being trying cutting a contour of a simple circular part:</p> <p><a href="https://i.stack.imgur.com/w3mDe.png" rel="nofollow noreferrer" title="Screenshot of Fusion 360 model and route"><img src="https://i.stack.imgur.com/w3mDe.png" alt="Screenshot of Fusion 360 model and route" title="Scre...
<p>I've ran the code on my own CNC machine. I slightly adapted the code as my machine doesn't understand the movement without the instruction code:</p> <pre><code>Z1 F10.0 Z-2.9 X10.792 Z-2.938 F10.0 X10.771 Z-2.971 X10.738 Z-2.992 X10.7 Z-3 X10.6 X10.562 Y0.092 X10.529 Y0.071 X10.508 Y0.038 X10.5 Y0 </code></pre> <p>i...
<p>Parts of the circle are at different heights. When I rendered your 30 or so actual G1 and G2 lines, here's what I got. It looks like a circle from above, but form the sde you can see depth changes. What are those coordinate lines with no G0 ot G1 or G2 or G3 command for?</p> <p><a href="https://i.stack.imgur.com/fbV...
2,081
<p>I have a bunch of tables in a sql server database (all with a certain prefix, e.g. ABC_table1), and I want to move ALL tables with this prefix to another database.</p> <p>Is there a way in which this can be done?</p> <p>I am using SQL Server 2k5.</p> <p>Thanks</p>
<p>Figure out the uid of the ABC schema:</p> <pre><code>SELECT * from sys.schemas </code></pre> <p>Then substitute the schema_id for the 5 (uid) in the script below and run it:</p> <pre><code>SELECT 'SELECT * INTO OtherDB.ABC.' + name + ' FROM ABC.' + name FROM sysobjects WHERE xtype = 'U' A...
<p>Not sure how much the terminology has changed in 2k5, but here's the instructions in 2k terminology. Just create your new database and perform an export from your old database to the new one. In the export wizard, you want to transfer objects and data. When selecting your "objects" select all tables that begin wi...
46,720
<p>I have subclassed the UITableView control, and the style is grouped, but I do not need the cell separators. I tried setting my table view's separatorStyle to none, but it doesn't work. Can any one help me out?</p>
<p>In a grouped table view, setting <code>separatorStyle</code> doesn't do anything. If you want to hide it, just do the following:</p> <pre><code>tableView.separatorColor = [UIColor clearColor]; </code></pre>
<p>How about setSeparatorColor to your cell's background color?</p>
36,386
<p>Does Google Reader have an API and if so, how can I get the count of the number of unread posts for a specific user knowing their username and password?</p>
<p>This URL will give you a count of unread posts per feed. You can then iterate over the feeds and sum up the counts.</p> <p><a href="http://www.google.com/reader/api/0/unread-count?all=true" rel="nofollow noreferrer">http://www.google.com/reader/api/0/unread-count?all=true</a></p> <p>Here is a minimalist example i...
<p>In the API posted in [1], the "token" field should be "T"</p> <p>[1] <a href="http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI" rel="nofollow noreferrer">http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI</a></p>
7,622
<p>The "Application Icon" of my application is wrong.</p> <p>My application shows in taskbar a different icon than the classic Delphi icon. Instead is shows the icon of one of my VCL's. That specific VCL from which the icon was "stolen" is not used in my application but other VCL's in the same package are used.</p> <...
<p>From <strong>Delphi</strong>'s Menu Bar select <strong>Project->Options</strong></p> <p>In the Project Options select <strong>Application</strong></p> <p>There you will see the Icon selected for your app. </p> <p>You can change it there.</p>
<p>Check the language id of your application and default language of OS. If these don't match then you can have a troubles with icons.</p>
45,755
<p>In an Access (2002 / 2003) data-bound form, a turn of the mousewheel moves to the next/previous record, even if the cursor is inside a multiline text field or a listbox. This is a major annoyance to users and cannot be turned off easily.</p> <p>I recently discovered a DLL called MouseHook (<a href="http://www.leban...
<p>If you really have to alter the UI and change how the user expects the mouse wheel to work, I would actually recommend just disabling it rather than altering how it scrolls. While it's scrolling may seem odd to you, it is how the program works. What would you do if you had to read PDF's all day, and then one day one...
<p>Not a direct answer to your question, but the way we deal with the mouse wheel movement is to prevent accidental changes of records after the user has started editing. When the user opens the form, the wheel moves the records willy-nilly as normal. As soon the user edits something on the field, and then moves the ...
36,091
<p>I am just beginning to write an application. Part of what it needs to do is to run queries on a database of nutritional information. What I have is the USDA's <a href="http://www.ars.usda.gov/Services/docs.htm?docid=17478" rel="nofollow noreferrer">SR21 Datasets</a> in the form of flat delimited ASCII files.</p> <p...
<p>It looks pretty small, so I'd work out an appropriate object model, load the whole lot into memory, and then use LINQ to Objects.</p> <p>I'm not quite sure what you're asking about in terms of "persistent storage" - aren't you just reading the data? Don't you already have that in the text files? I'm not sure why yo...
<p>I would import the flat files into SQL Server and access via standard ADO.NET functionality. Not only is DB access always better (more robust and powerful) than file I/O as far as data querying and manipulation goes, but you can also take advantage of SQL Server's caching capabilities, especially since this nutriti...
33,826
<p>I have a custom sharepoint web part that is throwing the following exception:</p> <pre><code>System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' f...
<p>There are several options you have. The first is to install your assembly into the GAC. It will then get full trust, but you have to install it in the GAC, strong name it, etc. The second option is to go into the web.config and add it to the trusted list. <a href="http://msdn.microsoft.com/en-us/library/ms916855.asp...
<p>It is crazy. I can't execute the following line in a web part:</p> <pre><code>using (SPSite site = new SPSite(parentWebUrl)) </code></pre> <p>However i can execute it not using web parts.</p> <p>It throws me a similar exception althought the DLL is in the GAC plus are added to safecontrols.</p> <pre><code>Except...
49,142
<p>I have a Windows executable (whoami) which is crashing every so often. It's called from another process to get details about the current user and domain. I'd like to know what parameters are passed when it fails.</p> <p>Does anyone know of an appropriate way to wrap the process and write it's command line argumen...
<p>From a batch file:</p> <pre><code>echo Parameters: %* &gt;&gt; logfile.txt whoami.exe %* </code></pre> <p>With the caveat that you can have problems if the parameters contain spaces (and you passed the in escaping with "), because the command-line parser basically de-escapes them and they should be re-escaped befo...
<p>Look for whoami.exe, BACK IT UP, replace it with your own executable and see do whatever you like with it's parameters (maybe save them in a text file).</p>
13,936
<p>We have an installation of MOSS 2007 that is using MS SQL 2000 as the backend database. The web front end for MOSS is on one server and the database on a separate server. We would like to move the database to a MS SQL 2005 server. Is there a recommended approach for doing this? Does anyone know of any resources ...
<ul> <li>Shutdown SharePoint services</li> <li>Backup SQL 2000 databases (config, content)</li> <li>Retore backups to SQL 2005 </li> <li>Run "stsadm -o setconfigdb -databaseserver " </li> <li>Remove content database connections in "Central Admin > Application > Content database" </li> <li>Add new connection to conte...
<p>I suppose since you're just migrating the database(s), staying with the same version of Sharepoint, general recommendations for migrating a database from SQL Server 2000 to 2005 should apply. </p>
31,753
<p>Is it possible to access an element on a Master page from the page loaded within the <code>ContentPlaceHolder</code> for the master?</p> <p>I have a ListView that lists people's names in a navigation area on the Master page. I would like to update the ListView after a person has been added to the table that the Lis...
<p>I believe you <em>could</em> do this by using this.Master.FindControl or something similar, but you probably shouldn't - it requires the content page to know too much about the structure of the master page.</p> <p>I would suggest another method, such as firing an event in the content area that the master could list...
<p>Assuming your master page was named MyMaster:</p> <pre><code>(Master as MyMaster).PeopleListView.DataBind(); </code></pre> <p><strong>Edit:</strong> since PeopleListView will be declared protected by default, you will either need to change this to public, or create a public property wrapper so that you can access ...
2,815
<p>I'm trying to match elements with a name that is <code>'container1$container2$chkChecked'</code>, using a regex of <code>'.+\$chkChecked'</code>, but I'm not getting the matches I expect when the element name is as described. What am I doing wrong?</p>
<p>my guess, by your use of quotes, is you did something like</p> <pre><code>re = new RegExp('.+\$chkChecked'); </code></pre> <p>which won't work because js takes advantage of the \ in its string interpretation as an escape so it never makes it into the regex interpreter</p> <p>instead you want</p> <pre><code>re = ...
<p>It looks like it should work.</p> <p>There's a good <a href="http://www.regular-expressions.info/javascriptexample.html" rel="nofollow noreferrer">Javascript Regex Tester</a> that also says it matches.</p>
11,704
<p>I am attempting to return a collection of departments from a .NET assembly to be consumed by ASP via COM Interop. Using .NET I would just return a generic collection, e.g. <code>List&lt;Department&gt;</code>, but it seems that generics don't work well with COM Interop. So, what are my options?</p> <p>I would like t...
<p>After some more research and trial-and-error, I think I found a solution by using <code>System.Collections.ArrayList</code>. However, this does not work with getting a value by index. To do so, I created a new class <code>ComArrayList</code> that inherits from <code>ArrayList</code> and adds new methods <code>GetByI...
<p>In your ASP code, could you not do this?</p> <pre><code>&lt;h1&gt;The third department&lt;/h1&gt; &lt;%= departments.Item(2).Name %&gt; </code></pre> <p>I know that in VB .NET, C# indexers are supported via the "Item" property, so the same idea may work in ASP.</p>
33,866
<p>I want to index this view but because it has subquery i cant index. Can anyone suggest how to change this view so that i can index it.</p> <pre><code>ALTER VIEW [dbo].[Recon2] WITH SCHEMABINDING AS SELECT dbo.Transactions.CustomerCode, dbo.Customer_Master.CustomerName, dbo.Transactions.TransDate, dbo.Transa...
<p>I can't run it (obviously) but what about this?: </p> <pre><code>SELECT dbo.Transactions.CustomerCode, dbo.Customer_Master.CustomerName, dbo.Transactions.TransDate, dbo.Transactions.PubCode, dbo.Transactions.TransType, dbo.Transactions.Copies, '0' AS ReceiptNo, '2008-01-01' AS PaymentDate, 0 AS Amount, dbo...
<p>At least in Oracle, you can change from VIEW to MATERIALIZED VIEW. There will be a few other issues like table space and methods of synchronization to consider but it might be worth exploring.</p> <p>Depending on your application, another option would be to create a normal table based on the select of this view and...
15,809
<p>I have two UIActionSheets and I am thinking that I will control them with one delegate (the UIViewController that instantiates them). The delegate will capture an actionSheet call and try to figure out which of the two threw the event.</p> <p>I tried to get the modalView's title to differentiate, but it seems to b...
<p>I think you need the <em>tag</em> property of the <em>UIActionSheet</em>.</p> <p>Something like:</p> <pre><code>UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle ... ]; actionSheet.tag = 10; [actionSheet showInView:self.view]; </code></pre> <p>Then in your delegate:</p> <pre><code>- (void)actionS...
<p>Delegate methods in Cocoa include the sending object for this purpose. Keep a reference to each of your action sheets as an instance variable in your controller class, and you can compare this to the actionSheet parameter in your delegate methods to decide what actions you need to perform.</p> <p>Using the view's t...
40,436
<p>Say you have a standard template with included (parsed) header, body, footer templates.</p> <p>In the body template a variable like $subject is defined and you want that also displayed in the header template.</p> <p>In some other template languages like HTML::Mason(perl based) you would evaluate the body template ...
<p>Either of the two solutions above would work. The VelocityLayoutServlet solution requires an extra package (also from Velocity) called Velocity Tools. I'm partial to this approach (and variants) myself.</p> <p>A third method is simply to put the #parse within quotes:</p> <pre><code>set ($body="#parse('body.vm')"...
<p>If I understand you correctly, you want to have a Velocity variable named <code>$subject</code> interpolated into the <code>header.vm</code> and the <code>body.vm</code> templates. Right now, the variable is defined in the <code>body.vm</code> template, so you cannot refer to it in the earlier template <code>header....
26,321
<p>Is there an open source alternative to SharePoint?</p> <p>I'd like something that gives the same hierarchical structure and portlet-based design of SharePoint, but is open in source. Web based administration and customization is also a plus.</p>
<p>I depends on what you need.<br> Is it used as content managment system ? There is plenty open source CMS, as stated before.</p> <p>Is it used as collaboration tool ? Then one of the follwing things may do the trick:</p> <ul> <li><a href="http://www.egroupware.org/" rel="nofollow noreferrer">eGroupWare</a>: Already...
<p>Is it a CMS you want, or something just to collaborate. You may want to look at some sort of wiki solution.</p>
30,808
<p>I'm in a Microsoft IE environment, but I want to use cygwin for a number of quick scripting tasks.</p> <p>How would I configure it to use my windows proxy information? Ruby gems, ping, etc are all trying to make direct connections. How can I get them to respect the proxy information that IE and firefox use?</p>
<p>Just for the records if you need to authenticate to the Proxy use:</p> <pre><code>export http_proxy=http://username:password@host:port/ </code></pre> <p>Taken from: <a href="http://samueldotj.blogspot.com/2008/06/configuring-cygwin-to-use-proxy-server.html">http://samueldotj.blogspot.com/2008/06/configuring-cygwin...
<p>I doubt that your corporate firewall allows PING, but the others all appear to be one form of http or another. On a Linux system, you can set your HTTP proxy as an environment variable, so in bash, type:</p> <pre><code>export http_proxy=http://www.myproxy.com:3128 </code></pre> <p>There is a similar environment v...
24,091
<p>My webpage is suffering from two IE6 rendering bugs. Each of them have workarounds, but unfortunately said workarounds are incompatible with each other.</p> <p><a href="http://www.control-v.net/stackoverflow/318715.html" rel="nofollow noreferrer">Here's a minimized test case</a>. The behavior in Firefox/Safari is t...
<p>There are a myriad of implementation as to how to avoid the massive issues with ie6 (and below) conformity. The only one that has actually worked for me (to a great extent even) is Dean Edward's solution. </p> <p>Try to insert the following line in your main header:</p> <pre><code>&lt;!--[if lt IE 8]&gt;&lt;script...
<p>While it may be the wrong solution, and probably way overkill, jQuery can do modal popups similar to this and works on IE6. I'll probably get downvoted for such a simple answer, but it is still worth considering, or at least looking at, other solutions before reinventing the wheel.</p>
41,198
<p>Is it possible to create a REST web service using ASP.NET 2.0? The articles and blog entries I am finding all seem to indicate that ASP.NET 3.5 with WCF is required to create REST web services with ASP.NET.</p> <p>If it is possible to create REST web services in ASP.NET 2.0 can you provide an example.</p> <p>Than...
<p>I have actually created a REST web service with asp.net 2.0. Its really no different than creating a web page.</p> <p>When I did it, I really didn't have much time to research how to do it with an asmx file so I did it in a standard aspx file. I know thier is extra overhead by doing it this way but as a first revis...
<p>I'm only just beginning to use them, but from what I've seen 2.0 pretty assumes SOAP.</p>
6,193
<p>I know there is a 3d printing technique, where sheet of papers are cut and glued. Like the ones <a href="http://www.gizmag.com/staples-mcor-easy-3d-printing/25284/" rel="nofollow">Staples</a> has in their stores. But this sort of paper isnt recyclable, because of the heavy use of glue.</p> <p>Is anywhere filament a...
<p>Filament made of Polylactic acid (<a href="http://reprap.org/wiki/PLA" rel="nofollow">PLA</a>) is usually made of biological materials (such as corn), and can therefore be considered bio-degradable in most cases.</p> <p>Whether the filament is 100% bio-degradable (and non-toxic for the surroundings) will depend on ...
<p>Check Green-TEC by <a href="http://extrudr.eu/collections/bdp" rel="nofollow">extrudr.eu</a> is made from lignin (wood) or perhaps Algix Dura. They are both bio degradeable. Green-TEC ist my favorite because of less warping and <a href="https://www.youtube.com/watch?v=Oqx170kPmg4" rel="nofollow">fast printing</a>.</...
284
<p>For this dropdownlist in HTML:</p> <pre><code>&lt;select id="countries"&gt; &lt;option value="1"&gt;Country&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?</p>
<p>I was trying to find the same thing and got disappointed. I ended up changing the attribute size for the select box so it appears to open</p> <pre><code>$('#countries').attr('size',6); </code></pre> <p>and then when you're finished</p> <pre><code>$('#countries').attr('size',1); </code></pre>
<p>Maybe late, but this is how i solved it: <a href="http://jsfiddle.net/KqsK2/18/" rel="nofollow">http://jsfiddle.net/KqsK2/18/</a></p> <pre><code>$(document).ready(function() { fixSelect(document.getElementsByTagName("select")); }); function fixSelect(selectList) ...
47,041
<p>I have a console application project in C# 2.0 that needs to write something to the screen in a while loop. I do not want the screen to scroll because using Console.Write or Console.Writeline method will keep displaying text on console screen incremently and thus it starts scrolling.</p> <p>I want to have the strin...
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.console.setcursorposition.aspx" rel="noreferrer">Console.SetCursorPosition</a> to set the position. If you need to determine it first, use the <a href="http://msdn.microsoft.com/en-us/library/system.console.cursorleft.aspx" rel="noreferrer">Console.CursorLe...
<p>Function to write the progress of a loop. Your loop counter can be used as the x position parameter. This prints on line 1, modify for your needs.</p> <pre><code> /// &lt;summary&gt; /// Writes a string at the x position, y position = 1; /// Tries to catch all exceptions, will not throw any exceptions. ...
35,972
<p>In my website, users have the possibility to store links.</p> <p>During typing the internet address into the designated field I would like to display a suggest/autocomplete box similar to Google Suggest or the Chrome Omnibar.</p> <p>Example:</p> <p>User is typing as URL:</p> <pre><code>http://www.sta </code></pr...
<p>You could try with <a href="http://google.com/complete/search?output=toolbar&amp;q=keyword" rel="noreferrer">http://google.com/complete/search?output=toolbar&amp;q=keyword</a></p> <p>and then parse the xml result.</p>
<p>If you want the auto-complete to use date from your own database, you'll need to do the search yourself and update the suggestions using AJAX as users type. For the search part, you might want to look at <a href="http://lucene.apache.org/java/docs/" rel="nofollow noreferrer">Lucene</a>.</p>
31,906
<p>I was watching <a href="http://channel9.msdn.com/pdc2008/TL16/" rel="noreferrer">Anders' talk about C# 4.0 and sneak preview of C# 5.0</a>, and it got me thinking about when optional parameters are available in C# what is going to be the recommended way to declare methods that do not need all parameters specified?</...
<p>I'd consider the following:</p> <ul> <li>Do you need your code to be used from languages which don't support optional parameters? If so, consider including the overloads.</li> <li>Do you have any members on your team who violently oppose optional parameters? (Sometimes it's easier to live with a decision you don't ...
<p>Both Optional parameter , Method overload have there own advantage or disadvantage.it depends on your preference to choose between them.</p> <p>Optional Parameter: available only in .Net 4.0. optional parameter reduce your code size. You can't define out and ref parameter </p> <p>overloaded methods: You can Define...
31,381
<p>Is there any documentation about introducing jBoss seam to an old Hibernate/JSF project?</p> <p>Have tried google, and what I found was: Start new seam project, copy&amp;paste existing code into new project. Would be nice to know a little bit more before starting.</p>
<p>The best approach is probably to add the Seam library to your existing project, and then gradually refactor your code to take advantage of Seam's features. To do this, work through the <a href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/" rel="nofollow noreferrer">Seam manual</a> and refactor your code...
<p>This seems to be part of the solution:</p> <p><a href="http://www.mastertheboss.com/en/seam/63-jboss-seam-tutorial-1.html" rel="nofollow noreferrer">http://www.mastertheboss.com/en/seam/63-jboss-seam-tutorial-1.html</a></p>
39,143
<p>With the release of Visual Studio 2008, Microsoft implemented code-completion and IntelliSense support for JavaScript.</p> <p>Unfortunately the support for JavaScript is shady at best--one of the major hassles being that when referencing external JavaScript files, the developer has to open and close JavaScript file...
<p>Yes there is:</p> <blockquote> <p>Menu: "Edit" -> "IntelliSense" -> "Update JScript IntelliSense"</p> </blockquote> <p>And the keyboard shortcut:</p> <blockquote> <p>Ctrl + Shift + J</p> </blockquote> <p><br /> <br /> In case you're wondering; yes, I already the answer to my question (figured it out five min...
<p>Visual Studio 2008 is supposed to detect the reference changes. However the staleness check and update kickoff is done in a periodic maintenance event. It takes a few seconds after the change before the "Updating Intellisense..." message is displayed in the status bar.</p> <p>As roosteronacid says, Ctrl-Shift-J wil...
25,832
<p>I want to use the built-in preference system for my xulrunner (Firefox) application. But I can't figure out how to easily drive the user interface based on preferences.</p> <p>The user can specify a list of home pages, and each home page will show up in a different tab. Because the tabs are in the presentation la...
<p>No, templating in XUL is not powerful enough, so you're stuck with writing JavaScript code that reads the preferences and opens the needed tabs.</p>
<pre><code> XML.prototype.function::domNode = function domNode() { function addPrefix(prefix, name) { if (typeof(prefix) == "undefined" || prefix == null || prefix == "") { return name; } else { return prefix + ":" + name; } } function recurse(xml) { ...
45,048
<p>What's the simplest, most standard, and/or most efficient way to split a List into two sub-Lists in Java? It's OK to mutate the original List, so no copying should be necessary. The method signature could be</p> <pre><code>/** Split a list into two sublists. The original list will be modified to * have size i and ...
<p>Quick semi-pseudo code:</p> <pre><code>List sub=one.subList(...); List two=new XxxList(sub); sub.clear(); // since sub is backed by one, this removes all sub-list items from one </code></pre> <p>That uses standard List implementation methods and avoids all the running around in loops. The clear() method is also g...
<p>Likewise cribbing off of Marc's list, we'll use List.removeAll() to remove the duplicate entries from the second list. Note that, strictly speaking, this only follows the specs if the original list contained no duplicate items: otherwise, the original list may be missing items.</p> <pre><code>&lt;T&gt; List&lt;T&g...
49,726
<p>What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table?</p> <p>For example: I have a <code>JOBS</code> table with the column <code>JOB_NUMBER</code>. How can I find out if I have any duplicate <code>JOB_NUMBER</code>...
<p>Aggregate the column by COUNT, then use a HAVING clause to find values that appear greater than one time.</p> <pre><code>SELECT column_name, COUNT(column_name) FROM table_name GROUP BY column_name HAVING COUNT(column_name) &gt; 1; </code></pre>
<p>Also u can try something like this to list all duplicate values in a table say reqitem</p> <pre><code>SELECT count(poid) FROM poitem WHERE poid = 50 AND rownum &lt; any (SELECT count(*) FROM poitem WHERE poid = 50) GROUP BY poid MINUS SELECT count(poid) FROM poitem WHERE poid in (50) GROUP BY poid HAVING ...
8,379
<p>Converting a couple stored procedures from MySQL to Microsoft SQL server. Everything is going well, except one procedure used the MySQL <code>SHA1()</code> function. I cannot seem to find an equivalent to this in MS-SQL.</p> <p>Does anyone know a valid equivalent for <code>SHA1()</code> on MS-SQL?</p>
<p>SQL Server 2005 and later has the <a href="http://msdn.microsoft.com/en-us/library/ms174415.aspx" rel="noreferrer">HashBytes()</a> function.</p>
<p>I don't believe there's native support, but you may want to check this out...</p> <p><a href="http://blogs.msdn.com/sqlcat/archive/2005/09/16/469257.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/sqlcat/archive/2005/09/16/469257.aspx</a></p>
22,302
<p>The concept of a <a href="http://en.wikipedia.org/wiki/Coroutine" rel="noreferrer">coroutine</a> sounds very interesting, but I don't know, if it makes sense in a real productive environment? What are use cases for coroutines, where the coroutine implementation is more elegant, simpler or more efficient than other m...
<p>One use case is a web server that has multiple simultaneous connections, with a requirement to schedule reading and writing in parallel with all of them.</p> <p>This can be implemented using coroutines. Each connection is a coroutine that reads/writes some amount of data, then yields control to the scheduler. The s...
<p><strong>One use case: In-Memory DataBase Systems.</strong></p> <p>Coroutines can be used for reducing CPU stalls due to cache misses caused by lookups in such database systems, like hash probes or B+-tree traversals.</p> <p>Database systems use many pointer-based data structures, including hash tables and B+-trees, ...
39,026
<pre><code>SaveFileDialog savefileDialog1 = new SaveFileDialog(); DialogResult result = savefileDialog1.ShowDialog(); switch(result == DialogResult.OK) case true: //do something case false: MessageBox.Show("are you sure?","",MessageBoxButtons.YesNo,MessageBoxIcon.Question); </code></pre> <p>Ho...
<p>If the reason for needing the message box on Cancel of the File Save dialogue is because you're shutting things down with unsaved changes, then I suggest putting the call to the File Save dialogue in a loop that keeps going until a flag is set to stop the loop and call the message box if you don't get OK as the resu...
<p>It's generally not a good idea to make a program whose user interface for interoperating with the file system doesn't work the same way most other Windows programs do. Which is why there's no easy way of doing this.</p>
48,344
<p>I'm running tomcat and have some jsp pages that display a subset of a table. I show 20 rows at a time on a single page. When the table has large amounts of data, the jsp page doesn't render. I'm guessing that the ResultSet is using a client side cursor. I've worked with ASP in the past, and we always used server...
<p>The oracle driver implements server-side cursors via the FetchSize property.</p> <p>Unfortunately, JDBC doesn't explicitly allow for setting client vs server-side cursors, so different drivers implement it in different ways. Here are the other links that helped:</p> <p><a href="http://blog.lishman.com/2008/03/jdb...
<p>Not quite answering the question, but have you considered explicitly adding paging to your SELECT query using ROWNUM or ROWNUMBER in your WHERE clause?</p> <p>eg: for the second page of data, 20 element page size:</p> <pre><code>SELECT * FROM MyDataObjects WHERE rownum &gt; 20 AND rownum &lt; 41 </code></pre>...
43,748
<p>When editing PHP code (I'm not sure if it's specific to that language) and I create a new line in the middle of comma-separated lists that span multiple lines, the indent rules always unindent the line I'm leaving. <a href="http://toogeneric.com/files/indent2.mov" rel="noreferrer">Here's a video of it.</a> This happ...
<p>Try <code>:set indentexpr=""</code> and see if that helps. See <code>:help filetype-indent-off</code> for the section that deals with filetype plugins (which is probably where this indentexpr is coming from).</p>
<p>Using "o" in normal mode seems to avoid the issue. Hitting <code>&lt;esc&gt;o</code> from insert mode isn't optimal but it's better than the hard way (as described above).</p>
40,396
<p>Is there anything special for printing TPU material e.g extruder or temperature?</p> <p>It's my first time printing TPU material, so if you have any photos, it would be great if you can share them.</p>
<p>Elastomers do much better on direct-drive heads (pulled to the head by the motor) than on Bowden designs (where the material is pushed to the head by a motor). This is because the flexible TPU or TPE can bend in the guide tube, causing lag during advance/retract changes, and sometimes even bind up during delivery.</...
<p>Flexible materials cause lot of issues if there is any space between extruder gear and PTFE tube. Since it is flexible it refuses to follow the path and starts bending around the opening. There are parts in Thingiverse that you can print to remove that distance. Additionally make sure that your extruder fan is worki...
691
<p>When I am using a form containing <code>&lt;input id="myFile" type="file" runat="server" /&gt;</code> to upload a file, my server-side code only sees the filename without the full path when using Firefox, while it works just fine in IE.</p> <p>Is it possible to retrieve the full file path server-side in this case?<...
<p>You cannot. Actually, only IE gives this information which isn't important for the server in most cases. Neither FF nor Opera, at least, provide this info.<br> [UPDATE] Also tried with Safari, still no path... Somebody reported that Chrome might provide the info, although being a beta, that might change...</p> <p>P...
<p>You can never be sure of getting a full filepath or even a reliable filename or content-type submitted in a file upload file. Even if you get a full filepath you don't know what the path separator character is on the client's operating system, or whether a file extension (if present) denotes anything at all.</p> <p...
33,753
<p>I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriate downloadable files (including installers, documentation, etc...
<p>At my work we use CCNET, but with builds on check-in more than nightly - although it's easily configured for either or both.</p> <p>You can very easily set up unit testing to run on every checkin as well, FXCop testing, and a slew of other products.</p> <p>I would also advise checking out <a href="http://www.jetbr...
<p><a href="http://www.conifersystems.com/cascade/" rel="nofollow noreferrer">Cascade</a> supports doing a build on every single change committed to the repository.</p> <p>I would not recommend doing only nightly builds -- that's a pretty long window where a build break can slip in before it's reported.</p>
5,846
<p>I want to perform some transformations on C source code. <strong>I need a tool on linux that generates a complete AST from the source code</strong> so that I can apply my transformations on this AST and then convert it back to the C source code. I tried <a href="http://www.cs.berkeley.edu/~smcpeak/elkhound/sources/e...
<p>I would recommend <a href="http://clang.llvm.org" rel="noreferrer">clang</a>. It has a fairly complete C implementation with most gcc extensions, and the code is very understandable. Their C++ implementation is incomplete, but if you only care about generating ASTs from C code that should be fine. Depending on what ...
<p>How about taking gcc and writing a custom backend for it? I've never done it nor even worked on gcc source code, so I don't know how hard it would be.</p>
29,667
<p>The only <em>nice</em> way I've found is:</p> <pre><code>import sys import os try: os.kill(int(sys.argv[1]), 0) print "Running" except: print "Not running" </code></pre> <p>(<a href="http://www.unix.com/unix-advanced-expert-users/79267-trick-bash-scripters-check-if-process-running.html" re...
<p>Mark's answer is the way to go, after all, that's why the /proc file system is there. For something a little more copy/pasteable:</p> <pre><code> &gt;&gt;&gt; import os.path &gt;&gt;&gt; os.path.exists("/proc/0") False &gt;&gt;&gt; os.path.exists("/proc/12") True </code></pre>
<p>Sligtly modified version of ShaChris23 script. Checks if proc_name value is found within process args string (for example Python script executed with python ):</p> <pre><code>def process_exists(proc_name): ps = subprocess.Popen("ps ax -o pid= -o args= ", shell=True, stdout=subprocess.PIPE) ps_pid = ps.pid ...
5,898
<p>I'm working on an existing report and I would like to test it with the database. The problem is that the catalog set during the initial report creation no longer exists. I just need to change the catalog parameter to a new database. The report is using a stored proc for its data. It looks like if try and remove ...
<p>If you just need to do it in the designer then right click in some whitespace and click on Database->set datasource location. From there you can use a current connection or add a new connection. Set a new connection using the new catalog. Then click on your current connection in the top section and click update. You...
<p>EDIT: Saw your edit, so i'll keep my original post but have to say.. I've never had a crystal report in design mode in VS so I can't be of much help there sorry.</p> <pre><code>report.SetDatabaseLogon(UserID, Password, ServerName, DatabaseName); </code></pre> <p>After that you have to roll through all referenced t...
15,535
<p>I have seen people say that it is bad form to use catch with no arguments, especially if that catch doesn't do anything:</p> <pre><code>StreamReader reader=new StreamReader("myfile.txt"); try { int i = 5 / 0; } catch // No args, so it will catch any exception {} reader.Close(); </code></pre> <p>However, this ...
<p>The big difference is that <code>try...catch</code> will swallow the exception, hiding the fact that an error occurred. <code>try..finally</code> will run your cleanup code and then the exception will keep going, to be handled by something that knows what to do with it.</p>
<p>Amongst probably many reasons, exceptions are very slow to execute. You can easily cripple your execution times if this happens a lot.</p>
15,667
<p>I am looking into improving the backup process a group of animators use. Currently they back up their work into external hard drives or DVDs manually, taking full copies of everything. The data consists of thousands of high resolution images, project files of various video editing software and sound files. Basically...
<p>If your scope is just "backup" then I'd say stick to backup solutions.</p> <p>But if you are thinking about the whole lifecycle of the animator's work, then the type of use typically falls into the <a href="http://en.wikipedia.org/wiki/Digital_asset_management" rel="nofollow noreferrer">"Digital Asset Management"</...
<p>I think Clearcase would work for you.The reason being everything is VOB(VersionedObject) no matter what it is ! Check once</p>
20,922
<p>I have a simple linux script:</p> <pre><code>#!/bin/sh for i in `ls $1` do echo $i done </code></pre> <p>In my temp folder are 4 file: a.a, a.aa, a.ab and a.ac</p> <p>When i call ./script temp/*.?? i get:</p> <pre><code>temp/a.aa </code></pre> <p>When i call ./script "temp/*.??" i get:</p> <pre><code>te...
<p>In the first case the shell expands <code>temp/*.??</code> to:</p> <pre><code>temp/a.aa temp/a.ab temp/a.ac </code></pre> <p>Since you are only looking at the first parameter in your script only <code>temp/a.aa</code> is passed to ls.</p> <p>In the second case, the shell does not perform any expansion because of ...
<p>Because without the quotes the shell is expanding your call to:</p> <pre><code>./script temp/a.aa temp/a.ab temp/a.ac </code></pre> <p>So <code>$1</code> is <code>temp/a.aa</code> instead of <code>temp/*.??</code>.</p>
32,301
<p>I've noticed that after my Anet A8 completes a print, the right hand Z mount ends up 1-2&nbsp;mm lower than the left, even though I make sure both the left and right hand Z mounts of the X-axis are at the same height before switching on the printer.</p> <p>Does anyone know what the cause of this might be?</p> <p>I...
<p>My guess is your Z guides are not strictly parallel because there's no instruction how to install X guides correctly. When you install X guides, you can easily make horizontal distance between two Z-mounts either too small or too large, which puts extra stress on one of the Z motors. Move your extruder to home posit...
<p>Try winding the Z axis all the up and down a few times using the front panel controls. Does it still go out of alignment? Is it out of alignment at the top? Does it come back into alignment when you wind it back down?</p> <p>The principle is: if you have a dodgy motor drive chip, or a mechanical fault, it will skip...
619
<p>I have the following table</p> <pre> custid ordid qty datesold 1 A2 12 2008-01-05 2 A5 5 2008-01-02 1 A1 5 2008-01-01 2 A7 3 2007-02-05 </pre> <p>What't the best way of getting the previous order for every customer?</p> <p>Th...
<p>If by "previous" you mean "the one before the latest":</p> <pre><code>SELECT TOP 1 ordid FROM orders WHERE custid = @custid and datesold &lt; (SELECT MAX(datesold) FROM orders i where i.custid = orders.custid) ORDER BY datesold DESC </code></pre> <p>Of course <code>datesold</code> has to be a DATETIME wi...
<p>Assumption: Datesold will be in a ascending order (previous order's date will be lesser than current one)</p> <p>Lets say you want to get the Order before A5 for customer 2. Here is how the query can be.</p> <pre> <code> SELECT TOP 1 * FROM Orders WHERE DateSold &lt; (SELECT DateSold FROM Orders WHERE CustId = 2 a...
47,264
<p>How would you define your parser and lexer rules to parse a language that uses indentation for defining scope.</p> <p>I have already googled and found a clever approach for parsing it by generating INDENT and DEDENT tokens in the lexer.</p> <p>I will go deeper on this problem and post an answer if I come to someth...
<p>This is kind of hypothetical, as it would depend on what technology you have for your lexer and parser, but the easiest way would seem to be to have BEGINBLOCK and ENDBLOCK tokens analogous to braces in C. Using the <a href="http://en.wikipedia.org/wiki/Off-side_rule" rel="nofollow noreferrer">"offsides rule"</a> y...
<p>Also you can track somewhere in lexer how many ident items are preceding first line and pass it to parser. Most interesting part would be trying to pass it to parser correctly :) If your parser uses lookahead (here I mean parser may query for variable number of tokens before it really going to match even one) then t...
46,501
<p>Like many, if not all, i too have a favorite programming language that i like to use in projects, read about, advocate about, sleep with etc.. which i'll call lang.y</p> <p>To not to re-invent the wheel, i mostly use others' works in my projects whe(n|re)ever i can. But sometimes, the already made wheels are writte...
<p>As others have said - it depends.</p> <p>If the recoding is non-trivial, then you are faced with a dilemma when the original lang.x library changes -- do you re-port the updated version, and how can you do so?</p> <p>In general, it is better to write a library wrapper in lang.y that calls down to the lang.x librar...
<p>If the library is mature, well-tested and encapsulated, I leave it in the original language. But that is easier when it is in COM or .NET, since there is good interoperability and low overhead.</p> <p>I would port only when there's significant environment change, obsolete language, or the library is going to need ...
37,324
<p>When launching a thread or a process in .NET or Java, is there a way to choose which processor or core it is launched on? How does the shared memory model work in such cases?</p>
<p>If you're using multiple threads, the operating system will automatically take care of using multiple cores.</p>
<p>I have used this in a couple of programs because my core 0 was kind of messed up.</p> <pre><code>// Programmatically set process affinity var process = System.Diagnostics.Process.GetCurrentProcess(); // Set Core 0 process.ProcessorAffinity = new IntPtr(0x0001); </code></pre> <p>or</p> <pre><code>// Set Core 1 pr...
5,777
<p>I have some question:</p> <p>How to make a role based web application? Such as in forum sites, there is many user types, admin, moderator etc... is the roles of these user types stored in database or web.config? And when a user login to our site, how to control this users roles? In short I want to learn about autho...
<p>Check this articles and videos:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx" rel="nofollow noreferrer">Introduction to Membership</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/9ab2fxh0.aspx" rel="nofollow noreferrer">Managing Authorization Using Roles</a></li> <li><a ...
<p>I've found that the built in Authorization schemes work great for simple situations where you only need to basically authenticate who can enter and who can leave, but fall short for custom situations, such as having special administrator accounts etc.</p> <p>In those situations, I've created my own authentication s...
34,575
<p>I have a static library *.lib created using MSVC on windows. The size of library is say 70KB. Then I have an application which links this library. But now the size of the final executable (*.exe) is 29KB, less than the library. What i want to know is :</p> <ol> <li><p>Since the library is statically linked, I was t...
<p>A static library on both Windows and Unix is a collection of .obj/.o files. The linker looks at each of these object files and determines if it is needed for the program to link. If it isn't needed, then the object file won't get included in the final executable. This can lead to executables that are smaller then...
<p><strong>Disclaimer</strong>: It's been a long time since I dealt with static linking, so take my answer with a grain of salt.</p> <p>You wrote: <em>I was thinking it should add directly to the executable size and final exe size should be more than that?</em></p> <p>Naive linkers work exactly this way - back when I...
48,410
<p>Greetings!</p> <p>I'd like to investigate Django but I'm running Windows XP. I've installed XMPP and I currently have Python 2.6 installed (is it true that 2.5 is the only version that will work with XMPP?). What else do I need to get up and running? Any tips, recommended IDEs, etc? </p>
<p>As Sam says, for development, use the dev server. Using a "real" server is actually more of a pain because you have to make sure it reloads your project when you make edits. You can also beat it into hosting all your media while in a development environment, if that's what you need (as most people do).</p> <p>As fa...
<p>If you really need it to work under Apache, try <a href="http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from=olddocs" rel="nofollow noreferrer">this from the Django docs.</a> Otherwise, use the development server. If you want a simple way to get started, try <a href="http://www.instantdjango.com/" ...
47,712
<p>I am trying to develop a way to change a flash file displayed on the screen to another file by clicking a button. I have been able to do this with jpg images, but I can't get it to work with flash files. Can anyone help? I would greatly appreciate it. Below are two html's: the first one changes jpg images and it wor...
<p>I follow a few rules:</p> <ol> <li>Primary keys should be as small as necessary. Prefer a numeric type because numeric types are stored in a much more compact format than character formats. This is because most primary keys will be foreign keys in another table as well as used in multiple indexes. The smaller your k...
<p>We do a lot of joins and composite primary keys have just become a performance hog. A simple int or long takes care of many problems even though you are introducing a second candidate key, but it's a lot easier and more understandable to join on one field versus three.</p>
43,795
<p>Today when I was in computer organization class, teacher talked about something interesting to me. When it comes to talk about Why cache memory works, he said that:</p> <pre><code>for (i=0; i&lt;M; i++) for(j=0; j&lt;N; j++) X[i][j] = X[i][j] + K; //X is double(8 bytes) </code></pre> <p>it is not good to ...
<p>Locality of reference. Because the data is stored by rows, for each row the j columns are in adjacent memory addresses. The OS will typically load an entire page from memory into the cache and adjacent address references will likely refer to that same page. If you increment by the row index in the inner loop it i...
<p>Cache memory is very fast and very expensive memory that sits close to the CPU. Rather than fetch one small piece of data from the RAM each time, the CPU fetches a chunk of data and stores it in the cache. The bet is that if you just read one byte, then the next byte you read is likely to be right after it. If th...
26,831
<p>I'm not sure how else to describe it. There's probably a name for this but I just don't know it. But the bottom few layers came out great, but the rest came out kind of like a triscuit. Below are pics of my print and settings. I am using a delta style printer. Can someone tell me what this issue is called and how to...
<p>The phenomenon you experience is called <strong>under-extrusion</strong>. Under-extrusion is the effect of extruding lesser filament than required for the print. The result of under-extrusion (depending on the amount of under-extrusion) can be described as <a href="/q/8741/">spongy</a> prints, gaps in prints/layers,...
<p>Just to add to the already made answers:</p> <p>Check out <strong>heat-creep!</strong></p> <p>When heat from the hot-end creeps up in the filament, it melts and blocks the extrusion (more or less severely), and under extrusion results.</p> <p>It's basic characteristic is that the print <strong>starts out great</s...
1,297
<p>I'm writing some routes for a REST service. One of my resource's URI looks like this</p> <p>resources/user/:id</p> <p>I also want to give access to individual attributes of a user, which would look like this</p> <p>resources/user/:id/:attribute</p> <p>But when I try to define that latter route, it doesn't work....
<p>Finally got this to work correctly and return all recurrent events on a SharePoint Calendar. Here is the XML for the Web Service Query:</p> <pre><code>&lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt; &lt;listName&gt;{your GUID goes here}&lt;/listName&gt; &lt;query&gt; &lt;Query&gt; &lt...
<p>Nope is not possible. You would need to use the SP Object model via, for example the SPQuery object. But that would mean that you would have to run that code directly on the sharepoint server, instead of calling in from a client.</p> <p>Please see this post of mine; <a href="http://social.msdn.microsoft.com/Forums/...
49,232
<p>I am looking for the best way to test if a website is alive from a C# application.</p> <h3>Background</h3> <p>My application consists of a <em>Winforms UI</em>, a backend <em>WCF service</em> and a <em>website</em> to publish content to the UI and other consumers. To prevent the situation where the UI starts up and ...
<pre><code>HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response == null || response.StatusCode != HttpStatusCode.OK) </code></pre> <p>As @Yanga mentioned, HttpClient is probably the more common way to do this now.</p> <pre><code>HttpClient client = new HttpClient(); var checkingResponse = a...
<p>You'll want to check the status code for OK (status 200).</p>
22,623
<p>I am using the code snippet below, however it's not working quite as I understand it should. </p> <pre><code>public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; try { line = br.readLine(); while(line != null)...
<blockquote> <p>From my understanding of this, readLine should return null the first time no input is entered other than a line termination, like '\r'.</p> </blockquote> <p>That is not correct. <code>readLine</code> will return <code>null</code> if the end of the stream is reached. That is, for example, if you are r...
<p>There's a nice <a href="http://commons.apache.org/lang/" rel="nofollow noreferrer">apache commons lang</a> library which has a good api for common :) actions. You could use statically import StringUtils and use its method isNotEmpty(String ) to get:</p> <pre><code>while(isNotEmpty(line)) { System.out.println(li...
4,467
<p>I spent several hours yesterday trying to digitally sign a short file using an X509 certificate (one of the "freemail" certificates from thawte). I finally got openssl to sign it as an SMIME message, but I can't successfully verify it, AND it's in the SMIME format -- I don't have access to a "sendmail" program which...
<blockquote> <p>So I can export that as a PKCS12 file but am not exactly sure how to use that.</p> </blockquote> <p>If you use the openssl tool, you can use the command</p> <pre><code>openssl pkcs12 -in file.p12 -out file.pem </code></pre> <p>to convert it to pem-format.</p> <p><strong>EDIT</strong>:</p> <blockq...
<p>First you probably need to read up on the difference between a private key, a public key and a certificate. A certificate is a signature with a CAs private key on the statement "The public key XX belongs to the person YY". If you sign something with your private key, the signature can be validated with your public k...
47,374
<p>Drop-down lists, menus and combo boxes are all very common user interface elements. Users are accustomed to seeing these elements in native applications and sometimes web apps, but there are a few problems with them. </p> <ol> <li><p>You have to aim the mouse. Some menus collapse when you mouse out, and some have s...
<p>You could try something like Mac OS/X has for its taskbar, similar to the selection bar in YouTube. I think the common term is a bubble bar where small images animate larger as the mouse rolls over them, but shrink back down to such a size that all items are visible when the mouse is not over the control.</p>
<p>@Nrj width='20px' will keep the collapsed drop down at a width of 20px. Problem is, Inernet Explorer shows the expanded item with this width also, while all other browsers i met so far will show you the full menu.</p>
28,274
<p>I'm considering removing the driver motor from the extruder assembly, and placing it on a stationary mount point instead, and then using a flex-shaft type connector from the motor to the extruder assembly to actually drive the extruder. The motivation for this change is to reduce the overall weight of the extruder d...
<p>Very cool idea, </p> <p>One motor would definitely be more than capable of producing the required torques even through a flexshaft connector. For any normal sized 3D-printer the torques required, and the speeds you'll need for rapid response are well within the capabilities of any off-the-shelf stepper motor. </p> ...
<p>If you're talking about a common 3D printer stepper motor and driver, then one driver is perfectly capable of driving the motor both forward and backward.</p> <p><strike>The flex tube setup you describe sounds like a <a href="https://en.wikipedia.org/wiki/Bowden_cable" rel="nofollow noreferrer">Bowden extruder</a><...
563
<p>Does anybody know how to determine the location of a file that's in one of the folders specified by the PATH environmental variable other than doing a dir filename.exe /s from the root folder?</p> <p>I know this is stretching the bounds of a programming question but this is useful for deployment-related issues, als...
<p>You can use the <code>where.exe</code> utility in the <code>C:\Windows\System32</code> directory.</p>
<p>just for kicks, here's a one-liner powershell implementation</p> <pre><code> function PSwhere($file) { $env:Path.Split(";") | ? { test-path $_\$file* } } </code></pre>
23,763
<p>Are XMLSockets available in Flash <strong>Lite</strong>, and if yes in which versions, and are there differences between the regular and the lite objects?</p>
<p>I don't know enough to tell you the exact difference(s) between XML sockets in Flash and Flash Lite, but they are definitely supported in Flash Lite versions 2.1 and later. See the <a href="http://flashmobileblog.com/examples/" rel="nofollow noreferrer">Flash Mobile Blog</a> for an example.</p>
<p>We're using them to send and receive text strings in both Flash 9 (PC) and Flashlite3.1 (ARM) with no code changes. Unless there are differences in the XML parsing, you're probably good to go.</p>
11,647
<p>Can anyone point to any websites or web applications that are using the <a href="http://www.dossier-andreas.net/software_architecture/pac.html" rel="noreferrer">Presentation-Abstraction-Control</a> design pattern rather than MVC? Desktop applications are easy to find like this (e.g.; GIMP) but I'm looking for someth...
<p>There are more sites using PAC than, I think, people realize. For example, <a href="http://drupal.org" rel="noreferrer">drupal</a> uses the PAC pattern and there are a lot of sites (and a lot of big sites) built with drupal. Many people confuse <a href="http://www.dossier-andreas.net/software_architecture/mvc.html" ...
<p>The only example I've seen is in <a href="https://rads.stackoverflow.com/amzn/click/com/0471958697" rel="nofollow noreferrer" rel="nofollow noreferrer">Pattern-Oriented Software Architecture Volume 1: A System Of Patterns</a>.</p>
9,928
<p>I want to get from any Unix-like system (if this is possible) a unique id that will be persistent every time my application runs in the same machine. If it is possible, I want to get the same id from Linux or FreeBSD or Solaris, etc... I don't want to generate a new id for each machine, but get an already existent i...
<p>How about the UUID of the root filesystem? You can get the root filesystem device from <code>/etc/fstab</code>, either by manually parsing the file or by using <code>getfsent (3)</code> or <code>getfsfile (3)</code>. Once you have the device, you can get the UUID by either checking the links in <code>/dev/disk/by-...
<p>Sounds like you are looking for UUID. This is a common universally unique id (really, the same thing as a GUID)</p> <p>There are many C++ implementations of this in diffrent libs, or you could use the uuidgen command and capture the output.</p>
42,618
<p>Given the following simple example:</p> <pre><code> List&lt;string&gt; list = new List&lt;string&gt;() { "One", "Two", "Three", "three", "Four", "Five" }; CaseInsensitiveComparer ignoreCaseComparer = new CaseInsensitiveComparer(); var distinctList = list.Distinct(ignoreCaseComparer as IEqualityComparer...
<p><code>StringComparer</code> does what you need:</p> <pre><code>List&lt;string&gt; list = new List&lt;string&gt;() { "One", "Two", "Three", "three", "Four", "Five" }; var distinctList = list.Distinct( StringComparer.CurrentCultureIgnoreCase).ToList(); </code></pre> <p>(or invariant / ordinal / etc dependin...
<p>Here is a far simpler version.</p> <pre><code>List&lt;string&gt; list = new List&lt;string&gt;() { "One", "Two", "Three", "three", "Four", "Five" }; var z = (from x in list select new { item = x.ToLower()}).Distinct(); z.Dump(); </code></pre>
35,868
<p>Now that <code>shared_ptr</code> is in tr1, what do you think should happen to the use of <code>std::auto_ptr</code>? They both have different use cases, but all use cases of <code>auto_ptr</code> can be solved with <code>shared_ptr</code>, too. Will you abandon <code>auto_ptr</code> or continue to use it in cases w...
<p>auto_ptr is nice in signatures, too. When a function takes an <code>auto_ptr&lt;T&gt;</code> by value, it means it will consume the <code>T</code>. If a function returns an <code>auto_ptr&lt;T&gt;</code>, it's clear that it relinquishes ownership. This can communicate your intents about the lifetime.</p> <p>On the ...
<p>I believe that "wrap all pointers in <code>shared_ptr</code>" should indeed be the default mode, and is suitable advice to give to your junior coders. However, in the special ownership cases that you mentioned, <code>auto_ptr</code> is indeed more appropriate and its use should be encouraged under such circumstances...
23,954
<p>I'm early in development on a web application built in VS2008. I have both a desktop PC (where most of the work gets done) and a laptop (for occasional portability) on which I use AnkhSVN to keep the project code synced. What's the best way to keep my development database (SQL Server Express) synced up as well?</p> ...
<p>There are obviously a number of ways to approach this, so I am going to list a number of links that should provide a better foundation to build on. These are the links that I've referenced in the past when trying to get others on the bandwagon.</p> <ul> <li><a href="https://web.archive.org/web/20210513230815/http:/...
<p>We use a combo of, taking backups from higher environments down.<br> As well as using ApexSql to handle initial setup of schema.<br> Recently been using Subsonic migrations, as a coded, source controlled, run through CI way to get change scripts in, there is also "tarantino" project developed by headspring out of te...
6,222
<p>I am interacting with an Oracle DB using SQL over an ODBC connection. Is there an SQL command I can use to get the MAC address of the server, or something that uniquely identifies the server hardware or software installation. This is so I can be sure (or at least fairly sure) that I'm talking to the same database ...
<p>Check <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28320/dynviews_1086.htm#REFRN30047" rel="nofollow noreferrer">http://download.oracle.com/docs/cd/B28359_01/server.111/b28320/dynviews_1086.htm#REFRN30047</a></p> <p>The v$database performance view has a column dbid. This is a rather unique iden...
<p>I don't know if you could get the mac address at all. But there are several informations which may help you at the v$instance view.</p> <pre><code>SELECT * FROM v$instance; </code></pre>
24,190
<p>For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?</p> <p>Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?</p> <p>and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL?</p>
<p>I can't speak to the MySQL/PostgreSQL question as I have limited experience with Postgres, but my Masters research project was about high-performance websites with CherryPy, and I don't think you'll be disappointed if you use CherryPy for your site. It can easily scale to thousands of simultaneous users on commodit...
<p>Going to need more data. Jeff had a few articles on the same problems and the answer was to wait till you hit a performance issue.</p> <p>to start with - who is hosting and what do they have available ? what's your in house talent skill sets ? Are you going to be hiring an outside firm ? what do they recommend ?...
25,079