instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>F Is there a way to monitor the FTP port so that I can know what commands my FTP application is sending to a FTP server?</p> <p>I am using a closed-source FTP client application, which is not working with a closed-source FTP application server. The client and the server are not communicating well with each other, a...
<p>Sounds like you need a <a href="http://sectools.org/sniffers.html" rel="nofollow noreferrer">packet sniffer</a> - assuming your network admins/company policy allows it...I have used wireshark fairly successfully before.</p> <p>The core FTP commands should be visible in the packets.</p>
<p>On Unix, tcpdump might be your friend. Maybe you should first state which OS you're targeting, though.</p>
45,391
<p>Here is the scenario:</p> <p>I have a winforms application using NHibernate. When launched, I populate a DataGridView with the results of a NHibernate query. This part works fine. If I update a record in that list and flush the session, the update takes in the database. Upon closing the form after the update, I...
<p>After your update, Evict the object from the first level cache.</p> <pre><code>Session.Update(obj); Session.Evict(obj); </code></pre> <p>You may want to commit and/or flush first.</p>
<p>what about refresh? - see <a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/manipulatingdata.html#manipulatingdata-update-lock" rel="nofollow noreferrer">9.2. Loading an object</a> of the docs:</p> <p>"sess.Save(cat); sess.Flush(); //force the SQL INSERT sess.Refresh(cat); //re-read the st...
16,836
<p>When a user comes across your site's 404 File Not Found error page, it is most likely not what they were looking for. Here, you have the opportunity to turn a dead end into a resource that can help your visitor find whatever they were looking for.</p> <p>If you were going to create the perfect 404 File Not Found er...
<ul> <li>Search</li> <li>Suggested pages (search results for the words in the not-found path)</li> <li>Aggregated global resources or maybe a brief sitemap</li> <li>Tags/categories/whatever your navigation shortcut features</li> <li>If the structure is a hierarchy and the not-found path is somewhere below the top level...
<p>If the site has had a recent redesign, and I couldn't prevent the 404 with redirects, I'd probably include a short message about the redesign, and hints for how they might find what they were looking for in the new structure.</p>
26,549
<p>I'd like to do something like this:</p> <pre><code>Dim Foo as String = "a,b,c,d,e" Dim Boo as List(of String) = Foo.Split(","c) </code></pre> <p>Of course <code>Foo.Split</code> returns a one-dimensional array of <code>String</code>, not a generic <code>List</code>. Is there a way to do this without iterating thro...
<p>If you don't want to use LINQ, you can do:</p> <pre><code>Dim foo As String = "a,b,c,d,e" Dim boo As New List(Of String)(foo.Split(","c)) </code></pre>
<p>If you use Linq, you can use the ToList() extension method</p> <pre><code>Dim strings As List&lt;string&gt; = string_variable.Split().ToList&lt;string&gt;(); </code></pre>
24,620
<p>Is there any IDE (like VS) with drag and drop support for building python GUI, connecting to dbs etc? Eventhough I am an emacs guy, I find it much easier to create GUI with VS.</p>
<p>For GUI only, I find VisualWx (<a href="http://visualwx.altervista.org/" rel="nofollow noreferrer">http://visualwx.altervista.org/</a>) to be very good for designing wxPython apps under Windows.</p> <p>For GUI + database, dabo (<a href="http://dabodev.com/" rel="nofollow noreferrer">http://dabodev.com/</a>) is prob...
<p>For <a href="http://wxpython.org/" rel="nofollow noreferrer">wxPython</a> I use <a href="http://xrced.sourceforge.net/" rel="nofollow noreferrer">xrced</a> to make GUI definitions contained in xml files, I find this way to be elegant and scalable.</p> <p><a href="http://wxformbuilder.org/" rel="nofollow noreferrer"...
36,190
<p>Which one you choose?</p> <ul> <li>Use the Deploy feature in VS</li> <li>Build a rss script and execute it through rs.exe</li> <li>Build a deployment package</li> <li>Another option</li> </ul> <p>Keep in mind that in many of your environments the report developers/designers don't have publish role in Reporting Ser...
<p>In Dev, we use the deploy feature in VS. In Prod, our Prod support team will either upload them manually from the ReportServer website (if it's just one or two reports) or use a simple report upload utility that we wrote. The utility uses the SSRS web service.</p>
<p>For the developers we have a custom built ReportDeployer where we choose what environment to deploy to (development, test, production) and branch to deploy from (also development, test, production). There is a config file with all the reports available for deployment along with their directory structure.<br><br> For...
46,835
<p>I need a smart way to get the data types out of INFORMATION_SCHEMA.COLUMNS in a way that could be used in a CREATE TABLE statement. The problem is the 'extra' fields that need to be understood, such as NUMERIC<code>_</code>PRECISION and NUMERIC<code>_</code>SCALE.</p> <p>Obviously, I can ignore the columns for INT...
<p>Here is an update (ripoff!) of <a href="https://stackoverflow.com/a/253374/880904">GalacticCowboy's answer</a> to fix some issues and update for all (I think) SQL Server 2008R2 datatypes:</p> <pre><code>select data_type + case when data_type like '%text' or data_type in ('image', 'sql_variant' ,'xml') ...
<p>SMO Scripting should take care of the script generations. I believe that this is what MS uses in SQL Management Studio for script generations. </p> <p><a href="http://msdn.microsoft.com/en-us/library/ms162153.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms162153.aspx</a></p> <p>@YourComm...
31,576
<p>Is there a command in classic ASP I can use to tell the browser not to pull the page from it's cache, or, to not cache, or clear the cache of my page?</p>
<p>You can use HTML meta tags:</p> <pre><code>&lt;meta http-equiv="Pragma" content="no-cache" /&gt; &lt;meta http-equiv="Expires" content="Fri, 01 Jan 1999 1:00:00 GMT" /&gt; &lt;meta http-equiv="Last-Modified" content="0" /&gt; &lt;meta http-equiv="Cache-Control" content="no-cache, must-revalidate" /&gt; </code></pre...
<p>Because of the way that different browsers handle caching both the Expires and the no-cache commands need to be used. Here is an <a href="http://aspalliance.com/articleViewer.aspx?aId=694&amp;pId=-1" rel="nofollow noreferrer">article</a> showing the correct way to do this.</p>
14,108
<p>I've got a PHP-based site where we allow users to upload a comma-separated text file of data to be imported by some server side scripts. However, sometimes we need to adjust the column order of the data that is uploaded, and it would be immensely helpful if we could identify the columns in the CSV file <em>before</e...
<p>Flash movies don't have access to the local file system, except to do a file upload to the server.</p> <p>I think your options are:</p> <ol> <li>Process the class on the client side with Java (trivial), using an applet. However, as you rightly assert the user would need to grant permissions to the applet.</li> <li...
<p>The current version of the Flash player is only able to select a file for upload to a server, requiring all processing to be server-side. The next version of the player however, <a href="http://labs.adobe.com/technologies/flashplayer10/" rel="nofollow noreferrer">Flash 10</a> can read local files without making the ...
24,819
<p>I've tried to write a string replace function in C, which works on a <code>char *</code>, which has been allocated using <code>malloc()</code>. It's a little different in that it will find and replace strings, rather than characters in the starting string.</p> <p>It's trivial to do if the search and replace string...
<p>As a general rule, you should <strong>never</strong> do a free or realloc on a user provided buffer. You don't know where the user allocated the space (in your module, in another DLL) so you cannot use any of the allocation functions on a user buffer.</p> <p>Provided that you now cannot do any reallocation within y...
<p>My quick hints.</p> <p>Instead of:<br> <code>void strrep(char *input, char *search, char *replace)</code><br> try:<br> <code>void strrep(char *&amp;input, char *search, char *replace)</code></p> <p>and than in the body:<br> <code>input = realloc(input, strlen(input) + delta);</code></p> <p>Generally read about pa...
2,356
<p>I would like to program Java servlets using Eclipse and I plan on deploying them using Tomcat. I think I can build the projects using Ant which is bundled with Eclipse. I have the standard Eclipse IDE. What options do I have for doing Servlet development in Eclipse? What changes do I need to make to Eclipse? Do I ne...
<p>You need to install a plugin, There is a free one from the eclipse foundation called the <a href="http://www.eclipse.org/webtools/" rel="noreferrer">Web Tools Platform</a>. It has all the development functionality that you'll need.</p> <p>You can get the <a href="http://www.eclipse.org/downloads/" rel="noreferrer">...
<p>Alternatively you can use Jetty which is (now) part of the Eclipe Platform (the Help system is running Jetty). Besides Jetty is used by Android, Windows Mobile..</p> <p>To get started check the <a href="http://wiki.eclipse.org/Jetty/Starting/Quick_Start_Guide" rel="nofollow noreferrer">Eclipse Wiki</a> or if you pr...
25,357
<p>I read a list of SIDs from the registry, <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</code>.</p> <p>How would one resolve the display username (e.g. <code>DOMAIN\user</code>, <code>BUILT-IN\user</code>) given the SID string in C#?</p>
<p>The Win32 API function <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa379166%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>LookupAccountSid()</code></a> is used to find the name that corresponds to a SID.</p> <p><code>LookupAccountSid()</code> has the following signature:</p> <pre><code>BO...
<p>The Win32 API function <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa379166%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>LookupAccountSid()</code></a> is used to find the name that corresponds to a SID.</p> <p><code>LookupAccountSid()</code> has the following signature:</p> <pre><code>BO...
49,798
<p>I need to convert a (possibly) null terminated array of ascii bytes to a string in C# and the fastest way I've found to do it is by using my UnsafeAsciiBytesToString method shown below. This method uses the String.String(sbyte*) constructor which contains a warning in it's remarks:</p> <p>"The value parameter is as...
<p>Any reason not to use the <code>String(sbyte*, int, int)</code> constructor? If you've worked out which portion of the buffer you need, the rest should be simple:</p> <pre><code>public static string UnsafeAsciiBytesToString(byte[] buffer, int offset, int length) { unsafe { fixed (byte* pAscii = buffe...
<p>This is a bit ugly but you don't have to use unsafe code:</p> <pre><code>string result = ""; for (int i = 0; i &lt; data.Length &amp;&amp; data[i] != 0; i++) result += (char)data[i]; </code></pre>
17,389
<p>I've got a little c# windows service that periodically pulls xml from a web service and stores the data in a database table.</p> <p>Unfortunately it's failing because the web service has occasional bad data in it - strings instead of decimals. I don't have any control over the web service (unvalidated user input f...
<blockquote> <p>Pre-process the XML provided by the web service before loading into the validating XML reader, removing any bad nodes entirely.</p> </blockquote> <p>This is the option I would choose, it would allow you to grab the bad input before the exception and store it somewhere so it can be looked at lat...
<p>The question for me is: What do you want to do with the erroneus data? Do you want to ignore it, sanitize it (remove the 'A' from 'A40'), or collect it to one day finally show it to the users (speaking of a large mallet;-) ?</p> <p>If you just want to leave out any rows with incorrect data, the strip out the ones w...
31,227
<pre> SELECT `name` , COUNT(*) AS `count` FROM `t1`, `t2` WHERE `t2`.`id` = `t1`.`id` GROUP BY `t2`.`id` </pre> <p>I want to obtain the name from t1 and the number of rows in t2 where the id is the same as on t1.</p> <p>I've got the above so far, however it won't return any data if there are no rows in t2 that match....
<p>This should work for you:</p> <pre><code>SELECT `t1`.`id` , COUNT(`t2`.`id`) AS `count` FROM `t1` LEFT JOIN `t2` ON `t1`.`id` = `t2`.`id` GROUP BY `t1`.`id` </code></pre> <p>Left join ensures you have all rows from t1, and COUNT(<code>t2</code>.<code>id</code>) makes it count only records where t2.id is not null (...
<p>Do a union to get the other set</p> <pre><code>SELECT `name` , COUNT(*) AS `count` FROM `t1`, `t2` WHERE `t2`.`id` = `t1`.`id` GROUP BY `t2`.`id` UNION Select name, 0 as count from t1 where NOT EXISTS (select 1 from t2 where `t2`.`id` = `t1`.`id`) </code></pre>
33,641
<p>Suppose I create a table in Postgresql with a comment on a column:</p> <pre><code>create table t1 ( c1 varchar(10) ); comment on column t1.c1 is 'foo'; </code></pre> <p>Some time later, I decide to add another column:</p> <pre><code>alter table t1 add column c2 varchar(20); </code></pre> <p>I want to look up ...
<p>The next thing to know is how to obtain the table oid. I think that using this as part of comment on will not work, as you suspect.</p> <pre> postgres=# create table comtest1 (id int, val varchar); CREATE TABLE postgres=# insert into comtest1 values (1,'a'); INSERT 0 1 postgres=# select distinct...
<p>You can retrieve comments on columns using the system function col_description(table_oid, column_number). See <a href="http://www.postgresql.org/docs/8.2/static/functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE" rel="nofollow noreferrer">this page</a> for further details.</p>
34,285
<p>Should a method that implements an interface method be annotated with <code>@Override</code>?</p> <p>The <a href="http://java.sun.com/javase/6/docs/api/java/lang/Override.html" rel="noreferrer">javadoc of the <code>Override</code> annotation</a> says: </p> <blockquote> <p>Indicates that a method declaration is i...
<p>You should use @Override whenever possible. It prevents simple mistakes from being made. Example:</p> <pre><code>class C { @Override public boolean equals(SomeClass obj){ // code ... } } </code></pre> <p>This doesn't compile because it doesn't properly override <a href="http://docs.oracle.com...
<p>Eclipse itself will add the <code>@Override</code> annotation when you tell it to "generate unimplemented methods" during creation of a class that implements an interface.</p>
26,131
<p>I do a lot of XSLT programming. I also do Java, PL/SQL, JavaScript, and a few others. I can easily find communities of Java and JavaScript programmers via the web. PL/SQL is a little more difficult, but between <a href="http://www.oracle.com/technology/index.html" rel="nofollow noreferrer">OTN</a> and <a href="ht...
<p>The <a href="http://www.mulberrytech.com/xsl/xsl-list/" rel="nofollow noreferrer">xsl-list</a> is really active, and a lot of the big names in XSLT (such as Michael Kay) participate. </p>
<p>not sure if it is still active, but you might find <a href="http://www.exslt.org/" rel="nofollow noreferrer">http://www.exslt.org/</a> interesting.</p>
39,827
<p>Suppose we have a vector/array in C++ and we wish to count which of these N elements has maximum repetitive occurrences and output the highest count. Which algorithm is best suited for this job.</p> <p>example:</p> <pre><code>int a = { 2, 456, 34, 3456, 2, 435, 2, 456, 2} </code></pre> <p>the output is 4 because ...
<p>Sort the array and then do a quick pass to count each number. The algorithm has O(N*logN) complexity.</p> <p>Alternatively, create a hash table, using the number as the key. Store in the hashtable a counter for each element you've keyed. You'll be able to count all elements in one pass; however, the complexity of t...
<p>If the range of elements is large compared with the number of elements, I would, as others have said, just sort and scan. This is time n*log n and no additional space (maybe log n additional).</p> <p>THe problem with the counting sort is that, if the range of values is large, it can take more time to initialize the...
17,549
<p>If I have an assembly (A) which references another assembly (B). I want to reference A in a project, I add the reference and it copies A into my BIN directory. It does not copy B as well, even though A depends on it, so the code doesn't compile. How can I set things up so that whenever I reference A, both A and B ...
<p>I dont think there is any way around what you ask other than to explicitly add both. I dont think however adding projects for the sake of getting references copied is a viable solution to the issue. Not all projects that a solution depends on should necassarily be added to the solution. This would completely depdend...
<p>Unfortunately you'll have to manually add both. This is what happens to me as well whenever I use pre-3.5 versions of NHibernate: it requires both log4net and Iesi.Collections assemblies. So I have no choice but to manually include a reference to both in all my solutions that implement NHibernate.</p> <p>This is mo...
20,020
<p>I want to use part of the output of a command run from the command line in another xterm, or as part of a different command. For instance: </p> <pre><code>&gt; grep error error.log error: can't find file ~/&lt;some very long path&gt;/thisfile </code></pre> <p>and I want to do this:</p> <pre><code>&gt;ls ~/&lt;s...
<p>You can use GNU screen's copy and paste commands.</p> <p>Quick tutorial:</p> <ol> <li>Open screen: <code>screen</code> (or <code>screen myprog my args here</code>)</li> <li>Run your program, producing output you want copied</li> <li>Enter copy mode: <kbd>Control</kbd>+<kbd>a</kbd>+<kbd>[</kbd></li> <li>Move your c...
<p>You may send output directly to the concerned xterm using xterm device no. Here is the command. </p> <pre><code>xyz$ls /home/ankit/documents/etc/x/y/z &gt; /dev/pts/0 </code></pre> <p>(or watever is the device name, You can get it using command 'w' for opened xterm)</p> <p>Try it &amp; hope this may solve your p...
40,236
<p>Is there a straightforward way to query a web service to see which messages it supports? The C# .NET application I'm working on needs to be able to handle an older version of the web service, which does not implement the message I'm trying to send. The web service does not expose a version number, so Plan B is to se...
<p>Parsing the WSDL is probably the simplest way to do this. Using WCF, it's also possible to download the WSDL at runtime, essentially run svcutil on it through code, and end up with a dynamically generated proxy that you can check the structure of. See <a href="https://learn.microsoft.com/en-us/archive/blogs/vipulmod...
<p>I'm pretty sure WSDL is the way to do this.</p>
11,255
<p>I am developing a C++ class library containing domain model classes, and I would like to add support for instantiating these classes from various persistence mechanisms, i.e. databases and file. The user of the class library should be given an interface(?) against which to program a class that can transfer the data ...
<p>C++ supports multiple inheritance so you can have a generic persistence API and inherit a persistence mechanism. This would still have to use introspection to get out the class metadata, but you would still have this issue with any persistence layer.</p> <p>Alternatively you could do something similar but use the ...
<p>You might like to look at <a href="http://www.boost.org/doc/libs/1_36_0/libs/serialization/doc/index.html" rel="nofollow noreferrer">boost serialization</a>. Not having used it I can't say whether to recommend it or not. Boost libraries are typically high quality.</p>
13,895
<p>I'm about to start (with fellow programmers) a programming &amp; algorithms club in my high school. The language of choice is C++ - sorry about that, I can't change this. We can assume students have little to no experience in the aforementioned topics.</p> <p>What do you think are the most basic concepts I should f...
<p><strong>Make programming fun!</strong></p> <p>Possible things to talk about would be Programming Competitions that either your club could hold itself or it could enter in locally. I compete in programming competitions at the University (ACM) level and I know for a fact that they have them at lower levels as well.<...
<p>Pseudocode should be a very first.</p> <p>Edit: If they are total programming beginners then I would make the first half just about programming. Once you get to a level where talking about algorithms would make sense then pseudocode is really important to get under the nails.</p>
19,829
<p>I've used poderosa(a .NET terminal app) to monitor logs on multiple linux/solaris servers. This application is NOT getting currently maintained and I've had several problems with it.</p> <p>I'm wondering what other users do to simultaneously monitor several logs in real-time(as in tail -f logfile). I would like to b...
<p>You could just ssh to one server, and use <a href="http://www.vanheusden.com/multitail/" rel="noreferrer">mutitail</a> from there to tail the logs on all the other servers.</p>
<p>Two options that pop into my mind first.</p> <p>Choose your favorite SSH app (putty, ssh in cygwin, etc) and log into the machine.<br> 1. SSH for each log (lots of windows open on your machine or tabs depending on your app)<br> 2. SSH once and use <a href="http://aymanh.com/increase-your-linux-unix-productivity-wit...
13,226
<p>The CSS syntax highlighting in vim is not entirely optimal. For example: </p> <pre><code>div.special_class </code></pre> <p>stops the highlighting at the <code>_</code>. </p> <p>Is there an improved highlighter that doesn't bite on an underscore?</p> <p>Update: I'm using VIM - Vi IMproved 7.1 (2007 May 12, compi...
<p>I don't have that problem. This is the header of my syntax file:</p> <pre><code>" Vim syntax file " Language: Cascading Style Sheets " Maintainer: Claudio Fleiner &lt;claudio@fleiner.com&gt; " URL: http://www.fleiner.com/vim/syntax/css.vim " Last Change: 2007 Nov 06 " CSS2 by Nikolai Weibull " Full CSS2, HT...
<p>What version of vim are you using?</p> <p>My css.vim is</p> <pre><code>" Vim syntax file " Language: Cascading Style Sheets " Maintainer: Claudio Fleiner &lt;claudio@fleiner.com&gt; " URL: http://www.fleiner.com/vim/syntax/css.vim " Last Change: 2005 Nov 23 " CSS2 by Nikolai Weibull " Full CSS2, HTML4 supp...
24,439
<p>I'm aiming to create a set of objects, each of which has a unique identifier. If an object already exists with that identifier, I want to use the existing object. Otherwise I want to create a new one. I'm trying not to use the word Singleton, because I know it's a dirty word here...</p> <p>I can use a factory metho...
<p>The static method is defined on the parent class, and it's called statically as well. So, there's no way of knowing in the method that you've called it on the subclass. The java compiler probably even resolves the call statically to a call to the parent class.</p> <p>So you will need to either reimplement the stati...
<p>The pattern appears to be a sort of <a href="http://exciton.cs.rice.edu/javaresources/DesignPatterns/FlyweightPattern.htm" rel="nofollow noreferrer">Flyweight</a> (structurally, if not a perfect match for intent.)</p> <p>The <code>populate</code> method, as described, could be mapped to the <code>Template</code> pa...
41,067
<p>I have a noobish question for any graphics programmer.</p> <p>I am confused how some games (like Crysis) can support both DirectX 9 (in XP) and 10 (in Vista)?</p> <p>What I understand so far is that if you write a DX10 app, then it can only runs in Vista.</p> <p>Maybe they have 2 code bases -- one written in DX9 ...
<p>They have two rendering pipelines, one using DX9 calls and one using DX10 calls. The APIs are not compatible, though a majority of any game engine can be reused for either. If you want some Open Source examples of how different rendering pipelines are done, look at something like Ogre3d, which supports OpenGL, DX9, ...
<p>It is likely that they have an abstraction layer and they develop against that. At run-time they instantiate the DX9 or DX10 wrapping concrete engines.</p> <p>I imagine their abstraction is positioned very close to the DirectX layer and simply provides DX9 with sensible manual implementations of DX10 functions or ...
9,165
<p>I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user class and I would like to pass this to each function but I can't fig...
<p>If your various user classes inherit from a parent user class, then I recommend you use the same inheritance structure for your test case classes.</p> <p>Consider the following sample classes:</p> <pre><code>class User { public function commonFunctionality() { return 'Something'; } public ...
<p>If you're looking to test the actual UI, you could try using something like Selenium (www.openqa.org). It lets you write the code in PHP (which I'm assuming would work with phpUnit) to drive the browser..</p> <p>Another approach would be to have a common method that could be called by each test for your different u...
8,342
<p>I have seen a function whose prototype is:</p> <pre><code>int myfunc(void** ppt) </code></pre> <p>This function is called in a C file as a = myfunc(mystruct **var1);</p> <p>where mystruct is typedef for one of structure we have. </p> <p>This works without any compilation errors in MSVC6.0, But when I compil...
<p>The <a href="http://c-faq.com/" rel="noreferrer">comp.lang.c FAQ</a> addresses this issue in detail in <a href="http://c-faq.com/ptrs/genericpp.html" rel="noreferrer">Question 4.9</a>. In short, they say <strong>it's not strictly portable</strong> to cast an arbitrary pointer-to-pointer to a <code>void **</code>; th...
<p>As dirty as it may look like: sometimes you can't solve a problem without using void **.</p>
30,565
<p>In the filesystem I have</p> <pre> /file.aspx /directory/default.aspx </pre> <p>I want to configure IIS so that it returns the appropriate file (add the aspx extension) or directory (default content page) as follows:</p> <pre> /file -> /file.aspx /directory -> /directory/default.aspx /directo...
<p>I recommend using UrlRewriter:</p> <p><a href="http://urlrewriter.net/" rel="nofollow noreferrer">http://urlrewriter.net/</a></p> <p>This allows you to create all the mappings above that you desire. One thing that you'll have to do (if you're using IIS 6 or earlier) is configure IIS so that all extensions are han...
<p>You'll have to add an ASP.NET global.asax or HttpModule that maps the / request to default.aspx.</p>
29,175
<p>My first attempt to print in ABS has been an unmitigated disaster, and I could do with some advice before I try again.</p> <p>I've been trying to print a <a href="https://www.thingiverse.com/thing:4067324" rel="noreferrer">Bean Hopper Extension for Melitta Barista TS Smart</a> coffee machine, but every time the laye...
<p>First of all, the bed should be at 100-110 °C and fan 0 %.</p> <p>I had <em>incredibly</em> good results by using a (sacrificial) &quot;draft shield&quot; as shown below together with a large brim (10 mm). It creates a warmer micro-climate which keeps the print a bit warmer, with much less warping. My printer bed ba...
<p>You make no mention of a heated enclosure, so I assume you aren't using one. ABS undergoes significant contraction as it cools down. If you're not using an enclosure, the temperature differences between the heated bed, the cool middle of the print, and the heat of the freshly-printed plastic will cause severe warp...
1,964
<p>I have a console application that will be kicked off with a scheduler. If for some reason, part of that file is not able to be built I need a GUI front end so we can run it the next day with specific input.</p> <p>Is there as way pass parameters to the application entry point to start the console application or th...
<p>It sounds like what you want is to either run as a console app or a windows app based on a commandline switch.</p> <p>If you look at the last message in <a href="http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/fd89cf64-eab4-4cc5-8f35-74ec848d8a60" rel="nofollow noreferrer">this thread</a>, Jeffre...
<p>Write the GUI output to a file that the console app checks when loading. This way your console app can do the repair operations and the normal operations in one scheduled operation.</p>
12,097
<p>I was browsing through the questions and noticed this:</p> <pre><code>SELECT prodid, issue FROM Sales WHERE custid = @custid AND datesold = SELECT MAX(datesold) FROM Sales s WHERE s.prodid = Sales.prodid AND s.issue = Sales.issue AND s.custid = @cust...
<p>The @CustID means it's a parameter that you will supply a value for later in your code. This is the best way of protecting against SQL injection. Create your query using parameters, rather than concatenating strings and variables. The database engine puts the parameter value into where the placeholder is, and the...
<pre><code>publish data where stoloc = 'AB143' | [select prtnum where stoloc = @stoloc] </code></pre> <p>This is how the <code>@</code> works. </p>
47,213
<p>Around here we have been working with a bunch of Visual Source Safe repositories for about 10 years or so. </p> <p>Now I want to get rid of sourcesafe and move on to Team Foundation Server.</p> <p>Do you have any tips or tricks for me before I embark on this migration? What are the things I have to be careful abou...
<p>There are a few different ways you can migrate. The tool will pull your history, etc. over, but the more pragmatic and simple way is to lock VSS as a history archive and start fresh:</p> <ol> <li>Have everyone check in all changes into VSS, make sure everything builds, etc.</li> <li>Set all VSS databases to "locke...
<p>Good guidance there from my former colleage Guy Starbuck. Another thing to add with that approach - you may have decided over time that you want to refactor the way your application is organized (folders etc) and this will give you an oppurtunity to do so.</p> <p>I've been in situations where we organized a soluti...
4,964
<p>I'm also interested in other Symbian SDKs that allow to set their emulator's IMEI.</p>
<p>Emulator has hardcoded IMEI of '000000000000000'. Replace what with whatever you want to use and continue running your code.</p> <p>Symbian C++:</p> <pre><code> TPlpVariantMachineId imei; PlpVariant::GetMachineIdL(imei); imei.Copy(_L("123456789012345")); </code></pre> <p>Python for S60 (PyS60):</p> <...
<p>I have never actually tried that but here's my best guess:</p> <p>The emulator doesn't have a proper telephony implementation unless:</p> <ul> <li><p>you link it to an actual phone over infrared/usb/serial. In which case the emulator telephony component will need configuration to use AT commands to pilot the phone...
29,885
<p>I have a user table in my mysql database that has a password column. Currently, I use the MD5 algorithm to hash the users' password for storage in the database. Now I like to think that I am a security conscience person. I noticed while reading the MySQL docs that they don't recommend MD5 or the SHA/SHA1 hashing met...
<p>It's not necessarily that you shouldn't use MD5, as much it's that you shouldn't use <em>just</em> MD5, as this leaves you vulnerable to rainbow-table attacks (a rainbow table is a table of precomputed hash values - if your password is even remotely common or simple, the attacker needs merely to look up the hash and...
<p>I am using a <i>combination</i>. For example <b> SHA1(MD5())</b> is working fine.</p>
43,577
<p>Does anybody know if Microsoft has already decided which <strong>version of the .NET framework will be shipped in Windows 7</strong> next year (2009)? Will it .NET 3.5 (SP 1) or maybe 4.0?</p>
<p>Microsoft has issued a statement that there will be no other WinHEC before the next release of new Windows platform (Internet is abundant with information concerning this, <a href="http://www.istartedsomething.com/20081022/windows-7-targets-october-2009-rtm-retail-soon-after/" rel="nofollow noreferrer">one site</a>)...
<p>In my mind, it depends on the release dates.</p> <p>If Windows 7 is released before .NET 4.0 (which should be released with Visual Studio 2010), then it can not have .NET 4.0. But with .NET 3.5 is sure thing.</p>
34,764
<p>i'm begginner in java, i have textarea and i have set only verticle scrollbar to that textarea.i'm appending data for every 1 minute to textarea,problem is when new data appends to the textarea scrollbar will move up.To see the new data,every time i have to drag the scroll bar, that is not the requirment.i want scro...
<p>It doesn't make sense to allocate all 101 (or however many) buckets upfront, you'd typically allocate them one at a time, when inserting new data into the table.</p> <p>It <em>does</em> make sense to pre-allocate the hash array, which will have a fixed size, but that is an <em>array of bucket pointers</em>, not an ...
<p>The <code>hash_table</code> will always be only <code>sizeof(hash_table)</code> bytes big. The <code>table</code> element is a pointer to an array of poiinters to <code>bucket</code> elements. So you'd need something like this:</p> <pre><code>hash_table* ht = malloc(sizeof(hash_table)); ht-&gt;size = 101; ht-&gt;ta...
48,437
<p>Has anybody tried creating <code>RawSocket</code> in <code>Android</code> and have succeeded ?</p>
<p>So far as I'm aware access to raw sockets is not availables in <strong>any</strong> pure Java library.</p> <p>In part this is because on most O/S access to raw sockets is a privileged operation, only available to processes running as root / administrator.</p> <p>The <code>Socket</code> and <code>DatagramSocket</co...
<p>Raw sockets are not supported in any Java or Android libraries</p> <p>Use 3rd party libraries: <a href="https://www.savarese.org/software/rocksaw/index.html" rel="nofollow">RockSaw</a> <a href="http://jswrench.sourceforge.net/" rel="nofollow">JSocket</a></p>
28,324
<p>i connecting to a access database with php and adodb. Strings with characters like ® are saved in the database as ® . What can i do to store it correctly?</p>
<p>Looks like you're passing in a UTF8 string but you're not storing it as UTF8. Change it one way or the other so they match up (preferably change your database to UTF8).</p>
<p>@RoBOrg: Yes, but i didn't find a way to store it as utf8. The connection string is allready with charset=utf8 "DRIVER=Microsoft Access Driver (*.mdb);DBQ=something.mdb;UID=Administrator;Charset=utf8" and i didn't find any possibility in adodb to change the storing charset for access databases. I'm updating with co...
30,170
<p>I've written a WCF Service hosted by a Windows Service and it needs to listen on a known TCP/IP port. From what range can I safely allocate a port for use within my organization? That port will be embedded in the config files for the service and the clients that are consuming the service.</p>
<p>Ports 0-1023 are the Well Known Ports and are assigned by IANA. These should only be used for the assigned protocols on public networks.</p> <p>Ports 1024-65535 used to be called Registered Port Numbers (see <a href="http://www.rfc-editor.org/info/rfc1700" rel="noreferrer" title="rfc1700">rfc1700</a>) but are now s...
<p>Here is a good <a href="http://www.iss.net/security_center/advice/Exploits/Ports/" rel="nofollow noreferrer">list of common application ports</a>. Make your own choice in an empty slot. Maybe you should also scan your network for any in-house special application.</p> <p>Typically high numbers port are available and...
26,931
<p>I have a query to the effect of</p> <pre><code>SELECT t3.id, a,bunch,of,other,stuff FROM t1, t2, t3 WHERE (associate t1,t2, and t3 with each other) GROUP BY t3.id LIMIT 10,20 </code></pre> <p>I want to know to many total rows this query would return without the LIMIT (so I can show pagination information).</p> ...
<p>There is a nice solution in MySQL. </p> <p>Add the keyword SQL_CALC_FOUND_ROWS right after the keyword SELECT :</p> <pre><code>SELECT SQL_CALC_FOUND_ROWS t3.id, a,bunch,of,other,stuff FROM t1, t2, t3 WHERE (associate t1,t2, and t3 with each other) GROUP BY t3.id LIMIT 10,20 </code></pre> <p>After that, run ano...
<p>All ans given will execute the query and then find the count. Distinct is definitely slower than group by on large dataset.</p> <p>Best way to find the count of group by is below</p> <pre><code>SELECT sum(1) as counttotal FROM ( Your query with group by operator ) as T </code></pre> <p>This will find the...
47,623
<p>What are some ideas (using .NET and SQL 2005) for implementing a service that sends emails? The emails are to be data-driven. The date and time an email is to be sent is a field in a table.</p>
<p>You can use triggers to send emails on UPDATE/DELETE/INSERT. The triggers can be implemented with .Net, just send mails from there using the classes in <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.aspx" rel="nofollow noreferrer">System.Net.Mail</a> namespace.</p> <p>Here is a good <a href="http:...
<p>Usually, I just spin up a process such as <a href="http://caspian.dotconf.net/menu/Software/SendEmail/" rel="nofollow noreferrer">http://caspian.dotconf.net/menu/Software/SendEmail/</a></p>
35,334
<p>I'm using the PHP Eclipse. When a XML file is opened, Eclipse doesn't seem to recognize the xml, meaning that all looks black. When opened the XML file like "open with" and point to eclipse, it works fine.</p> <p>What setting can be set to use that automatically so that eclipse recognizes it all the time?</p> <p>S...
<p>In the eclipse Preferences you can configure which editor opens for a given file type. This setting can be found under Window->Preferences->General->Editors->File Associations.</p>
<p>you have to install a plugin that can parse xml like xmlbuddy, or the eclipse WTP (Web Tools Platform).</p> <p>I recommend Eclipse WTP because it comes standard with Eclipse and integrates nicely into the IDE. It's also trivial to install as you can see in this tutorial video: <a href="http://mirrors.ibiblio.org/pu...
30,523
<p>I want to create a toggle button in html using css. I want it so that when you click on it , it stays pushed in and than when you click it on it again it pops out. </p> <p>If theres no way of doing it just using css. Is there a way to do it using jQuery?</p>
<p>The good semantic way would be to use a checkbox, and then style it in different ways if it is checked or not. But there are no good ways do to it. You have to add extra span, extra div, and, for a really nice look, add some javascript.</p> <p>So the best solution is to use a small jQuery function and two backgroun...
<p>You can use the "active" pseudoclass (it won't work on IE6, though, for elements other than links)</p> <pre><code>a:active { ...desired style here... } </code></pre>
39,823
<p>I'm getting a whole bunch of linker errors in Visual studios for methods I'm not even calling directly. I'm a java developer by day, but I have a project I need to do in C++, intended to run on windows machines. Hence, I'm stuck messing about with Visual Studio.</p> <p>Bascally, I have an os project that I added an...
<p>The library <code>KeyCapture_Config.lib</code> is using MFC GUI classes (<code>CWnd</code>, <code>CWinApp</code>, etc), but the application you're linking it into is a console application (see the <code>/SUBSYSTEM:CONSOLE</code> option in your linker command line). This won't work. You should create a new MFC GUI ap...
<p>It looks like your project is linking with the Debug Multithreaded runtime. Is this your intention? If so there may be inconsistencies with the KeyCapture_Config library that you seem to be using. </p> <p>Is KeyCapture_Config a 3rd party library? If so did you build it from source or was the lib/dll provided for yo...
29,812
<p>For very small teams, or an individual developer, is there a source code control tool which is a web service, or web based application, with no or very little cost?</p> <p>Ideally, it would work with Microsoft development. IDE Integration would be awesome, but a windows application that connects to the web service ...
<p>I really enjoyed the podcast, and found it refreshing to hear someone of Jeff's reputation sharing the same business/cost driven reality that so many of us face. I often find books/podcasts/presentations a little Utopian.</p> <p>Making it work is still the primary goal. Beautiful code, perfect abstraction, NSA le...
<p>Well, it's not as though this site <em>hasn't</em> <a href="http://www.codinghorror.com/blog/archives/001167.html" rel="nofollow noreferrer">been cracked</a>. So yes, it's probably worthwhile to chase better security.</p>
39,617
<p>An application that has been working well for months has stopped picking up the JPA <code>@Entity</code> annotations that have been a part of it for months. As my integration tests run I see dozens of "<code>org.hibernate.MappingException: Unknown entity: com.whatever.OrderSystem</code>" type errors.</p> <p>It isn...
<p>I seem to recall I had a similar issue at one time. </p> <p>Its a long shot, but if you're not already doing this, have you explicitly specified the provider you are using?</p> <pre><code>&lt;persistence ...&gt; &lt;persistence-unit ...&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provid...
<p>Is this happening for one specific class (few classes) or all the entity classes. The persistence.xml file has a list of class and or jar files that need to be scanned for @Entity mappings. If it was working earlier you can do a quick diff with the version of persistence.xml that was working correctly. Another i...
33,940
<p>I'm having trouble with my php code not indenting correctly...</p> <p>I would like my code to look like this</p> <pre><code>if (foo) { print "i am indented"; } </code></pre> <p>but it always looks like this:</p> <pre><code>if (foo) { print "i am not indented correctly"; } </code></pre> <p>I tired go...
<p>Customize c-default-style variable. Add this to your .emacs file:</p> <pre><code>(setq c-default-style "bsd" c-basic-offset 4) </code></pre> <p><a href="http://en.wikipedia.org/wiki/Indent_style#Allman_style" rel="noreferrer">Description of bsd style</a>.</p>
<p>Customize the variable c-default-style. You either want your "Other" mode (or "php" if its available) set to "bsd" or you can set hte style in all modes to bsd.</p> <p>From what I understand, PHP mode is built on top of c mode, so it inherits its customizations.</p>
20,357
<p>I want something that looks like a file handle but is really backed by an in-memory buffer to use for I/O redirects. How can I do this?</p>
<p>I just wrote a library which provides this, called "knob" [<a href="http://hackage.haskell.org/package/knob">hackage</a>]. You can use it to create <code>Handle</code>s which reference/modify a <code>ByteString</code>:</p> <pre><code>import Data.ByteString (pack) import Data.Knob import System.IO main = do kno...
<p>It's not possible without modifying the compiler. This is because Handle is an abstract data type, not a typeclass.</p>
8,547
<p>When structuring a visual studio solution I tend to structure it so that various components are in different project (As I would assume most people do) I tend to have a bunch of User defined exceptions.</p> <p>The Question is should these exceptions be in a separate project to the (for example) Model classes?</p> ...
<p>It depends on how you imagine them being used and how you deploy your application. As a rule of thumb - never create more packages/assemblies than needed.</p> <p>There's one strong case for putting Exceptions and Interface classes in their own assembly and that's when they're supposed to be shared among clients th...
<p>I wouldn't bother as long as the message strings are configurable (properties file/xml). Having a generic top level interface would definitely help though, if the exceptions were to span across projects.</p>
20,944
<p>Does a filament exist that can resist ozone (like certain silicone tubing's can). Most glass bottles come with tin or plastic screw hard tops and I would like to replace the screw caps with something that is more resistant to ozone.</p> <p>The reason for this is I make my own homemade ozonated oil in glass bottles ...
<p>If making your own caps ends up being the best solution, TPU (thermoplastic polyurethane) is probably your best bet. I don't have specific information on printed TPU filament and ozone, but TPU is widely regarded as one of the most chemical-resistant materials you can easily print with, and <a href="https://ozonesol...
<p>According to <a href="https://www.calpaclab.com/polyetherether-ketone-peek-chemical-compatibility-chart/" rel="nofollow noreferrer">https://www.calpaclab.com/polyetherether-ketone-peek-chemical-compatibility-chart/</a> and <a href="https://www.polyfluor.nl/en/chemical-resistance/peek/" rel="nofollow noreferrer">http...
1,638
<p>Here's my new project: an open canvas, right in front of me. In a few days, I will start to code a big web application. It will start small, with few modules, only myself as developer and engineer, but hopefully it will grow and grow.</p> <p>Even though I am an active Java Developer, It's been a while since I last ...
<p>I use Django. The main reason for me is the automatic administration generation. What this means is that I create model objects, and Django tools generate SQL DDL for me -- I apply that to my database and Django has a fully generated Adminstration website for me to perform CRUD operations on that data. It chooses...
<p>For java development, Eclipse or Net beans; For html/css/js netbeans and at times Dreamweaver to check browser support for properties; For xml/xslt/xsi Altova xml spy; For PNG files Adobe fireworks; For all general purpose text editing GVIM. And not to forget 'Firebug' and 'IE developer toolbar'. </p> <p>Why th...
26,314
<p>Something is eluding me ... it seems obvious, but I can't quite figure it out.</p> <p>I want to add/remove a couple of HTML controls to a page (plain old html) when a user changes value of a dropdown list. An example is to add or remove a "number of guests in this room" textbox for each (of a number) of rooms requ...
<p>Using straight DOM and Javascript you would want to modify the InnterHtml property of a DOM object which will contain the text boxes...most likely a div. So it would look something like:</p> <pre><code>var container = document.getElementById("myContainerDiv"); var html; for(var i = 0; i &lt; selectedRooms; i++) { ...
<p>given HTML:</p> <pre><code>&lt;select name="rooms" id="rooms"&gt; &lt;option value="1"&gt;1 room&lt;/option&gt; &lt;option value="2"&gt;2 rooms&lt;/option&gt; &lt;option value="3"&gt;3 rooms&lt;/option&gt; &lt;/select&gt; &lt;div id="boxes"&gt;&lt;/div&gt; </code></pre> <p>javascript:</p> <pre><code>documen...
34,726
<p>I have a gallery I quickly coded up for a small site, and under Firefox 3 and Safari 3 works fine. But when I test on my old best friend IE7, it seems to not fire the imageVar.onload = function() { // code here }.. which I want to use to stop the load effect and load the image. </p> <p>Please bear in mind...</p> ...
<p>For successful use of Image.onload, you must register the event handler method before the src attribute is set.</p> <p><strong>Related Information in this Question:</strong></p> <p><strong><a href="https://stackoverflow.com/questions/280049/javascript-callback-for-knowing-when-an-image-is-loading#280087">Javascrip...
<p>Just to add to the suggestion by Eran to use the jQuery's built in event handlers you can run code when the document is loaded and the DOM is created but before the images are downloaded with:</p> <pre><code>$(document).ready(function(){ //your code }); </code></pre>
39,556
<p>I am considering to adopt <a href="http://opensolaris.org/os/community/zfs/" rel="nofollow noreferrer">ZFS</a> and I would be happy to know your experience in both production and testing environment.</p>
<p>I am not using ZFS in production - had no chance yet. Well, basically we have no need for giant storage currently and also we did not run any 7.0 up until recently.</p> <p>At home I have a FreeBSD system (7.0-ish) which is more bleeding edge. I have been using ZFS for almost eight months now. I currently have a 1.2...
<p>What do you plan to use it for? Most questions about filesystems can only be answered sensibly if there's a good understanding of the application and usage patterns. What works well for a traditional mail spool filesystem will probably not be what you choose for a database store, for example.</p>
21,787
<p>I'm looking for something like <code>alert()</code>, but that doesn't "pause" the script.</p> <p>I want to display an alert and allow the next command, a form <code>submit()</code>, to continue. So the page will be changing after the alert is displayed, but it won't wait till the user has clicked OK.</p> <p>Is the...
<p>You could do the alert in a setTimeout (which a very short timeout) as setTimeout is asynchronous:</p> <pre><code>setTimeout("alert('hello world');", 1); </code></pre> <p>Or to do it properly you really show use a method rather than a string into your setTimeout:</p> <pre><code>setTimeout(function() { alert('hell...
<p>In this case, it would be more appropriate to use DHTML and JavaScript to dynamically display a message, either in a plain HTML element, or something that looks more like a dialog (but isn't). That would give you the control you need. All of the major JavaScript frameworks (YUI, Dojo, and others) would give you th...
39,021
<p>I need to compare build outputs of VS2005 in order to be sure I can reproduce the exact same product.</p> <p>when I do two builds one after the other in release and compare the produced files I get different files, doing text comparison it seems that more than just the datetime is different</p> <p>how can I build ...
<p>Whenever you build, the compiler embeds:</p> <ul> <li>The date and time</li> <li>A GUID (used for debugging etc, I believe)</li> <li>Potentially the assembly version (which may have "1.2.3.*" and populated automatically)</li> <li>Potentially a strong hash</li> </ul> <p>A couple of options:</p> <ul> <li>Find out w...
<p>One question: you did <strong><em>text</em></strong> comparison for binary build outputs? As I know most of compilers never produces binary identical build output for the same project. Compiler encodes into binary time of compilation, special ordinal, etc.</p>
41,362
<p>I have never really found the design view in Visual Studio useful when developing aspx pages, and so I basically never use it.</p> <p>Am I missing something or is it just one of those features that isn't particularly useful? Do you use the design view? If so, how do you find it useful? If not, why not?</p>
<blockquote> <p>Is the design view for aspx pages in Visual Studio useful?</p> </blockquote> <p>It surely is, if you fit one of these profiles</p> <ul> <li>You don't know HTML or CSS</li> <li>You don't care if your HTML is readable or valid</li> <li>You don't care if your site renders properly in anything other tha...
<p>I dont use it to layout controls as it is quite slow but they have improved it in vs2008. I do find it saves a bit of time dragging a user control onto it but would prefer to lay controls out properly as it genrates some dirty html.</p> <p>Saying that we recruited 2 developers recently who insist on using it so eac...
23,815
<p>I have two applications written in Java that communicate with each other using XML messages over the network. I'm using a SAX parser at the receiving end to get the data back out of the messages. One of the requirements is to embed binary data in an XML message, but SAX doesn't like this. Does anyone know how to ...
<p>You could encode the binary data using base64 and put it into a Base64 element; the below article is a pretty good one on the subject.</p> <p><a href="http://www.xml.com/pub/a/98/07/binary/binary.html" rel="noreferrer">Handling Binary Data in XML Documents</a></p>
<p>If you have control over the XML format, you should turn the problem inside out. Rather than attaching the binary XML you should think about how to enclose a document that has multiple parts, one of which contains XML.</p> <p>The traditional solution to this is an archive (e.g. tar). But if you want to keep your enc...
4,026
<p>I found <a href="https://stackoverflow.com/questions/144701/how-do-i-convert-a-net-console-application-to-a-winforms-or-wpf-application">this solution</a> which works, but I find it hard to believe there isn't a one-click solution to this problem. </p> <p>Do you know a better way?</p>
<p>No, there isn't a "better" way. This is really the only way :) (unless you create your own project converter).</p>
<p>This is the only way. You could, I guess, edit the project files by hand to add references, but I would stick with the IDE.</p>
37,322
<p>I have quite a big solution here with a lot of different web applications and sites, around 10-15 of them. </p> <p>When I attach VS2008 to any process (most likely Nunit.exe or something similar) I get one Cassini process per website/application in the solution. Is there a quick way to get rid of this behaviour in ...
<p>I think what you want to do is set the "Always start when debugging" property to "false" for each of your website projects. Just click the project in the solution explorer, hit F4, and it's the first property in the list.</p> <p>This property is annoying because even when you attach a debugger to IIS (i.e. you're ...
<p>From what I know the mini web server that comes with Visual Studio is only capable of hosting one web app at a time. For what you want you really have to go with IIS.</p>
15,465
<p>I'm having an issue with JQuery and Safari (Windows Version). The code works on FF/IE7/Chrome but not Safari.</p> <p>I have a simple <code>&lt;li&gt;</code> that has a <code>&lt;div&gt;</code> embedded in to - clicking the <code>&lt;li&gt;</code> should expose the hidden <code>div</code>, but not in Safari.</p> <...
<p>How accurate is your HTML pasting?</p> <p>You never closed your "moreFacetsLink" anchor tag, which probably makes Safari think that it was implicitly closed, and the "bunch of text" is surrounded by an additional, HREF-less Class-less Unclosed anchor tag... evidenced by the fact that this:</p> <pre><code>$(".moreF...
<p>href="" is reloading your page in safari<br> I would try using css to underline and style it, and drop the empty href.</p>
37,149
<p>When I am single stepping through one thread of a multi threaded program, the debugger gets interrupted with:</p> <pre><code>0x(some hex ref) : tdb_event_death : ret dbx: thread has exited -- next aborted </code></pre> <p>My guess is a thread somewhere in the program I am debugging has stopped, but it's not t...
<p>Without seeing the input, it is hard to tell what the best approach is. You are probably going to need to use the RegExp class to parse out your keys and values. If you can get clean enough paths to the values, you might be able to get away with string.Split() to split the path into arrays of keys and walk the reg...
<p>Thanks for your answer, ive managed to figure it out now. It wasnt the parsing it was importing the data i was having problems with. I created a hive.out file and then imported it in the normal text way.</p>
40,495
<p>What is the best way to convert an int or null to boolean value in an SQL query, such that:</p> <ul> <li>Any non-null value is <strong>TRUE</strong> in the results</li> <li>Any null value is <strong>FALSE</strong> in the results</li> </ul>
<p>To my knowledge (correct me if I'm wrong), there is no concept of literal boolean values in SQL. You can have expressions evaluating to boolean values, but you cannot output them.</p> <p>This said, you can use CASE WHEN to produce a value you can use in a comparison:</p> <pre><code>SELECT CASE WHEN ValueColum...
<p>The syntax works, but I had to figure out how to place it in my query. If OK, I'd like to share an example on how to fit into an extended query: </p> <pre><code>select count(*) as count, inventory, CASE WHEN inventory = 0 THEN 'empty' ELSE 'not empty' END as InventoryStatus from mytable group by count, inventory <...
21,447
<p>I have a Visual Studio 2005 solution that includes a setup project. The setup project specifies "d:\somefolder" as the Application Folder DefaultLocation property. When installing on a machine without any partitions mapped to "d:", the resulting installer craps out with the message </p> <blockquote> <p>"The volu...
<p>the Setup and Deployment projects from VS leave quite a bit to be desired. Every solution I am aware of will take a bit of reading and learning, as the GUI tools that make setup's for you are normally rather limiting in customization outside the realm of changing the actual look of it. I would recommend looking in...
<p>I suppose there should be setups available which let you change the destination.</p> <p>Or you could use orca to add in a dialog box which specifies that. </p> <p>Or you could pass it in as a commandline argument if the user is on a commandline interface.</p>
23,277
<p>I currently use VMware workstation to create separate workspaces for various clients that I do work for. So for a given client I only install software needed for a specific job, and don't have to worry about software A for client #1 mucking up software B for client #2. </p> <p>With an adequate sized hard drive th...
<p>This is really going to depend on what kind of and how many projects and clients you have. Building a new VM for every client doesn't scale well if you have dozens of clients, since you'll have to be keeping them all up to date.</p> <p>I'd be wary of keeping files spread between the host and VMs as you mention tho...
<p>You can have a quick browse at <a href="http://virt-manager.et.redhat.com/faq.html" rel="nofollow noreferrer">virt-manager</a>, just as an aside as to whats also there.. you never know, you might even like it..I think having such a tool can give you a bigger kick in performance and less disk defrag issues.</p> <p>Y...
30,193
<p>I have this code:</p> <pre><code>db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\baywotch.db5" TextExportFile = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\Exp.txt" Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") cn....
<p>I have tried to reproduce this on several databases and machines, I can't get your code to fail.</p> <p>Leaves :</p> <ul> <li>a corrupt database, could you please run repair and try again ?</li> <li>Fields in your database that are throwing of the query, I have tried several possibilities but can't find anythi...
<p>I think there is something wrong with the spaces in your connection string</p> <p>Try this:</p> <pre><code>cn.Provider = "Microsoft.Jet.OLEDB.4.0" cn.ConnectionString = db cn.Open </code></pre> <p>HTH</p> <p>Update: Maybe there is a problem with the access rights to the database? Or the mdb is already opened ex...
40,534
<p>Case in point: </p> <p>I'm a on mac with bash v3.2.17, I'm using git installed via macports with the bash_completion variant.</p> <p>When I type <code>git checkout m&lt;tab&gt;</code>. for example, I get it completed to <code>master</code>.</p> <p>However, I've got an alias to <code>git checkout</code>, <code>gco...
<p>As stated in the comments above,</p> <pre><code>complete -o default -o nospace -F _git_checkout gco </code></pre> <p>will no longer work. However, there's a <code>__git_complete</code> function in git-completion.bash which can be used to set up completion for aliases like so:</p> <pre><code>__git_complete gco _gi...
<p>If you use <code>alias g='git'</code>, i add this line of code in <code>.bash_aliases</code></p> <pre><code>complete -o default -o nospace -F _git g </code></pre>
44,588
<p>I seem to not understand two OOP concepts very well. Could you explain what <strong>abstraction</strong> and <strong>polymorphism</strong> are, preferably with real examples and code?</p> <p>Thank you.</p>
<h2>Abstraction</h2> <p>Imagine a fraction class:</p> <pre><code>class fraction: int denominator int numerator </code></pre> <p>Now two objects of that:</p> <pre><code>fraction(obj1): denominator=-1 numerator=-1 fraction(obj2): denominator=1 numerator=1 </code></pre> <p>Both objects have the value 1: <cod...
<p>very easy.</p> <ol> <li><p>Abstraction is abstraction. Class 'Student' is an abstraction of a real student.</p></li> <li><p>Polymorphism is when one class represents another so that user won't notice. This could happen when classes implement the same interface or one class derives from another. Class 'HighSchoolStu...
47,938
<p>Can PL/SQL procedure in Oracle know it's own name?</p> <p>Let me explain:</p> <pre><code>CREATE OR REPLACE procedure some_procedure is v_procedure_name varchar2(32); begin v_procedure_name := %%something%%; end; </code></pre> <p>After <code>%%something%%</code> executes, variable <code>v_procedure_name</c...
<p>Try:</p> <pre><code>v_procedure_name := $$PLSQL_UNIT; </code></pre> <p>There's also $$PLSQL_LINE if you want to know which line number you are on.</p>
<p>Here's a neat function that takes advantage of REGEXP_SUBSTR. I've tested it in a package (and it even works if another procedure in the package calls it):</p> <pre><code>FUNCTION SET_PROC RETURN VARCHAR2 IS BEGIN RETURN NVL(REGEXP_SUBSTR(DBMS_UTILITY.FORMAT_CALL_STACK, 'procedure.+\.(.+)\s', 1,1,'i...
36,417
<p>I am quite happy to code out tables by hand when making a database but it's not the easiest way to convey information about a database to someone else, especially someone that's not so comfortable coding the tables via a script and would instead use something such at phpMyAdmin.</p> <p>Is there thus a free program ...
<p>Well on the PC you can use <strong>MS Visio</strong> to produce a <strong>DB Entity diagram</strong>.</p> <p>It will even reverse engineer one from an existing Database.</p> <p>A pain to set-up the first time you use it, but quite handy thereafter.</p>
<p>SQLDeveloper from Oracle can work with Oracle and MySQL database.</p> <p><a href="http://www.oracle.com/us/corporate/press/020861" rel="nofollow noreferrer">http://www.oracle.com/us/corporate/press/020861</a></p>
13,984
<p>Is anyone familiar with this?</p> <blockquote> <p>Write a procedure that takes as inputs a procedure that computes f and a positive integer n and returns the procedure that computes the nth repeated application of f. The procedure should be able to be used as follows:</p> <pre><code>((repeated square...
<p>Well, you probably want something like this, right?</p> <pre><code>((repeated square 3) 5) -&gt; (square ((repeated square 2) 5)) -&gt; (square (square ((repeated square 1) 5))) -&gt; (square (square (square ((repeated square 0) 5)))) -&gt; (square (square (square (identity 5)))) </code></pre> <p>(I don't know whe...
<pre><code>(define (repeated f n) (if (zero? n) identity (lambda (x) ((repeated f (- n 1)) (f x))))) </code></pre> <p>or, if you insist on using "compose":</p> <pre><code>(define (repeated f n) (if (zero? n) identity (compose (repeated f (- n 1)) f))) </code></pre>
31,003
<p>My question is pertaining to the best practice for accessing a child object's parent. So let's say a class instantiates another class, that class instance is now referenced with an object. From that child object, what is the best way to reference back to the parent object? Currently I know of a couple ways that I us...
<p>It's generally good to have the class as it's own instance and reduce tight coupling to something else (as in this case, it's parent). If you do something like parent.doSomething() it's not possible to use that class in container that doesn't have the doSometing() method. I think it's definitely better to pass in wh...
<p>If these objects are in the DisplayList, then you have some more options. If I have a ParentClass and a ChildClass, in the child class, you seem to be able to access the parent if you cast the request as the ParentClass. e.g. </p> <pre><code>ParentClass(parent).parentFunction(); </code></pre> <p>I know for sure it...
8,486
<p>I have a HQL query that can generate either an IList of results, or an IEnumerable of results. </p> <p>However, I want it to return an array of the Entity that I'm selecting, what would be the best way of accomplishing that? I can either enumerate through it and build the array, or use CopyTo() a defined array.</p>...
<p>Which version of .NET are you using? If it's .NET 3.5, I'd just call <code>ToArray()</code> and be done with it.</p> <p>If you only have a non-generic IEnumerable, do something like this:</p> <pre><code>IEnumerable query = ...; MyEntityType[] array = query.Cast&lt;MyEntityType&gt;().ToArray(); </code></pre> <p>I...
<p>I feel like reinventing the wheel...</p> <pre><code>public static T[] ConvertToArray&lt;T&gt;(this IEnumerable&lt;T&gt; enumerable) { if (enumerable == null) throw new ArgumentNullException("enumerable"); return enumerable as T[] ?? enumerable.ToArray(); } </code></pre>
33,723
<p>User <a href="https://stackoverflow.com/users/1065/kokos">kokos</a> answered the wonderful <em><a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden Features of C#</a></em> question by mentioning the <code>using</code> keyword. Can you elaborate on that? What are the uses of <code>using</cod...
<p>The reason for the <code>using</code> statement is to ensure that the object is disposed as soon as it goes out of scope, and it doesn't require explicit code to ensure that this happens.</p> <p>As in <em><a href="https://www.codeproject.com/Articles/6564/Understanding-the-using-statement-in-C" rel="noreferrer">Und...
<p>The <em>using</em> clause is used to define the scope for the particular variable.</p> <p>For example:</p> <pre><code>Using(SqlConnection conn = new SqlConnection(ConnectionString) { Conn.Open() // Execute SQL statements here. // You do not have to close the connection explicitly // here as &quot;US...
10,102
<p>The project I'm working is using n-tier architecture. Our layers are as follows:</p> <ul> <li>Data Access</li> <li>Business Logic</li> <li>Business Entities</li> <li>Presentation</li> </ul> <p>The Business Logic calls down into the data access layer, and the Presentation layer calls down into the Business Logic la...
<p>I highly recommend looking at Fowler's <a href="http://martinfowler.com/eaaCatalog/" rel="nofollow noreferrer">Patterns of Enterprise Architecture</a> book. There are a few different approaches to solving this sort of problem that he outlines nicely, including entity relationships.</p> <p>One of the more compelling...
<p>What language are you using? What you described is exactly what the Entity Framework does in .Net. But you didn't share what language you were using and I'm assuming you don't want to rewrite any of your datalayer.</p>
18,862
<p>Is there a simple way to format numbers in a Winforms 1.1 datagrid? The Format property of the DataGridTextBoxColumn seems to be completely ignored. I know there is a <a href="http://support.microsoft.com/kb/318581" rel="nofollow noreferrer">solution</a> that involves subclassing a Column control, and it's fairly ...
<p>My personal opinion is that a datagridcolumnstyle is the way to go. Without seeing the code that you have, I can't say for certain why your formatting isn't taking hold when no style is defined - but mixing in formatting with data calculations and other parts of the code can get very messy very quickly.</p> <p>Cre...
<p>I did subclass and it was easy and did work. I still don't like it so much. I was already subclassing column styles for other reasons. I'd rather handle all databinding myself, where I can more easily change it and test it. This whole mixing of the UI with the data is old school, and not in a good way.</p> <p>T...
5,467
<p>Seriously, I've trawled MSDN and only got half answers - what do the columns on the Task Manager mean? Why can't I calculate the VM Usage by enumerating threads, modules, heaps &amp;c.? How can I be sure I am accurately reporting to clients of my memory manager how much address space is left? Are their myriad col...
<p>Try the book "Windows Internals" by Mark Russinovich and I think some other guy too. It's pretty good on getting down to the nitty gritty.</p>
<p>Try the book "Windows Internals" by Mark Russinovich and I think some other guy too. It's pretty good on getting down to the nitty gritty.</p>
10,977
<p>in short: <strong>is there any way to find the current directory full path of a xul application?</strong></p> <p>long explanation:</p> <p>I would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul application. The html files reside outs...
<p>I found a workaround: <a href="http://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO" rel="nofollow noreferrer">http://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO</a> i cannot exactly open a file using a relative path "../../index.html" but i can get the app directory and work with that. </p> <pre><c...
<p>In a xul application, you can access the chrome folder of the application using a chrome url. </p> <p>I have relatively little experience with the element , so I'm not sure if this will work exactly for you. It is the way you include javascript source files in your xul file:</p> <pre><code>&lt;script src="chrom...
12,983
<p>I had a problem <a href="https://stackoverflow.com/questions/265919/why-doesnt-multithreading-in-c-reach-100-cpu">discovered on another thread here</a>, I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners...
<p><strong>On the topic of multiple STA components</strong></p> <p>It is possible to have two instances of the same STA COM component and access them from C#. The only thing that could prevent you from such scenario is the object itself if implemented as a singleton object.</p> <p>However, if both instances are on th...
<p>Try registering a second class using the same DLL. Consider that you may actually need a separate copy of the DLL with a different name in order to be completely safe.</p> <p>Just remember that the STA COM class (and perhaps its DLL) is not considered thread safe for multi-threading and there is nothing you can do...
35,155
<p>Create a flat text file in c++ around 50 - 100 MB with the content 'Added first line' should be inserted in to the file for 4 million times</p>
<p>using old style file io</p> <p><strong>fopen</strong> the file for write.</p> <p><strong>fseek</strong> to the desired file size - 1.</p> <p><strong>fwrite</strong> a single byte</p> <p><strong>fclose</strong> the file</p>
<p><strong>Fastest way to create large file in c++?</strong> Ok. I assume fastest way means the one that takes the smallest run time.</p> <p><strong>Create a flat text file in c++ around 50 - 100 MB with the content 'Added first line' should be inserted in to the file for 4 million times.</strong></p> <p>preallocate...
33,282
<p>I've got an application that loads .so files as plugins at startup, using <code>dlopen()</code></p> <p>The build environment is running on x86 hardware, but the application is being cross compiled for another platform.</p> <p>It would be great if I could (as part of the automated build process) do a check to make ...
<p>Ideally, a cross-nm tool is part of your cross-compiler suite. For example, if you build GNU binutils for cross-compilation, a cross-nm will be provided as well (along with a cross-objdump).</p>
<p>Could you use a recursive version of ldd for this? Someone seems to have <a href="http://www.lysium.de/blog/index.php?/archives/35-Recursive-ldd.html" rel="nofollow noreferrer">written a script</a> that might help. This at least tell you that all the dependency libs could be resolved, if they were specified in the...
34,014
<p>What is the most efficient way to get the default constructor (i.e. instance constructor with no parameters) of a System.Type?</p> <p>I was thinking something along the lines of the code below but it seems like there should be a simplier more efficient way to do it.</p> <pre><code>Type type = typeof(FooBar) Bindin...
<pre><code>type.GetConstructor(Type.EmptyTypes) </code></pre>
<p>you would want to try FormatterServices.GetUninitializedObject(Type) this one is better than Activator.CreateInstance </p> <p>However , this method doesn't call the object constructor , so if you are setting initial values there, this won't work Check MSDN for this thing <a href="http://msdn.microsoft.com/en-us/lib...
17,207
<p>Ok, I am reading in dat files into a byte array. For some reason, the people who generate these files put about a half meg's worth of useless null bytes at the end of the file. Anybody know a quick way to trim these off the end?</p> <p>First thought was to start at the end of the array and iterate backwards until...
<p>Given the extra questions now answered, it sounds like you're fundamentally doing the right thing. In particular, you have to touch every byte of the file from the last 0 onwards, to check that it only has 0s.</p> <p>Now, whether you have to copy everything or not depends on what you're then doing with the data.</p...
<p>In my case LINQ approach never finished ^))) It's to slow to work with byte arrays!</p> <p>Guys, why won't you use Array.Copy() method?</p> <pre><code> /// &lt;summary&gt; /// Gets array of bytes from memory stream. /// &lt;/summary&gt; /// &lt;param name="stream"&gt;Memory stream.&lt;/param&gt; ...
29,737
<p>Here are two chunks of code that accomplish (what I think is) the same thing.</p> <p>I basically am trying to learn how to use Java 1.5's concurrency to get away from Thread.sleep(long). The first example uses ReentrantLock, and the second example uses CountDownLatch. The jist of what I am trying to do is put one...
<p>Either approach is roughly equivalent, except that a <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/CountDownLatch.html" rel="noreferrer">CountDownLatch</a> can only be released once. After that all <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/CountDownLatch.html#await()"...
<h2><a href="https://github.com/c3ph3us/examples/blob/master/locks/ReEntrantLockedAsyncTask.java" rel="nofollow noreferrer">FULL RE-ENTRANT LOCKED ASYNC TASK EXAMPLE:</a></h2> <p><strong>WITH CODE FLOW SCHEMA:</strong> </p> <p><img src="https://i.stack.imgur.com/GdOtZ.png" alt="enter image description here"></p>
41,308
<p>I would like to use Apple's Xcode IDE to develop applications on the OS X, but I find the UI immensely confusing because I am so used to developing in Visual Studio on Windows.</p> <p>Does anyone know of any Xcode quickstart guides for the Visual Studio developer that map common tasks and functionality from one to ...
<p>For viewing the shell when a command line app, that is done in the Console window, not in a terminal window. This allows full interaction with gdb. To open the Console window, hit Shift-Command-R to see the output of your program.</p> <p>If you would like Xcode to show the Console window when you start your app, ...
<p>For viewing the shell when a command line app, that is done in the Console window, not in a terminal window. This allows full interaction with gdb. To open the Console window, hit Shift-Command-R to see the output of your program.</p> <p>If you would like Xcode to show the Console window when you start your app, ...
43,454
<p>Can you please point to alternative data storage tools and give good reasons to use them instead of good-old relational databases? In my opinion, most applications rarely use the full power of SQL--it would be interesting to see how to build an SQL-free application.</p>
<p>Plain text files in a filesystem</p> <ul> <li>Very simple to create and edit</li> <li>Easy for users to manipulate with simple tools (i.e. text editors, grep etc)</li> <li>Efficient storage of binary documents</li> </ul> <hr> <p>XML or JSON files on disk</p> <ul> <li>As above, but with a bit more ability to vali...
<p>One good reason not to use a relational database would be when you have a massive data set and want to do massively parallel and distributed processing on the data. The Google web index would be a perfect example of such a case. </p> <p>Hadoop also has an implementation of the <a href="http://labs.google.com/pape...
5,867
<p>I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When the user starts entering text in the search fi...
<p>You will need to use some P/Inovke interop code to do this. Look for the Win32 API <code>SendMessage</code> function and the <code>EM_SETCUEBANNER</code> message.</p>
<p>There is built-in functionality in the text box control -- <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.autocompletemode.aspx" rel="nofollow noreferrer">AutoCompleteMode</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.autocompletesource.aspx" rel...
6,902
<p>I've got a iSeries to .Net compact framework project. It includes rgple programs exposed as web services and a Windows mobile app that uses the webservices. Each iSeries program has a specific webservice wrapper and the .net app reference each. I would like to come up with a more generic messaging service using X...
<p>IBM provides the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzamj/rzamjmain.htm" rel="nofollow noreferrer">XML Toolkit for IBM System i5</a>.</p> <p>You can also run Java which has an <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzahh/rzahhxmlp...
<p>I have Used RPG-XML Suite by Krengletech and it works wonderfully. The procedures provided are all within a binding directory so it's really easy to add them to your programs. There are also several examples that you can cut and paste from that explain everything in detail. AAron also provides a couple of command...
34,363
<p>As Microsoft seems to have started their trickle feed of information regarding .NET 4.0, I thought I'd ask the question as I'm sure there's more out there than I've spotted!</p> <p>What information has been released regarding the .NET Framework 4.0?</p>
<p>InfoQ has some good information, but doesn't go into the details.</p> <ul> <li><a href="http://www.infoq.com/news/2008/10/Type-Embedding" rel="nofollow noreferrer">Type embedding</a></li> <li><a href="http://www.infoq.com/news/2008/10/CSharp-Dynamic" rel="nofollow noreferrer">Dynamic types in C#</a></li> <li><a hre...
<p><a href="http://news.google.com/news?hl=en&amp;ned=us&amp;q=net+Framework+4.0&amp;btnG=Search+News" rel="nofollow noreferrer">http://news.google.com/news?hl=en&amp;ned=us&amp;q=net+Framework+4.0&amp;btnG=Search+News</a> is a good place to start</p>
19,200
<p>I need to retrieve a set of Widgets from my data access layer, grouped by widget.Manufacturer, to display in a set of nested ASP.NET ListViews.</p> <p>The problem is that (as far as I can tell) the nested ListView approach requires me to shape the data before using it, and I can't figure out the best approach to ta...
<p>Ok, I'm going to contradict my prior statement. Since eval wants some kind of property name in the nested control, we should probably shape that data.</p> <pre><code>public class CustomGroup&lt;TKey, TValue&gt; { public TKey Key {get;set;} public IEnumerable&lt;TValue&gt; Values {get;set;} } </code></pre> <p>...
<p>When you're using Linq to group, you can get a strongly typed object without that shaping:</p> <pre><code>List&lt;int&gt; myInts = new List&lt;int&gt;() { 1, 2, 3, 4, 5 }; IEnumerable&lt;IGrouping&lt;int, int&gt;&gt; myGroups = myInts.GroupBy(i =&gt; i % 2); foreach (IGrouping&lt;int, int&gt; g in myGroups) { Con...
20,838
<p>How can I find out if SP1 has been installed on a server which has .NET 3.5?</p>
<p>Look at <code>HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5\</code>. One of these must be true:</p> <ul> <li>The <code>Version</code> value in that key should be <strong>3.5.30729.01</strong></li> <li>Or the <code>SP</code> value in the same key should be <strong>1</strong></li> </ul> <p>In C# (taken from t...
<p>Assuming that the name is everywhere "Microsoft .NET Framework 3.5 SP1", you can use this:</p> <pre><code>string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey)) { return rk.GetSubKeyNames().Contains("Microsoft .NET Fr...
24,242
<p>Is there any built-in, add-in solution for visual studio to compare two files and display result with differences? I could't find one...</p>
<p>I use <a href="http://www.winmerge.org" rel="noreferrer">WinMerge</a>. Not as good as Beyond Compare but it's free and open source.</p> <p>Also check out <a href="http://www.codeplex.com/ComparisonTools" rel="noreferrer">Visual Studio Comparison Tools</a>, it's a Visual Studio add-in that connects it to WinMerge.</...
<p>Not that I know of, but <a href="http://www.scootersoftware.com/index.php" rel="nofollow noreferrer">Beyond Compare</a> is probably worth a look anyway.</p>
45,751
<p>In this particular case I'm trying to discover if a mylib.a file is 32 or 64 bit compatible. I'm familiar with ldd for shared objects (mylib.so) but how do I inspect a regular .a archive? </p>
<p>"nm" and "ar" will give you some information about the library archive.</p>
<p>In the general case, I just use the 'file' utility.</p>
22,308
<p>There is a console Java application which is supposed to run until it is stopped by <kbd>Ctrl</kbd>+<kbd>C</kbd> or closing the console window. How that application can be programmed to execute a clean up code before exit?</p>
<p>You could use a <a href="http://www.onjava.com/pub/a/onjava/2003/03/26/shutdownhook.html" rel="noreferrer">Shutdown Hook</a>.</p> <p>Basically you need to create a Thread which will perform your shutdown actions, and then <a href="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#addShutdownHook(java.lan...
<p>The code written inside a <code>Thread</code>s <code>run()</code> method will execute when the runtime object terminates...</p> <pre><code>class ShutdownHookclass extends Thread { public void run() { // perform shutdown actions } } //could be written anywhere in your code Runtime.getRuntime().addSh...
33,183
<p>Is there a way of automatically generating a HTML-Map compatible list of coordinates of polygon-like objects (e.g. countries on a map) with very distinctive borders?</p> <p>Example image:</p> <p><a href="http://www.bankaustria.at/landkarten/CEE_2007_w524.jpg">Map of CEE countries http://www.bankaustria.at/landkart...
<p>Open the map in Inkscape. If it is a bitmap, use Path -> Trace Bitmap to trace the edges. Clean up the vector data to include only the paths that you want to appear in your imagemap. Save the document, I suggest to a POVRay file. Now you have a list of vertices (and plenty of markup or metadata that you don't ca...
<p>I made some changes and implementation to the code of Gerhard Dinhof.</p> <p>The PHP function generate an image map of the provided svg coord. You can specify a factor number that resize the area and x-y translation numbers to align the map to your image.</p> <pre><code>&lt;?php /** * $str SVG coordinates string...
40,525
<p>I have a silverlight control (View) which displays a list of items in a specified property of the datacontext (viewmodel).</p> <p>What I need is for the scrollviewer in my control to scroll to the top or bottom depending on where the latest item has been added to the list. (It'll always be either the beginning or t...
<p>A good starting point is <a href="http://www.codeproject.com/KB/WPF/AttachedBehaviors.aspx" rel="nofollow noreferrer">Attached Behaviors on CodeProject</a>. </p> <p>A useful behavior would watch the ListBox.ItemsSource and attach to the observable collection when set. On the collection changed event, use ListBox....
<p>In place of DataContextChanged in WPF , you can use CollectionChanged event of ObservableCollection. In the collection changed you will get to know the NewItem Index.</p>
41,952
<p>I am using the JQuery form plugin (<a href="http://malsup.com/jquery/form/" rel="noreferrer">http://malsup.com/jquery/form/</a>) to handle the ajax submission of a form. I also have JQuery.Validate (<a href="http://docs.jquery.com/Plugins/Validation" rel="noreferrer">http://docs.jquery.com/Plugins/Validation</a>) pl...
<p>You need to add a callback function for use with the beforeSubmit event when initializing the ajaxForm():</p> <pre><code>var options = { beforeSubmit: function() { return $('#searchForm').validate().form(); }, target: '#detailsView' }; </code></pre> <p>Now it knows to check ...
<p>May be a return false; on the form will help? :) I mean:</p> <pre><code>&lt;form id="searchForm" method="post" action="/User/GetDetails" onSubmit="return false;"&gt; </code></pre>
16,677