instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have two complex (i.e. objects with string, int, double, List and other home made data type) objects of the same type. I would like to compare the content of both of them to ensure that they are identical. Note: The object doesn't implement .Equals (I have no control on that) and doesn't implement IComparable. </p...
<p>I have created a class to perform a deep compare of .NET Objects. See:</p> <p><a href="https://github.com/GregFinzer/Compare-Net-Objects" rel="noreferrer">https://github.com/GregFinzer/Compare-Net-Objects</a></p>
<p>Well, you could write some logic to compare all of the properties of the two objects to each other. This gets complicated when it is an object graph with complex subtypes, so you will need to determine how close is good enough. </p>
49,203
<p>I have a datasource that I want to bind to a listview that has multiple columns. How do I bind my datasource to that listview</p> <p>Here is some pseudo code that doesn't work to help illustrate what I am trying to do:</p> <pre><code>MyDataTable dt = GetDataSource(); ListView1.DataBindings.Add("Column1.Text", dt, ...
<p>It seems there is a lacuna in functionality of WinForms ListView control (thought it's possible to <a href="http://msdn.microsoft.com/en-us/library/ms750972.aspx#BindingDatatoaListView" rel="nofollow noreferrer">databind</a> new WPF ListBox). </p> <p>This article by Nick Karnik describes how to add databinding capa...
<p>Check out this <a href="https://web.archive.org/web/20200221035838/http://geekswithblogs.net:80/rashid/archive/2007/09/09/Asp.net-ListView---DataBinding.aspx" rel="nofollow noreferrer">reference on binding datasource to listview</a>. Is that what you were looking for?</p>
33,540
<p>I've been working on getting a 2.5 module ported to 3.0, mostly for my own education, when I've gotten stuck. The class "Builder" has as its init:</p> <pre><code>def __init__(self, **options): self._verifyOptions(options) self._options = options self._initDigest() self._initBuildNames() self._me...
<p>I'm guessing that this line:</p> <pre><code>digester.update(self._options.get('code')) </code></pre> <p>should become:</p> <pre><code>digester.update(self._options.get('code').encode("utf-8")) </code></pre> <p>The actual desired encoding could be different in your case, but UTF-8 will work in all cases.</p>
<p>I havent tried 3.0 yet. But there is now a bigger distinction between a sequence of bytes and strings. The latter hold unicode codepoints while the former don't hold unicode but only <code>encoded</code> unicode strings. Hashes operate on sequences of bytes. So you will have to encode your (unicode) strings first be...
44,629
<p>I was trying to raise a post back event by div tag. I don't know how to do that. AL I could think of is javascript, but that is not what I want. I need to call function of a class inside a event handler. </p>
<p>You have to use javascript:</p> <pre><code>&lt;div id="foo" onclick="__doPostBack('foo','')"&gt; Clicky! &lt;/div&gt; </code></pre> <p>Part of the difficulty is you can't pass the event target easily. There are better ways to do what you want, but you need to elaborate on your need.</p>
<p>If I'm not mistaken, is order to do postback the control need to have "runat=server". Try add a id to the div tag and also the runat. </p>
44,454
<p>So I'm in Des Moines, Iowa and we have a good number of user groups in our area considering our size. Ruby, .Net, Java, Agile, *nix, etc... Well, tonight a good number of us "leaders" of said user groups got together for a couple drinks and to talk about how we can work together to help make the "DeMo" (I keep seein...
<p>I know of 3 different types of events around here for local user groups where each has its own pull:</p> <p>1) Presentations/Talks - Where someone comes in and talks for an hour or two on a subject to either introduce or advance the knowledge of a technology. So, an introduction Dependency Injection or Windows Work...
<p>A little different approach, but I can tell you what keeps me away... I've always been interested in going, but just don't make it to any of them.</p> <ul> <li>Most of them seem to be in small towns an hour away, right after work, so I'd miss a significant portion of the meeting.</li> <li>The rare one that meets h...
25,921
<p>Linux supports sending an arbitrary Posix-Signal such as <code>SIGINT</code> or <code>SIGTERM</code> to a process using the <code>kill</code>-Command. While <code>SIGINT</code> and <code>SIGTERM</code> are just boring old ways to end a process in a friendly or not-so-friendly kind of way, <code>SIGQUIT</code> is me...
<p>If what you want is to explicitly/programmatically kill another program/process of any kind, within the SysInternals' pstools there is a small tool named &quot;pskill&quot; that behaves just like Unixen &quot;kill&quot; would do.</p> <p>If you want something else, keep reading (though I may be wrong on some of the s...
<p>I'm just wondering if the <a href="http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx" rel="nofollow noreferrer">PsTools</a> from, now Microsoft owned, <a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" rel="nofollow noreferrer">SysInternals</a> would help you.</p>
16,952
<p>I have a JavaScript variable which holds an HTML page and due to the setup I need to extract everything between <code>&lt;div id="LiveArea"&gt;</code> and <code>&lt;/div&gt;</code> from that variable using JavaScript.</p> <p>Any help is greatly appreciated.</p>
<pre><code>var html = "&lt;stuff&gt;&lt;div id=\"LiveArea\"&gt;hello stackoverflow!&lt;/div&gt;&lt;/stuff&gt;"; var matches = html.match(/&lt;div\s+id="LiveArea"&gt;[\S\s]*?&lt;\/div&gt;/gi); var matches = matches[0].replace(/(&lt;\/?[^&gt;]+&gt;)/gi, ''); // Strip HTML tags? alert(matches); </code></pre>
<p>Sorry for late reply, if someone else stumbles on this problem here is my suggestion, assuming you have access to the page you are reading from source code.</p> <p>Add a HTML-comment like this</p> <pre><code>&lt;div id="LiveArea"&gt; &lt;!--LiveArea--&gt; Content here &lt;!--EndLiveArea--&gt; &lt;/div&gt; </code><...
36,691
<p>I've got the following rough structure:</p> <pre><code>Object -&gt; Object Revisions -&gt; Data </code></pre> <p>The Data can be shared between several Objects.</p> <p>What I'm trying to do is clean out old Object Revisions. I want to keep the first, active, and a spread of revisions so that the last change for a...
<p>Here is example SQL. If you have an Identity column, you can use this instead of "ActivityDate".</p> <pre><code>SELECT DATEDIFF(HOUR, prev.ActivityDate, curr.ActivityDate) FROM MyTable curr JOIN MyTable prev ON prev.ObjectID = curr.ObjectID WHERE prev.ActivityDate = (SELECT MAX(maxtbl.ActivityDate) ...
<p>Hrmm, interesting challenge. I think you can do it without a self-join if you use the new-to-2005 pivot functionality.</p>
7,567
<p>I think I've got it down to the most basic case:</p> <pre><code>int main(int argc, char ** argv) { int * arr; foo(arr); printf("car[3]=%d\n",arr[3]); free (arr); return 1; } void foo(int * arr) { arr = (int*) malloc( sizeof(int)*25 ); arr[3] = 69; } </code></pre> <p>The output is this:</p> <pre cl...
<p>You pass the pointer by value, not by reference, so whatever you do with arr inside foo will not make a difference outside the foo-function. As m_pGladiator wrote one way is to declare a reference to pointer like this (only possible in C++ btw. C does not know about references):</p> <pre><code>int main(int argc, c...
<p>You cannot change the value of your argument (arr) if it's not passed in by reference (&amp;). In general, you would want to return the pointer, so your method should be:</p> <p>arr=foo();</p> <p>It's bad juju to try to reassign arguments; I don't recommend the (&amp;) solution.</p>
13,092
<p>How can I figure out the CRC algorithm if a given code + CRC string is given? </p> <p>I have got several strings consisting of code + matching CRCs but don't know how to calculate the CRC in question so that I could produce more code strings. Here are some samples (16bit code + 4bit CRC):</p> <pre> 001010100001110...
<p>What makes you think it is a CRC? Usually CRCs are not used for such small pieces of data.</p> <p>To me this rather looks like some kind of parity, ECC (actually <a href="http://en.wikipedia.org/wiki/Forward_error_correction" rel="nofollow noreferrer">FEC</a>) or <a href="https://en.wikipedia.org/wiki/Reed%E2%80%93...
<p>There are too many CRC algorithm possibilities to guess effectively. You can take the easy approach, which is finding a Specification for your device. Or you can take the brute force method, which is figuring out the CRC for each possible input, and creating an algorithm that generates the same result.</p>
38,232
<p>Can you store an Array ( that contains another two subarrays one being a string and another another array) into a single MutableArray object?</p>
<p>Please read the documentation on NSArray. It can contain any number of arbitrary objects.</p> <p>That said, without knowing more about what you're doing, I'd suggest you look at NSDictionary and its mutable subclass.</p>
<p>Yes. You can use the following (enormous) line of code:</p> <pre><code>NSMutableArray * completeArray = [NSMutableArray arrayWithArray: [[myArray objectAtIndex:0] arrayByAddingObjectsFromArray: [myArray objectAtIndex:1]]];</code></pre> <p><b>edit:</b> Assuming that <code>myArray</code> is d...
45,792
<p>We have an SQL 2005 database backend for our website, currently about 10GB in size. There are a lot more reads than writes, though I don't have the exact statistics.</p> <p>We're upgrading our database server and I was thinking of getting 4 disks and setting them up in two RAID 1 arrays - one for the data files and...
<p>Your concept of using independent RAID 1 mirrors is the correct strategy.</p> <p>We have implemented similar scenarios at my work and they work very well.</p> <p><strong>RAID 1</strong></p> <p>RAID 1 gives you the speed of 1 disk for writing but 2 disks for reading.</p> <p>When you write data to a RAID 1 array, ...
<p>RAID 5 is good if you use a hardware controller with a decent amount of battery-backed cache RAM. Select a chunk size and configure the DB so that the stripe size (data disks * chunk size) is equal to DB write size. Make sure your data partition [is aligned / is a multiple of] the stripe size.</p> <p>Otherwise, ...
19,978
<p>I got pretty big webflow definition, which I do not want to copy/paste for reusing. There are references to action bean in XML, which is kind natural.</p> <p>I want to use same flow definiton twice: second time with actions configured differently (inject different implementation of service to it). </p> <p>Is there...
<p>You could try creating a new flow that extends the "pretty big one" and adding flowExecutionListeners to it.</p> <p>The interface "FlowExecutionListener"defines methods for the following events in flow execution:</p> <ul> <li>requestSubmitted </li> <li>requestProceessed</li> <li>sessionCreating</li> <li>sessionSta...
<p>I don't think you can use the same webflow definition with the actions configured in two different ways.</p> <p>If you want to use different actions you'll either have to reconfigure your action beans then redeploy your app or create a separate webflow definition with the differently configured beans.</p> <p><a hr...
12,798
<p>Is there any way of batch renaming files in sub directories?</p> <p>For example:</p> <p>Rename <code>*.html</code> to <code>*.htm</code> in a folder which has directories and sub directories.</p>
<p>Windows command prompt: (If inside a batch file, change %x to %%x)</p> <pre><code>for /r %x in (*.html) do ren "%x" *.htm </code></pre> <p>This also works for renaming the middle of the files</p> <pre><code>for /r %x in (website*.html) do ren "%x" site*.htm </code></pre>
<p>AWK on Linux. For the first directory this is your answer... Extrapolate by recursively calling awk on dir_path perhaps by writing another awk which writes this exact awk below... and so on.</p> <pre><code>ls dir_path/. | awk -F"." '{print "mv file_name/"$0" dir_path/"$1".new_extension"}' |csh </code></pre>
30,503
<p>I have a PHP web application which uses a MySQL database for object tagging, in which I've used the tag structure accepted as the answer to <a href="https://stackoverflow.com/questions/20856/how-do-you-recommend-implementing-tags-or-tagging">this SO question</a>.</p> <p>I'd like to implement a tag hierarchy, where ...
<p>I implemented it using two columns. I simplify it here a little, because I had to keep the tag name in a separate field/table because I had to localize it for different languages: </p> <ul> <li>tag</li> <li>path</li> </ul> <p>Look at these rows for example:</p> <pre><code>tag path --- ---- d...
<p>I would use some kind of array to store the children tags, this should be a lot faster than joining a table on itself (especially if you have a large number of tags). I had a look, and I can't tell if mysql has a native array data type, but you can emulate this by using a text column and storing a serialized array i...
32,064
<p>We have hosted our web applications on Tomcat 6.0.18 and experienced the following problem:</p> <p>There are two web apps WebApp1 and WebApp2, both are same system but of different versions. </p> <p>Now the problem is when the tomcat has been running for a week or longer time then sometimes system gives NoClassDef...
<p>I've encountered many, many flavors of classloader weirdness with Tomcat - even if you don't perform any classloader code yourself, it's very easy for Tomcat itself to produce problems. The most common problem appears to be repeatedly unloading and reloading a webapp leaks classloaders and eventually runs Tomcat out...
<p>Thanks Chris for your response.</p> <p>The jar has been part of the system and having some common classes which are shared by other processes.</p> <p>Lets call that jar comutils.jar So the scenario is something like,</p> <pre> WebApp1 (ver 1) | |- comutils.jar (ver 1) | |- MailSender.class (ve...
41,127
<p>I'm new to 3D printing and have bought a resin printer.</p> <p>Cleaning with <strong>Isopropol Alcohol</strong> seems to be the rage, however I think this is unaware of cost savings. It appears <strong>methylated spirits</strong> is ok and is 25% the cost of Isopropol Alcohol.</p> <p>I'm now down to wondering if ...
<p>I would personally stick to isopropanol. Be aware that 3D printing is a very expensive hobby, but health wise this is a better option. Methylated spirits can quickly become dangerous, and often can burn with a close to invisible flame, meaning that you may not even see if it is burning. Also, the fumes can quickly b...
<p>Are you for real?</p> <p>Isopropyl alcohol is less dangerous to your health than ethanol with a touch of denaturant?</p> <p>Seriously read the MSDS sheets for the products and know what's in them before you say stuff.</p> <p>The amount of MEK or MIBK is so small.</p> <p>Some and not many methylated spirits have a sm...
1,584
<p>I don't want to change how the Status field works I just want to change the labels to the states that the old system uses. (the old systems consists of spreadsheets and paper :P <br> We are using 3.0</p> <pre> * UNCONFIRMED --> PRELIMARY * NEW --> DESIGN REVIEW * ASSIGNED --> STR1 * RESOLVED --> ...
<p>I think this can be done by modifying the templates look here: </p> <p><a href="http://www.bugzilla.org/docs/2.22/html/cust-templates.html" rel="nofollow noreferrer">http://www.bugzilla.org/docs/2.22/html/cust-templates.html</a></p> <p>specifically: <strong>global/variables.none.tmpl</strong></p>
<p>If you log into the bugzilla system as an administrator you'll see on the bottom a link that says "Field Values", click that, on the next page you'll see "Resolution", go there then click on the resolution you'd like to change,</p>
16,938
<p>How to make a shadow to main window widget on windows using Qt?</p>
<p>Re @Adam Rosenfield: The union will achieve alignment so long as the supplier of the char* started out doing something similar.</p> <p>It may be useful to stand back and figure out what this is all about.</p> <p>The basis for the aliasing rule is the fact that compilers may place values of different simple types o...
<p>Correct, the second example is in violation of the strict aliasing rules, so if you compile with the <code>-fstrict-aliasing</code> flag, there's a chance you may get incorrect object code. The fully correct solution would be to use a union here:</p> <pre><code>union { SocketMsgToRecv msg; char msgBuff[100]; }...
32,838
<p>What are the best ways of dealing with UTC Conversion and daylight saving times conversion. What are the problems and their solutions. All in C# .Net 2.0. Also any existing problems with this in .Net 2.0.</p>
<p>If you use UTC times you shouldn't worry about clients timezones or daylight saving... (if they have set a standard)</p>
<p>You really don't need to worry about it much with .NET if you're using UTC everywhere. If you're interested in seeing this sort of stuff in action you might check out the <a href="http://msdn.microsoft.com/en-us/library/system.timezoneinfo_members.aspx" rel="nofollow noreferrer">TimeZoneInfo</a> class.</p>
27,333
<p>As we all know, global data, like the locale settings affecting the numeric decimal point printf() and strtod() are using, is evil. Fortunately, MSVC++ 9 allows to use per-thread locales by a <code>_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)</code> call. Unfortunately, it seems that the localeconv() function does...
<p>Despite the suggestion that this is expected behaviour from rubenvb, this is actually a bug that I ran into a while ago. I suspect rubenvb misread this part of the question:</p> <blockquote> <p>Unfortunately, it seems that the localeconv() function does not notice this and still returns the global locale settings...
<p>The call to the <code>_configthreadlocale</code> sets the property, before the call, nothing special happens. So yes, this is expected behavior. You first must call this function, and then you can take advantage of thread-local locales.</p>
34,799
<p>I want to increase the I/O priority of a process. Answers for both .NET and Windows Vista would be nice. processexplorer is ok as well.</p>
<p>The relevant information seems to be a bit scattered compared to the usual MS documentation. There is this white paper that discusses <a href="http://www.google.co.nz/url?sa=t&amp;source=web&amp;ct=res&amp;cd=2&amp;url=http%3A%2F%2Fdownload.microsoft.com%2Fdownload%2Fa%2Ff%2F7%2Faf7777e5-7dcd-4800-8a0a-b18336565f5b%...
<p>If you want critical I/O priority on files your app is dealing with, I believe renaming the files to .mp3 will get you that! Windows does this for media files like .mp3, .mp4 etc It can be observed with Process Hacker in the Disk tab, as soon as anything reads mp3's you'll see they are all in critical I/O. I haven't...
38,644
<p>I have a database file that is generated on a PC using Sqlite. This file is then transferred to an ARM7 based embedded system without an operating system. The embedded system must access this database, but does not need to update it.</p> <p>I have been trying to get sqlite3 small enough for the embedded system, b...
<p>The smallest sqlite3 I came up with was 327 KBytes (for PowerPC), which was sufficient for the system so I stopped trying to make it smaller. This was the full sqlite3 CLI binary, the C APIs alone would have been somewhat smaller.</p> <p>I had set SQLITE_OMIT_AUTHORIZATION, SQLITE_OMIT_EXPLAIN, SQLITE_OMIT_PROGRESS...
<p>Can you export the database file to a XML or text or another "flat" file? That's much easier to work with in an embedded environment.</p>
21,484
<p>Try running these two simple statements on Oracle 10.2:</p> <pre><code>CREATE TABLE mytest (table_name varchar2(30), index_name varchar2(30), column_expression clob, column_position number); INSERT INTO mytest (table_name, index_name, column_expression, column_position) SELECT table_nam...
<p>If Michel Cadot <a href="http://www.orafaq.com/forum/mv/msg/125912/352199/0/" rel="nofollow noreferrer">says</a> its a bug, then its almost certainly a bug.</p>
<p>Yep, seems like it.</p> <p><a href="http://www.orafaq.com/forum/m/352199/130782/#msg_352199" rel="nofollow noreferrer">http://www.orafaq.com/forum/m/352199/130782/#msg_352199</a></p>
21,000
<p>I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to.</p> <p>The trouble is, this contrived example doesn't work:</p> <pre><code>sudo ls -hal /root/ &gt; /root/test.out </code><...
<p>Your command does not work because the redirection is performed by your shell which does not have the permission to write to <code>/root/test.out</code>. The redirection of the output <strong>is not</strong> performed by sudo.</p> <p>There are multiple solutions:</p> <ul> <li><p>Run a shell with sudo and give the ...
<p>Maybe you been given sudo access to only some programs/paths? Then there is no way to do what you want. (unless you will hack it somehow)</p> <p>If it is not the case then maybe you can write bash script:</p> <pre><code>cat &gt; myscript.sh #!/bin/sh ls -hal /root/ &gt; /root/test.out </code></pre> <p>Press <kbd...
10,793
<p>I'm selecting 1 field from 1 table and storing it into a temp table.</p> <p>Sometimes that table ends up with 0 rows.</p> <p>I want to add that field onto another table that has 20+ fields</p> <p>Regular union won't work for me because of the field # mismatch. Outer wont work for me because there is nothing to co...
<p>What field would it match with? BTW, here's how to line them up:</p> <pre><code>SELECT NULL, NULL, NULL, NULL, MySingleField, NULL, NULL, NULL... FROM #temp UNION ALL SELECT Col1, Col2, Col3, Col4, Col5, Col6,... FROM OtherTable </code></pre> <p>UPDATE:</p> <p>OK, after reading your update... I don't think you wa...
<p>Try selecting <code>nvl(NULL,NULL)</code> for missing values</p>
44,456
<p>We have a notification service running on our TFS server which automatically modifies certain work items when they are created so they are assigned to the right people and so on.</p> <p>Over the weekend a patch was applied to our TFS server and since then the notification service appears to be broken.</p> <p>When ...
<p>The AgentService.asmx is the web service hosted by the Visual Studio Team Foundation Build service on a team foundation build agent. The Build Agent service actually makes this URL available via WCF and so does't show up under IIS. By default the build agent is configured to run on port 9191 though so that it does...
<p>The AgentService.asmx is the web service hosted by the Visual Studio Team Foundation Build service on a team foundation build agent. The Build Agent service actually makes this URL available via WCF and so does't show up under IIS. By default the build agent is configured to run on port 9191 though so that it does...
45,363
<p>I have a simple iPhone app that has a tab bar and 3 tabs. Each tab loads as a separate nib with a corresponding controller. Each nib contains a tableview with some other controls for searching/filtering etc.</p> <p>What I would like (and cant seem to find an example of) is adding a navigation controller to the app ...
<p>Once you have a tab bar in a XIB, the easiest way to approach this is to drag a UINavigationController object over from the Library window (looks like a left nav bar button on a gold background) into the Tree View for your tab bar (the text only view, not the GUI). Place the navigation controller inside the tab bar...
<p>The question is too old but SDKs are upgraded and some readers might need new answer. So, now for storyboard users, the answer to use both Tabbar and Navigation controller is pretty simple.</p> <ol> <li>Drag Navigation Controller inside storyboard.</li> <li>Assign the startup arrow to the new Navigation Controller ...
48,206
<p>I had read that SEO is applicable for static website, which holding the information in the initial page itself. Is it possible to get search engines to index the dynamically added information?</p> <p>I used AJAX for loading information. In this situation how can I optimize a site for search engines?</p>
<p>You have to make all your content accessible without javascript (ie. ajax). Otherwise the search engine spiders cannot index your content.</p>
<p>SEO ultimately is based on have a good site. Things that will help you are links from other "good sites", Having descriptive friendly, URLS, page titles and H1 headings submitting sitemaps to google and using there webmaster tools is a great starting place</p>
33,157
<p>I know the statement:</p> <pre><code>create table xyz_new as select * from xyz; </code></pre> <p>Which copies the structure and the data, but what if I just want the structure?</p>
<p>Just use a where clause that won't select any rows:</p> <pre><code>create table xyz_new as select * from xyz where 1=0; </code></pre> <h3>Limitations</h3> <p>The following things will not be copied to the new table:</p> <ul> <li>sequences</li> <li>triggers</li> <li>indexes</li> <li>some constraints may not be co...
<p>The task above can be completed in two simple steps.</p> <h3>STEP 1:</h3> <pre><code>CREATE table new_table_name AS(Select * from old_table_name); </code></pre> <p>The <code>query</code> above creates a duplicate of a table (with contents as well).</p> <p>To get the structure, delete the contents of the table using....
28,947
<p>I recently read somewhere that writing a regexp to match an email address, taking into account all the variations and possibilities of the standard is extremely hard and is significantly more complicated than what one would initially assume.</p> <p>Why is that?</p> <p>Are there any known and proven regexps that actu...
<p>For the <em>formal</em> e-mail spec, yes, it is technically impossible via Regex due to the recursion of things like comments (especially if you don't remove comments to whitespace first), and the various different formats (an e-mail address isn't always someone@somewhere.tld). You can get close (with some massive a...
<p><em>Can anyone provide some insight as to why that is?</em></p> <p>Yes, it is an extremely complicated standard that allows lots of stuff that no one really uses today. :)</p> <p><em>Are there any known and proven regexps that actually do this fully?</em></p> <p>Here is one attempt to parse the whole standard ful...
18,921
<p>I need to generate a random integer between 1 and n (where n is a positive whole number) to use for a unit test. I don't need something overly complicated to ensure true randomness - just an old-fashioned random number.</p> <p>How would I do that?</p>
<p>To get a random integer value between 1 and N (inclusive) you can use the following.</p> <pre><code>CInt(Math.Ceiling(Rnd() * n)) + 1 </code></pre>
<pre><code>Function xrand() As Long Dim r1 As Long = Now.Day &amp; Now.Month &amp; Now.Year &amp; Now.Hour &amp; Now.Minute &amp; Now.Second &amp; Now.Millisecond Dim RAND As Long = Math.Max(r1, r1 * 2) Return RAND End Function </code></pre> <p>[BBOYSE] This its the best way, from scratch :P</p...
3,922
<p>It seems like you could use a mashup of Relector and a Debugger to be able to debug any .NET app WITHOUT having the source code at all. Is this possible? Has anyone seen this before?</p>
<p>The <a href="http://www.codeplex.com/deblector" rel="noreferrer">Deblector</a> plug-in for Reflector allows you to debug straight from Reflector.</p>
<p>It's possible but not really practical in larger more complex applications, especially when lots of the more recent structures like lambdas and initializers have been used (you get a whole bunch of variable names containing dollar signs like CS$4$0000 that have to be fixed manually). Even simple switch statements ca...
13,267
<p>Are there any <strong>professional</strong> Combobox controls (dropdown list with autosuggestion) based on the jQuery library?</p> <p>It should be able to handle <strong>large datasets</strong> and have some <strong>skinning</strong> options. A <strong>multi-column result list</strong> would be great too. I'm worki...
<p>Unfortunately, the best thing I have seen is the <a href="http://web.archive.org/web/20130430100104/http://jquery.sanchezsalvador.com/page/jquerycombobox.aspx" rel="nofollow noreferrer">jquery.combobox</a>, but it doesn't really look like something I'd really want to use in my web applications. I think there are som...
<p>all what you need <a href="http://jquerycomboboxtmpl.codeplex.com/" rel="nofollow">http://jquerycomboboxtmpl.codeplex.com/</a></p> <p>drop-down on templates</p>
23,718
<p>Is there a way to set the StartPosition of a Windows Forms form using code? It seems whatever I try results in the StartPostion being the default.</p> <p>Here is what I am doing in the form to display:</p> <pre><code> public DealsForm() { InitializeComponent(); this.StartPosition = FormStartP...
<blockquote> <p>If I do a ShowDialog() and pass the parent it works ... but I really don't want to show it as a Dialog.</p> </blockquote> <p>That is correct since ShowDialog would set frm.Parent == nvShowDeals.Parent <br>Since you are using .Show() then frm.Parent == null thus FormStartPosition.CenterParent is i...
<p>My first reaction is: experiment a bit with VS2008. It should be in the general properties screen.</p> <p>If you don't have Visual Studio, then it gets a little harder.</p> <p>A good site to check might be this one: <a href="http://en.csharp-online.net/CSharp_Certification%2C_Development%2C_and_Training" rel="nofo...
27,908
<p>I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example:</p> <p><strong>.h file</strong></p> <pre><code>class foo { public: template &lt;typename T&gt; void do(co...
<p>The problem you describe can be solved by defining the template in the header, or via the approach you describe above.</p> <p>I recommend reading the following points from the <a href="https://isocpp.org/wiki/faq/templates" rel="noreferrer">C++ FAQ Lite</a>: </p> <ul> <li><a href="https://isocpp.org/wiki/faq/templ...
<p>There is nothing wrong with the example you have given. But i must say i believe it's not efficient to store function definitions in a cpp file. I only understand the need to separate the function's declaration and definition.</p> <p>When used together with explicit class instantiation, the Boost Concept Check Libr...
14,106
<p>I'm using HttpListener to allow a user to set up a proxy on a user-defined port. When I start the HttpListener, I get an exception if the application isn't running under administrator privileges in Vista.</p> <p>From what I've read, <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feed...
<p>While you can write your own HTTP server using normal TCP/IP (it's relatively simple), it is easier to use HttpListener, which takes advantage of the HTTP.SYS functionality added in Windows XP SP2.</p> <p>However, HTTP.SYS adds the concept of URL ACLs. This is partly because HTTP.SYS allows you to bind to sub-names...
<p>In XP, you had to use a command-line (httpcfg) to open up the port first, otherwise it wouldn't work for non-admins.</p> <p>See <a href="http://www.oreillynet.com/windows/blog/2005/09/httplistener_and_nonadmin.html" rel="nofollow noreferrer">here</a> - the page explains the issue, and there is a <a href="http://www...
20,507
<p>I am trying to insert a time only value, but get the following error</p> <blockquote> <ul> <li>ex {"SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."} System.Exception</li> </ul> </blockquote> <p>From the front end, the time is selected using the "TimeEdit" control, wi...
<p>Pick a date that is in the range(ie, 1/1/1970) and use it for everything you insert.</p>
<p>there is no such thing as Time in SQL, there is only DateTime. </p> <p>For your purpose, I would use something like this to only return the time portion.</p> <pre><code>SELECT (GETDATE() - (CAST(FLOOR(CAST(GETDATE() as FLOAT)) AS DateTime))) </code></pre> <p>where GETDATE() is the datetime you want to filter. </p...
30,249
<p>I have a standard HTML image tag with an image in it, 100 by 100 pixels in size. I want people to be able to click the image and for that to pass the X and Y that they click into a function.</p> <p>The coordinates need to be relative to the image top and left.</p>
<p>I think you're talking about:</p> <pre><code>&lt;input id="info" type="image"&gt; </code></pre> <p>When submitted, there are form values for the x and y coordinate based on the input element id (<code>info.x</code> and <code>info.y</code> in this case).</p> <p><a href="http://www.w3.org/TR/REC-html40/interact/for...
<p>from what you describe you should register to the image mouse event, for this case you should have the image mouse button event.</p> <p>at the function you should use </p> <pre><code>Point mousePoint = e.GetPosition( this ); </code></pre> <p>that will give you the mouse position according to the top left point in...
3,994
<p>This recent question about <a href="https://stackoverflow.com/questions/375351/most-efficient-way-to-randomly-sort-shuffle-a-list-of-integers-in-c">sorting randomly using C#</a> got me thinking about the way I've sometimes shuffled my arrays in Perl.</p> <pre><code>@shuffled = sort { rand() &lt;=&gt; rand() } @arra...
<p>I'm not a Perl internals expert, so I don't know how "sort" will work here. However, most sort functions expect consistency in their comparisons, and I would expect them to work unpredictably if the function is itself random. Unfortunately, unpredictability is not the same as randomness, and so I'd have no confide...
<pre><code> @shuffled = map { $_->[1] } sort { $a->[0] &lt;=> $b->[0] } map { [ rand(), $_ ] } @array; </code></pre>
49,133
<p>What is the best practice to solve a Java VM crash if the follow conditions are true:</p> <ul> <li>No own or third party native code. 100% pure java</li> <li>The same program run on many other system without any problems.</li> </ul> <p>PS: With VM crash I means that the VM write a dump file like hs_err_pid1234.log...
<p>Update or replace your JVM. If you currently have the newest version, then try an older one, or if you don't have the latest version, try updating to it. Maybe its a known issue in your particular version?</p>
<p>Take a look at the stacktraces in the dump file, as it should tell you what was going on when the crash occurred.</p> <p>As well as digging into the <code>hs_err</code> dump file, I'd also submit it to Sun or whomever made your JVM (I believe there are instructions in how to do so at the top of the file?). It can't...
27,836
<p>My printer came with a knock off BuildTak like build surface. What can I use to clean it? I don't want to damage it. </p>
<p>For BuildTak, my first recommendation is isopropyl alcohol (aka rubbing alcohol or isopropanol). Readily available just about anywhere basic medical supplies are sold, it cuts though light oils and greases, and dissolves most common build surface adhesives like hairspray or Elmer's glue stick. In fact I often give m...
<p>Besides IPA (80 %), which is one of the best cleaners for general pourpose, 99 % ethanol ("Spiritus") can work as a good substitute.</p> <p>Acetone too can be used on BuildTak and its clones in a pitch without damaging it, as long as it is kept away from the edges, where it could weaken the bond to the aluminium. U...
1,554
<p>Does anyone know why in Oracle 11g when you do a Count(1) with more than one natural join it does a cartesian join and throws the count way off?</p> <p>Such as </p> <pre><code>SELECT Count(1) FROM record NATURAL join address NATURAL join person WHERE status=1 AND code = 1 AND state = 'TN' </code></pre> <p>This pu...
<p>My advice would be to NOT use NATURAL JOIN. Explicitly define your join conditions to avoid confusion and "hidden bugs". Here is the <a href="http://68.142.116.68/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#sthref9907" rel="noreferrer">official NATURAL JOIN Oracle documentation</a> and <a href="http://a...
<p>you should try a count(*)</p> <p>There is a difference between the two.<br> count(1) signifies count rows where 1 is not null<br> count(*) signifies count the rows</p>
12,893
<p>I have a problem when I try to center the div block "products" because I don't know in advance the div width. Anybody have a solution?</p> <p>Update: The problem I have is I don't know how many products I'll display, I can have 1, 2 or 3 products, I can center them if it was a fixed number as I'd know the width of...
<p><strong>Update 27 Feb 2015:</strong> My original answer keeps getting voted up, but now I normally use @bobince's approach instead.</p> <pre><code>.child { /* This is the item to center... */ display: inline-block; } .parent { /* ...and this is its parent container. */ text-align: center; } </code></pre> <p><s...
<p>add this css to your product_container class</p> <pre><code> margin: 0px auto; padding: 0px; border:0; width: 700px; </code></pre>
36,019
<p>I'm trying to find out how much memory my objects take to see how many of them are ending up on the <a href="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap" rel="nofollow noreferrer">Large Object Heap</a> (which is anything over 85,000 bytes).</p> <p>Is it as simple as adding ...
<p>Don't forget that the size of an actual object doesn't include the size of any objects it references.</p> <p>The only things which are likely to end up on the large object heap are arrays and strings - other objects tends to be relatively small in themselves. Even an object with (say) 10 reference type variables (4...
<p>In cases like <code>Dictionary&lt;TKey, TValue&gt;</code>, you can hack getting the object size by binary serialization. Here is a sample code:</p> <pre class="lang-cs prettyprint-override"><code>var dictionary = new DictionaryGenerator().GetSomeLargeDictionary(); var memoryStream = new System.IO.MemoryStream(); var...
41,958
<p>I have a crosstab query that uses a dynamic date function to result in the column headers and therefore the field names. Ex: ForecastPeriod:DateAdd("m",[Period],[StartDate]) This means that every time I run the crosstab query, I could end up with different field names. I need to take the results of this crosstab and...
<p>VBA to create a table mirroring the columns of a query:</p> <pre><code>Dim db As DAO.Database Dim tdf As DAO.TableDef Dim qdf As DAO.QueryDef Dim fld As DAO.Field Dim SourceField As DAO.Field Set db = CurrentDb 'Create a new tabledef Set tdf = New DAO.TableDef 'Reference existing, saved querydef Set qdf = db.Que...
<p>It is possible to use your own headings for the crosstab, for example:</p> <pre><code>ColHead:"Month" &amp; DateDiff("m",[SaleDate],Forms!frmForm!txtSomeDate) </code></pre> <p>This would result in column headings called 'Month' and an offset number from txtSomeDate.</p> <p>It is also possible to use vba to build ...
38,916
<p>I am trying to compare two decimal values in Java script. I have two objects as one assogned value "3" and the other as "3.00". When i say if (obj1 == obj2) it does not pass the condition as it is does the string comparision. </p> <p>I would instead want it to do a decimal comparision where 3 = 3.00. Please let me...
<p><a href="http://www.javascripter.net/faq/convert2.htm" rel="nofollow noreferrer">This page</a> describes how to convert a string to a floating-point number; I believe that is what you want. This would let you compare the numbers as numbers, which I think is what you mean by "decimally". Beware that doing an exact co...
<pre><code>if(parseFloat(obj1) == parseFloat(obj2)) { // ... </code></pre> <p>But heed unwind's answer.</p>
30,014
<p>In my domain model I have an abstract class CommunicationChannelSpecification, which has child classes like FTPChannelSpecification, EMailChannelSpecification and WebserviceChannelSpecification. Now I want to create an HQL query which contains a where clause that narrows down the result to certain types of channel s...
<p>Not positive in NHibernate, but in Hibernate, there are two special properties that are always referenced id and class. So, for your particular case, I'd do</p> <pre><code>from CommunicationChannelSpecifications spec where spec.class in (?) </code></pre>
<p>NHibernate supports the same syntax as Hibernate in this case. See <a href="http://nhforge.org/doc/nh/en/index.html#queryhql-where" rel="nofollow noreferrer">here</a> for an example.</p>
48,521
<p>What is the most efficient way to read the last row with SQL Server?</p> <p>The table is indexed on a unique key -- the "bottom" key values represent the last row.</p>
<p>If you're using MS SQL, you can try:</p> <pre><code>SELECT TOP 1 * FROM table_Name ORDER BY unique_column DESC </code></pre>
<p>I am pretty sure that it is:</p> <pre><code>SELECT last(column_name) FROM table </code></pre> <p>Becaause I use something similar:</p> <pre><code>SELECT last(id) FROM Status </code></pre>
21,360
<p>In order to provide nice URLs between parts of our app we split everything up into several modules which are compiled independently. For example, there is a "manager" portion and an "editor" portion. The editor launches in a new window. By doing this we can link to the editor directly:</p> <pre><code>/com.example.E...
<p>I have built a few very large applications in GWT, and I find it best to split things up into modules, and move the common code into it's own area, like you've done. The reason in our case was simple, we had some parts of our application that were very different to the rest, so it made sense from a compile size poin...
<p>Ok. I really get the sense there really is no "right" answer because projects vary so much. It's very much dependent on the nature of the application.</p> <p>Our main build is composed of a number of in-house modules and 3rd party modules. They are all managed in seperate projects. That makes sense since they are u...
43,044
<p>I have two Tables.</p> <p>Order - With Columns OrderID, OrderStatusID<br /> OrderStatus - With Columns OrderStatusID, Description</p> <p>I have an Order Object which calls to the database and fills its properties for use in my code. Right now I have access to Order.OrderStatusID, but in my application I really ne...
<p>Usually I prefer to handle lookups as <a href="http://martinfowler.com/bliki/ValueObject.html" rel="nofollow noreferrer">Value objects</a>. I also use <a href="http://en.wikipedia.org/wiki/Null_Object_pattern" rel="nofollow noreferrer">Null Object pattern</a>.</p> <pre><code>public class Order { private int statu...
<p>You can use a SQL select statement with a Join to the OrderStatus table, and include the columns yo want from each table ...</p> <pre><code>Select O.OrderId, O.OrderStatusId, S.Descriptiuon From Order O Join OrderStatus S On S.OrderStatusId = O.OrderStatusId Where OrderId = 23 -- or whatever </code></p...
38,268
<p>Javascripts are in <code>script.js</code> file which I have called in the xhtml file.</p> <p>But it is throwing error at line where I have calling <code>onpageload</code> function saying " object expected.</p> <p>However, if I have the scripts on same XHTML file, it is working fine.</p>
<p>As it's a MemoryStream, you really don't <em>need</em> to close the stream - nothing bad will happen if you don't, although obviously it's good practice to dispose anything that's disposable anyway. (See <a href="https://stackoverflow.com/questions/234059">this question</a> for more on this.)</p> <p>However, you <e...
<p>One strange solution which made my code to work. Open the image in paint and save it as a new file with same format(.jpg). Now try with this new file and it works. It clearly explains you that the file might be corrupted in someway. This can help only if your code has every other bugs fixed</p>
43,634
<p>I want to use a file to store the current version number for a piece of customer software which can be used by a start-up script to run the binary in the correct directory.</p> <p>For Example, if the run directory looks like this:</p> <pre><code>. .. 1.2.1 1.2.2 1.3.0 run.sh current_version </code></pre> <p>And c...
<p>That's a common approach. You can check for dir/file existence using test operators such as "if [ -d "somedirectory" ]; then" or [ -t "somefile" ]</p> <p>I use symbolic links more often, though. Then, you can just change your symbolic link to use the version you want.</p> <p>For example,</p> <pre> $ ln -s 1.2.2...
<pre><code>!#/bin/sh if [ -e 'current_version' ]; then version=`cat current_version`; version=`echo $version | tr -ds [[:blank:]]` if [ -n "$version" ]; then if [ -d "$version" ]; then cd "$version" else echo $version is not a directory fi else echo version_fil...
9,164
<p>How to design a dropdown list that can have multiple selections using checkboxes. Can we do it using html/css or it requires javascript? For a visual clarity you can have a look at the image I have attached.<br><a href="http://shivanand.in/tmp/dropdown.gif" rel="nofollow noreferrer">image link</a></p>
<p>You can have a look at the HTML source code of the site on your screenshot. There it is done with Javascript. I doubt this is possible with pure HTML and I can't imagine a way to do this with CSS.</p>
<p>You can have a look at the HTML source code of the site on your screenshot. There it is done with Javascript. I doubt this is possible with pure HTML and I can't imagine a way to do this with CSS.</p>
35,438
<p>I work on a database driven website. Most pages' titles are the names of partners we have, and served from a database using php.</p> <p>For example one page might be called "Experian". The problem is that some of the values for partner names don't work because the values are things like </p> <pre><code> $partne...
<p>For:</p> <pre><code>&lt;title&gt;&lt;?php echo $offer22name ?&gt;is a magazine&lt;/title&gt; </code></pre> <p>change to:</p> <pre><code>&lt;title&gt;&lt;?php echo preg_replace('|&lt;sup&gt;(.*?)&lt;/sup&gt;|', '($1)', $offer22name) ?&gt; is a magazine&lt;/title&gt; </code></pre> <p>But like Bryan mentioned, you ...
<p>You can use character encoding instead of the tag, e.g. <code>&amp;trade;</code>, <code>&amp;#153;</code></p>
49,119
<p>Let's say that I'm considering designing a WCF service whose primary purpose is to provide broad services that can be used by three disparate applications: a public-facing Web site, an internal Windows Forms application, and a wireless mobile device. The purpose of the service is twofold: (1) to consolidate code rel...
<p>Well, I reckon that I'll take a stab at my own question now that I've spent a few hours playing with various approaches.</p> <p>My first approach was to set up certificate-based authentication between the WCF service and the public-facing Web site (the Web site is a consumer/client of the service). A few test certs...
<p>For anonymouse public access use basichttpbinding and also have the following in the web.config file <br> <br> </p>
44,944
<p>I continually get these errors when I try to update tables based on another table. I end up rewriting the query, change the order of joins, change some groupings and then it eventually works, but I just don't quite get it.</p> <p>What is a 'multi-part identifier'?<br> When is a 'multi-part identifier' not able to b...
<p>A multipart identifier is any description of a field or table that contains multiple parts - for instance MyTable.SomeRow - if it can't be bound that means there's something wrong with it - either you've got a simple typo, or a confusion between table and column. It can also be caused by using reserved words in you...
<p>I had exactly the same issue, and similar to your coding I had missed out the <strong>FROM</strong> field, once it is added, the query knows what table to read the data from</p>
25,304
<p>I want to programmatically invoke an event handler for a control. For example:</p> <pre><code>DateTimePicker dtpLastConsummated; </code></pre> <p>I want to trigger the TextChanged event handler for the <code>dtpLastConsummated</code>, how can i do it?</p> <p>In other languages I would call something akin to:</p> ...
<p>3 suggestions to fire the TextChanged Event:</p> <p>Manually change the text: </p> <pre><code> string s = dateTimePicker1.Text; dateTimePicker1.Text = String.Empty; dateTimePicker1.Text = s; </code></pre> <p>or </p> <p>Inherit from DateTimePicker and create a new method that exposes / ca...
<p><strong>Following code helped me to fire event</strong></p> <pre><code>ddlTopic_SelectedIndexChanged(this, new EventArgs()); </code></pre> <p><strong>Actual Event</strong></p> <pre><code>private void ddlTopic_SelectedIndexChanged(object sender, EventArgs e) { // do something } </code></pre>
48,765
<p>I am trying to convert a working MS Access query to run on an Oracle database being accessed via VB Script (.asp). This is the last section of the WHERE clause:</p> <pre><code>sql = sql &amp; "WHERE (UAT.HB.MB_MODE = 'A' AND UAT.HB.PRINT_DATE &gt;= '" &amp; SD &amp; "' AND UAT.HB.PRINT_DATE &lt;= '" &amp; ED &a...
<p>In Oracle, your date should be written as an ANSI date literal like this:</p> <pre><code>DATE '2008-11-11' </code></pre> <p>Or converted to a date from a string like this:</p> <pre><code>TO_DATE('11/11/2008', 'MM/DD/YYYY') </code></pre> <p>See <a href="https://docs.oracle.com/database/121/SQLRF/sql_elements003.h...
<p>The default date format for Oracle is "dd-mon-yy". You can do a TO_CHAR function on the date field to convert it to a format you prefer to match on.</p>
38,420
<p>I work in an organization that relies heavily on technology standards. For the most past this is great and helps provide direction to developers and helps them move across teams really easily.</p> <p>However in the past year I have discovered more effective ways of doing things using new technologies and I am stru...
<p>With permission, offer to do a small project using the new technologies. Demonstrate its value and that it works.</p>
<p>If what you make ends up being supported by a group of people other than yourself you need to live with Standards. Can you imagine open source being developed without standards?</p>
39,972
<p>I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net website to allow users to upload files. For those unfamiliar, the uploader works by using a Flash applet to give me more control over the FileOpen dialog. I can specify a filter for file types, allow multiple files to be selected, etc. It's g...
<p><a href="http://swfupload.org/forum/generaldiscussion/98" rel="noreferrer">Here</a> is a post from the maintainer of <a href="http://swfupload.org" rel="noreferrer">SWFUpload</a> which explains how to load the session from an ID stored in Request.Form. I imagine the same thing would work for the Yahoo component.</p>...
<p>The ASP.Net Session ID is stored in <code>Session.SessionID</code> so you could set that in a hidden field and then post it to the next page.</p> <p>I think, however, that if the application restarts, the sessionID will expire if you do not <a href="http://support.microsoft.com/kb/317604" rel="nofollow noreferrer">...
6,495
<p>I have the following method in my unit test project:</p> <pre><code> [TestMethod] [HostType("ASP.NET")] [UrlToTest("http://localhost:3418/Web/SysCoord/ChooseEPA.aspx")] [AspNetDevelopmentServerHost("%PathToWebRoot%")] public void TestMethod1() { Page page = TestContext.RequestedPage; ...
<p>I've had this problem before and at that point gave up after reading all I could google about it (including this thread).</p> <p>The solution turned out to be simple in my case. All I had to do was not use ASP.NET test attributes and simply test the MVC project as a DLL.</p> <h3>Step 1</h3> <p>Remove the extra at...
<p>I have faced same problem with unit testing. And found the problem reason and also solve it. The problem is only with access rights for the directory.</p> <p>In my case I have installed VSTS on the different drive(d) then default. So only to give the full access rights to the user <strong>PCNAME\ASPNET</strong> for...
32,554
<p>One of our providers are sometimes sending XML feeds that are tagged as UTF-8 encoded documents but includes characters that are not included in the UTF-8 charset. This causes the parser to throw an exception and stop building the DOM object when these characters are encountered:</p> <pre><code>DocumentBuilder.pars...
<p>if the problem truly is the wrong encoding (as opposed to a mixed encoding), you don't need to re-encode the document to parse it. just parse it as a Reader instead of an InputStream and the dom parser will ignore the header:</p> <pre><code>DocumentBuilder.parse(new InpputSource(new InputStreamReader(inputStream, ...
<p>You should tell them to send you correct UTF-8. Failing that any solution should reencode the bad characters as valid UTF-8 then pass it to the parser. The reason for this is that if the bad characters are preserved then different programs might interpret any output different ways, which can lead to security holes.<...
26,666
<p>I have sets of values in rows in Excel First row contains weights of how much each value in each column contributes to weighted total. Now, I want to mark in each following row the value that contributed to the weighted total the most, by changing its background. I played with conditional formatting, but my Excel sk...
<p>Assuming the weights are in A1:C1 and the values are in A2:C2, enter =MAX($A$1:$C$1*$A2:$C2)/A$1 as the 'equals' condition for A2</p> <p><a href="http://www.vulomedia.com/images/12339ExcelConditionalFormatting.jpg" rel="nofollow noreferrer">alt text http://www.vulomedia.com/images/12339ExcelConditionalFormatting.j...
<p>Here's what I think you are trying to do: You have a list of numbers (they happen to be weights, but that's not important). You want the largest number to be highlighted differently.</p> <p>Suppose the cells are in the range A1:A8.</p> <ol> <li>Select the range A1:A8.</li> <li>Select Conditional Formatting (Format...
26,670
<p>How is it possible to get the FxCop custom dictionary to work correctly?</p> <p>I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the 'Identifiers should be spelled correctly' FxCop m...
<p>If you use it inside Visual Studio...</p> <p>From <a href="http://blogs.msdn.com/fxcop/archive/2007/08/20/new-for-visual-studio-2008-custom-dictionaries.aspx" rel="noreferrer">Visual Studio Code Analysis Team Blog</a></p> <blockquote> <p>To add a custom dictionary to a C# and Visual Basic project is simple:</p...
<p>I didn't have to set <em>Build Action</em> to be <em>CodeAnalysisDictionary</em>. In fact, I didn't even have that as an option (using Visual Studio 2010 Professional). I'm using the <a href="http://fxcopintegrator.codeplex.com/" rel="nofollow">FxCop Integrator</a> extension. It allows you to right-click on the S...
46,859
<p>We use Visual Studio 2008 and Surround SCM for source control. SCM drops files into each directory named ".MySCMServerInfo" which are user specific data files that shouldn't be checked into source control. They are similar to the .scc files dropped by Visual Source Safe. We also have several WAPs (Web Application ...
<p>I have new information about this issue. Setting the hidden bit on .MySCMServerInfo file causes Surround SCM to loose track of the modification state for files. It starts thinking files are out-of-date when they are not, and it always attemps to get new versions.</p> <p>Instead, set this registry key if you're usin...
<p>Using the file system hidden bit should work.</p>
22,690
<p>Is there a way to invoke an external script or batch file from VC6 (and later) project files?</p> <p>I have a background process that I need to kill before attempting to build certain projects (DLLS, executables) and haven't found a way to successfully do so from the project itself. I'd like simply to call a batch...
<p>You can create a utility project (configuration type: Utility in the project property pages) that has a post build event. You then call the batch file from that Post-Build event. If I remember correctly, utility configuration appeared in VS2005. But I believe the same can be achieved with another type of configurati...
<p>You could invoke it from a <a href="http://msdn.microsoft.com/en-us/library/e85wte0k(VS.80).aspx" rel="nofollow noreferrer">custom build step or a build event</a>.</p>
25,852
<p>I found two collapsing problems :</p> <ul> <li>You should use the same language between domain experts and development teams (DDD)</li> <li>You should use English for naming in your code (.Net Design guidelines)</li> </ul> <p><em>What if the domain experts don't speak English ?</em></p>
<ul> <li>Speaking the same language between the teams will foster understanding. However, does the DDD item mean literal "language" (tongue), or "terminology"?</li> <li>Using English for coding is a suggestion, not a requirement.</li> <li>As long as your development team can translate the code operation/intent, I don't...
<p>If you ask me you should use native language for business (like customer, order etc) and english for technical terms (like get, set etc). If you start translating your business words, you have to go through a mental step and furthermore you sometimes get two different translations for two things - in other words it'...
49,155
<p>I came across a new Steel infused PLA from <a href="https://colorfabb.com/steelfill" rel="nofollow noreferrer">Colorfabb</a>. On the store page someone had asked, what happens if it was exposed to water, would it rust. I am actually, not sure what would happen. I am interested what the effects of leaving in the elem...
<p>The main issue here (the gaps between layers) was solved by reducing combing.</p> <p>Combing was enabled without a limit on the range so a max combing distance of 10&nbsp;mm was introduced. This prevented too much filament from oozing out during travels.</p> <p>The oozing filament was causing nothing to come out o...
<p>These lines could be caused by a mechanical issue with the printer; it looks as if the positioning is not up to par. </p> <p>This can be related to loose belts of the X-axis and Y-axis, or play in your system, e.g. look at the rollers of the carriage.</p> <hr> <p><em>I've experienced an issue with play between th...
1,431
<p>I am implementing MVP/M-V-VM in WPF and I'm having good luck with it so far. However, I don't see how this model supports implementing Modal dialog boxes. I've derived my work from Crack.NET (<a href="http://www.codeplex.com/cracknetproject" rel="nofollow noreferrer">http://www.codeplex.com/cracknetproject</a>) to...
<p>Perhaps this is not the appropriate way to look at it, but this is the approach I take with M-V-VM in WPF. Opening windows and dialog boxes or an "EditPreferences" view are UI specific functions. If I were to rewrite the your entire UI replacing all of the views, I may wind up combining the "EditPreferences" view wi...
<p>My 2 cents is:</p> <ol> <li><p>Pass some kind of viewfactory contract as the command parameter or inject a viewfactory contract into the view model. The view model will them use the viewfactory to create any modal/non modal views it needs. The viewfactory could also take in as a parameter of its Show/ShowModal meth...
40,687
<p>When compressing a string "stream" the '/r' gets stripped out from '/r/n'. I am using the ICSharp.zip library for compression. Has any one else faced this problem, and if you have is there is a workaround?</p>
<p>Does your zip library have a parameter to treat the stream as either text or binary? It sounds like it's treating it as text and is changing the line-end delimiter (some apps do this to try and make sure it matches the target platform). If you can tell it to treat the data as binary it might help.</p>
<p>Try DotNetZip.<br> It's a managed-code library, doesn't have problems with CR/LF translation. fee. open source.</p> <p><a href="http://www.codeplex.com/DotNetZip" rel="nofollow noreferrer">DotNetZip on CodePlex</a></p>
12,836
<p>I would like to do a lookup of tables in my SQL Server 2005 Express database based on table name. In <code>MySQL</code> I would use <code>SHOW TABLES LIKE "Datasheet%"</code>, but in <code>T-SQL</code> this throws an error (it tries to look for a <code>SHOW</code> stored procedure and fails).</p> <p>Is this possibl...
<p>This will give you a list of the tables in the current database:</p> <pre><code>Select Table_name as "Table name" From Information_schema.Tables Where Table_type = 'BASE TABLE' and Objectproperty (Object_id(Table_name), 'IsMsShipped') = 0 </code></pre> <p>Some other useful T-SQL bits can be found here: <a href="h...
<p>I know this is an old question but I've just come across it.</p> <p>Normally I would say access the information_schema.tables view, but on finding out the PDO can not access that database from a different data object I needed to find a different way. Looks like <code>sp_tables 'Database_Name</code> is a better way ...
15,105
<p>Are there any "all-in-one" installers for php + mysql on iis? Preferably with a gui configuration interface.</p>
<p>The PHP part is easy with Web Platform Installer: </p> <p><a href="http://php.iis.net/" rel="nofollow noreferrer">http://php.iis.net/</a></p> <p>MySQL is a breeze to install on Windows:</p> <p><a href="http://dev.mysql.com/downloads/mysql/5.1.html#win32" rel="nofollow noreferrer">http://dev.mysql.com/downloads/my...
<p>I know this is not a direct answer, but a <strong><em>point of interest only</em></strong>. If you are looking for something that runs php/mysql that is quick to get setup for testing purposes you could try using a <a href="http://virtualappliances.net/products/lamp.php" rel="nofollow noreferrer">virtual appliance</...
22,534
<p>I'm using namespaces in a project and Eclipse PDT, my IDE of choice, recognizes them as syntax errors. Not only it renders its convenient error checking unusable, but it also ruins Eclipse's PHP explorer.</p> <p>5.3 features are coming to PDT 2.0 scheduled for release in December. Are there any alternatives for the...
<p>Some threads that have been addressed by the various PHP IDE developers regarding the status of 5.3 syntax support:</p> <ul> <li><strong>PHPEclipse</strong>: <a href="http://www.phpeclipse.net/ticket/636" rel="nofollow noreferrer">http://www.phpeclipse.net/ticket/636</a> or <a href="http://www.google.com.au/search?...
<p>Have you tried Aptana Studio or the Aptana plugin for Eclipse? I'm not sure if the Aptana plugin supports PHP, but Aptana Studio does. That might have what you are looking for.</p>
8,790
<p>The word seems to get used in a number of contexts. The best I can figure is that they mean a variable that can't change. Isn't that what constants/finals (darn you Java!) are for?</p>
<p>An invariant is more "conceptual" than a variable. In general, it's a property of the program state that is always true. A function or method that ensures that the invariant holds is said to maintain the invariant.</p> <p>For instance, a binary search tree might have the invariant that for every node, the key of th...
<p>The ADT invariant specifes relationships among the data fields (instance variables) that must always be true before and after the execution of any instance method.</p>
13,722
<p>I have an existing application that is written in C++ for Windows. This application uses the Win32 CryptoAPI to generate a TripleDES session key for encrypting/decrypting data. We're using the <a href="http://www.phdcc.com/cryptorc4.htm" rel="nofollow noreferrer">exponent of one trick</a> to export the session key o...
<h2>Intro</h2> <p>I'm Finally getting around to posting the solution. I hope it provides some help to others out there that might be doing similar type things. There really isn't much reference to doing this elsewhere.</p> <h2>Prerequisites</h2> <p>In order for a lot of this to make sense it's necessary to read the ...
<p>Ok, forget the last answer I can't read :) You are working with 3Des keys not RSA keys.</p> <p>I worked on a bunch of code to share keys between .NET, CryptoAPI and openssl. Found a lot of good example code here for doing the key conversions: </p> <p><a href="http://www.jensign.com/JavaScience/cryptoutils/index.ht...
7,169
<p>For those who haven't read Code Complete 2, the Pseudocode Programming Process is basically a way to design a routine by describing it in plain English first, then gradually revise it to more detailed pseudocode, and finally to code. The main benefit of this is to help you stay at the right level of abstraction by b...
<p>My team mixes both approaches and it's an awesome way to develop (at least for us). We need unit tests because we have a large and complex software system. But the Pseudocode Programming Process is hands-down the best approach to software design I've come across. To make them work together:</p> <ul> <li>We start by...
<p>For me TDD has an ace pseudocoding just can't compete with - both help you abstract and plan the development, but once you're finished development in TDD land <em>you still have the unit tests</em>. </p> <p>AS useful an approach as CC2 described pseudocoding is, it just can't match that. TDD is only half about desi...
20,400
<p>we're currently generating all our official documents using XSL-FO transformation using .xml files as input and generating .pdfs &amp; basically all the content within these .xml's is either plain text or xhtml. This works perfectly fine for every-day use-cases, but some of our users refer to Microsoft Excel files w...
<p>You could convert the Excel file to a PDF and then merge the resulting documents. Its not a direct through XSL-FO processing though.</p> <p>Personally, I wouldn't even try to store the Excel file inside the PDF, I would link to it from the PDF. Excel is closed, very complicated and for the parts that are open (the ...
<p><a href="https://www.windwardstudios.com/" rel="nofollow noreferrer">Windward Docgen</a> does exactly what you want. With Windward you design your documents in Word, Excel, or PowerPoint and then our engine merges that template with the data to create the final document. The engine is available in Java and .NET and ...
35,748
<p>I just recently purchased a new MightyBoard (Rev G) for my Replicator that requires a new power supply. </p> <p>The power supply for the Rev E was a 24&nbsp;V/9.2&nbsp;A which was necessary for the dual extruders and heated bed. I know I need a 24&nbsp;V power supply, but should I be concerned about the amperage? W...
<p>I suggest looking at the maximum amperage draw for all components that could be on at one time, and then find a power supply that can supply at least 20% more current. You would never want to get a supply rated for lower current than your max draw, because then it will affect the torque or your motors, or the tempe...
<p>A short, figurative answer from the electronical point of view:</p> <p>A <strong>power supply</strong> (an an analogy you can view it as a water pump) as used by 3D printers is usually supplying a fixed <strong>voltage</strong> (a constant pressure going into your pipe system), in your case 24V.</p> <p>The given <...
262
<p>Does anyone know of a good Java API for controlling RS-232 devices in a WIN32 enviroment? I've tried RXTX but they don't support RS232, only RS-485.</p>
<p>Without reservation, I recommend Java Serial Port from <a href="http://serialio.com" rel="nofollow noreferrer">serialio.com</a>. I had significant stability problems with the Sun, IBM and RxTx serial packages. SerialPort has been rock solid in production for over 2 years 24/7.</p> <p>They support the standard Java...
<p>Have you tried <a href="http://java.sun.com/products/javacomm/" rel="nofollow noreferrer">Javacomm</a> from Sun?</p>
33,128
<p>I have a table in a MSSQL database that looks like this:</p> <pre><code>Timestamp (datetime) Message (varchar(20)) </code></pre> <p>Once a day, a particular process inserts the current time and the message 'Started' when it starts. When it is finished it inserts the current time and the message 'Finished'.</p> <p...
<pre><code>Select Count(Message) As Status From Process_monitor Where TimeStamp &gt;= '20080923' And TimeStamp &lt; '20080924' And (Message = 'Started' or Message = 'Finished') </code></pre> <p>You could modify this slightly to detect invalid conditions, like multiple starts, finishes, starts without ...
<pre><code>select count(*) from process_monitor where timestamp &gt; yesterday and timestamp &lt; tomorrow. </code></pre> <p>Alternately, you could use a self join with a max to show the newest message for a particular day:</p> <pre><code>select * from process_monitor where timestamp=(select max(timestamp) where ti...
14,835
<p>As our PHP5 OO application grew (in both size and traffic), we decided to revisit the __autoload() strategy.</p> <p>We always name the file by the class definition it contains, so class Customer would be contained within Customer.php. We used to list the directories in which a file can potentially exist, until the ...
<p>I've also been playing with autoload for quite some time, and I ended up implementing some sort of namespaced autoloader (yes, It works also for PHP5.2).</p> <p>The strategy is quite simple: First I have a singleton class (loader) which has a call that simulates <code>import</code>. This call takes one parameter (t...
<p>Have you investigated using <a href="http://framework.zend.com/manual/en/zend.loader.html" rel="nofollow noreferrer">Zend_Loader</a> (with <a href="http://framework.zend.com/manual/en/zend.loader.html#zend.loader.load.autoload" rel="nofollow noreferrer">registerAutoload()</a>) instead of just the native <code>__auto...
46,949
<p>How can I go through all external links in a div with javascript, adding (or appending) a class and alt-text?</p> <p>I guess I need to fetch all objects inside the div element, then check if each object is a , and check if the href attributen starts with http(s):// (should then be an external link), then add conten...
<p>This one is tested:</p> <pre><code>&lt;style type="text/css"&gt; .AddedClass { background-color: #88FF99; } &lt;/style&gt; &lt;script type="text/javascript"&gt; window.onload = function () { var re = /^(https?:\/\/[^\/]+).*$/; var currentHref = window.location.href.replace(re, '$1'); var reLocal = new RegEx...
<p>This can be accomplished pretty easily with <a href="http://www.jquery.com" rel="nofollow noreferrer">Jquery</a>. You would add this to the onload:</p> <pre><code>$("div a[href^='http']").each(function() { $(this).attr("alt",altText); var oldClassAttributeValue = $(this).attr("class"); if(!oldClassAttributeVa...
37,011
<p>I have been trying to extract last six numbers of an URL in each line of the original text and add it to another code that must be added to the result text. There also need to remove some code of each line from the original text and replace it with new code in the result text.</p> <p>input <a href="http://riyajr.go...
<p>Yes, lots. It is a basic application for any scripting language - Perl or Python or ...</p>
<p>php:</p> <pre><code>$infile = "in.txt"; $outfile = "out.txt"; foreach (file($url) as $line) { //extract last 6 chars $chars = substr($line, -6); // append the last 6 chars to a outfile file_put_contents($outfile, "$chars\n", FILE_APPEND); } </code></pre> <p>Note this isn't doing any regular expr...
47,495
<p>I have updated my ant build.xml file to include a new file and a new folder. After creating the .jar I check if they exist in the jar by 'unzip\extract', and they are there.</p> <p>But when executing the .jar neither the folder or the file gets extracted.</p> <p>Am I missing a step?</p>
<p>Your application should be able to use the file directly from within the jar, no need for extracting it. Or do you mean something else?</p>
<p>If you wrap your application up using <a href="http://one-jar.sourceforge.net" rel="nofollow noreferrer">One-JAR</a>, you can specify an attribute in the Manifest file to extract files that you want (See the <a href="http://one-jar.sourceforge.net/index.php?page=introduction&amp;file=manifest" rel="nofollow norefer...
11,383
<p>I have a problem with a simple included file.</p> <p>The file being included is in two MFC programs - one of which is a dll, and it also compiles itself into a non-mfc dll.</p> <p>Recently I was using the larger dll which wraps around the <em>source</em> of the smaller dll when I wanted access to some of the featu...
<p>This doesn't have anything to do with the way you include files, it's a syntax error that you get because you didn't nest <code>(</code> and <code>)</code> correctly.</p>
<p>The code that is being used:</p> <pre><code>// the only two includes #include &lt;windows.h&gt; #include "spooler.h" // in WinMain // create window then... ShowWindow (hwnd, iCmdShow); UpdateWindow (hwnd); SpoolerInitiallize( hwnd, ID_SPOOLER_EVENT ); // &lt;-- our function ... </code></pre> <p>And yes, I know it...
31,628
<p>I am developing a JSP application and am being forced to load a COM object. Can such a thing can be done?</p> <p>If yes, how?</p>
<p>It is possible using a COM bridge like <a href="http://danadler.com/jacob/" rel="nofollow noreferrer">JACOB</a>.</p> <p>JACOB is a JAVA-COM Bridge that allows you to call COM Automation components from Java. It uses JNI to make native calls into the COM and Win32 libraries. </p>
<p>If you need to use the COM object within the Java side of things (i.e. server), you will need something like <a href="http://j-integra.intrinsyc.com/" rel="nofollow noreferrer">J-Integra</a> or <a href="http://www.teamdev.com/jniwrapper/index.jsf" rel="nofollow noreferrer">JNI Wrapper</a>. There are several open-sou...
31,160
<p>For debugging and testing I'm searching for a JavaScript shell with auto completion and if possible object introspection (like ipython). The online <a href="http://www.squarefree.com/shell/" rel="nofollow noreferrer">JavaScript Shell</a> is really nice, but I'm looking for something local, without the need for an br...
<p>Rhino Shell since 1.7R2 has support for completion as well. You can find more information <a href="http://blog.norrisboyd.com/2009/03/rhino-17-r2-released.html" rel="noreferrer">here</a>.</p>
<p><a href="http://code.google.com/p/jslibs/" rel="nofollow">jslibs</a> (a standalone javascript runtime) could also be suitable for this purpose.</p>
6,250
<p>I've been involved in embedded operating systems of one flavor or another, and have generally had to work with whatever the legacy system had. Now I have the chance to start from scratch on a new embedded project.</p> <p>The primary constraints on the system are:</p> <ul> <li>It needs a web-based interface.</li> ...
<p>It all depends on how much time was allocated for your team has to learn a "new" RTOS.<br> Are there any reasons you don't want to use something that people already have experience with?</p> <p>I have plenty of experience with vxWorks and I like it, but disregard my opinion as I work for WindRiver.</p> <p>uC/OS II...
<p>I have been pretty happy with Windows CE, although it is 'heavier'.</p>
13,770
<p>I've never gotten a 3D printer, nor do I know very much about them, but I'm thinking of buying a delta 3D printer kit for around $450. When I looked online of some disadvantages of Delta printers I found that they typically don't have Bowden extruders. I'm wondering what are the advantages of a Bowden extruder and s...
<p>My FLSUN Kossel 3D Delta printer ($224) has a bowden extruder. It works really well too.</p> <p>The main advantage of having one is that it reduces the mass of the hot end. That means less inertia, and it's easier on the driver motors as well. All this leads to (hopefully) greater and more precise control at the ex...
<p>The only advantage of Bowden extruder is a reduced mass of moving parts attached to the effector.</p> <p>All other differences from direct extruder are to the Bowden's disadvantages. Generally speaking, Bowden-type extruder has much worse control of filament extrusion than direct one.</p> <p>Since most of the mode...
561
<p>I'm trying to install a service using InstallUtil.exe but invoked through <code>Process.Start</code>. Here's the code:</p> <pre><code>ProcessStartInfo startInfo = new ProcessStartInfo (m_strInstallUtil, strExePath); System.Diagnostics.Process.Start (startInfo); </code></pre> <p>where <code>m_strInstallUtil</code> ...
<p>You can indicate the new process should be started with elevated permissions by setting the Verb property of your startInfo object to 'runas', as follows:</p> <pre><code>startInfo.Verb = "runas"; </code></pre> <p>This will cause Windows to behave as if the process has been started from Explorer with the "Run as Ad...
<p>You should use Impersonation to elevate the state.</p> <pre><code>WindowsIdentity identity = new WindowsIdentity(accessToken); WindowsImpersonationContext context = identity.Impersonate(); </code></pre> <p>Don't forget to undo the impersonated context when you are done.</p>
16,147
<p>My lack of C++ experience, or rather my early learning in garbage collected languages is really stinging me at the moment and I have a problem working with strings in C++.</p> <p>To make it very clear, using std::string or equlivents is not an option - this is char* 's all the way.</p> <p>So: what I need to do is ...
<p>Since std::string is not an option, for whatever reason, have you looked into smart pointers? See <a href="http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/smart_ptr.htm" rel="nofollow noreferrer">boost</a></p> <p>But I can only encourage you to use std::string.</p> <p>Christian</p>
<p>I'm not totally clear on where LoadAndSetupData is defined, but it looks like it's keeping its own copy of the string. So then you should delete your locally allocated copy after the call to LoadAndSetupData and let it manage its own copy.</p> <p>Or, make sure LoadAndSetupData cleans up the allocated char[] that yo...
35,153
<p>For example:</p> <pre><code>char * myString = malloc(sizeof(char)*STRING_BUFFER_SIZE); free(myString); free(myString); </code></pre> <p>Are there any adverse side effects of doing this? </p>
<p>Here's the chapter and verse.</p> <blockquote> <p>If the argument [to the <code>free</code> function] does not match a pointer earlier returned by the <code>calloc</code>, <code>malloc</code>, or <code>realloc</code> function, or if the space has been deallocated by a call to <code>free</code> or <code>realloc<...
<p><strong>Another interesting situation:</strong></p> <pre><code>char * myString = malloc(sizeof(char)*STRING_BUFFER_SIZE); char * yourString = myString; if (myString) { free(myString); myString = NULL; } // Now this one is safe, because we keep to the rule for // setting pointers to NULL after deletion ......
16,408
<p>How can you get castle Windsor to choose the right implantation of a interface at run time when you have multiple implementations in the container.</p> <p>For example lets say i have a simple interface called IExamCalc that does calculations to work out how someone did in that exam.</p> <p>No we have several imple...
<p>As David said, you can't, but IHandlerSelector will let you take control. Check out the tests to get an idea of how to use them: <a href="https://svn.castleproject.org/svn/castle/trunk/InversionOfControl/Castle.Windsor.Tests/HandlerSelectorsTestCase.cs" rel="noreferrer">https://svn.castleproject.org/svn/castle/trun...
<p>The short answer is, you can't. This kind of choice is dependent on application code, so if you just did <code>container.Resolve&lt;IExamCalc&gt;</code>, then Windsor couldn't know which one you wanted.</p> <p>The question to ask is how do <em>you</em> know which type to use?</p>
40,464
<p>I don't think this is possible, but I'll ask anyway...</p> <p>Is there some way to set the color and font to be used for class member variables in the editor? I just returned to C++ and Visual Studio after being in the Java world for the past 4 years and I'm <i>really</i> missing Jetbrains' IDEA (a killer Java IDE)...
<p>Not in VS 2008. At PDC we saw a preview of VS 2010 which supposedly will allow for multiple fonts.</p>
<p>Not in VS 2008. At PDC we saw a preview of VS 2010 which supposedly will allow for multiple fonts.</p>
49,711
<p>What is the preferred way to open a URL from a thick client application on Windows using C# and the .NET framework? I want it to use the default browser.</p>
<p>The following code surely works:</p> <pre><code>Process.Start("http://www.yoururl.com/Blah.aspx"); </code></pre> <p>It opens the default browser (technically, the default program that handles HTTP URIs).</p>
<pre><code>System.Diagnostics.Process.Start("http://www.stackoverflow.com"); </code></pre>
11,945
<p>An interesting issue came up recently. We came across some code that is using <code>hashCode()</code> as a salt source for MD5 encryption but this raises the question: will <code>hashCode()</code> return the same value for the same object on different VMs, different JDK versions and operating systems? Even if its ...
<p>No. From <a href="http://tecfa.unige.ch/guides/java/langspec-1.0/javalang.doc1.html" rel="noreferrer">http://tecfa.unige.ch/guides/java/langspec-1.0/javalang.doc1.html</a>:</p> <blockquote> <p>The general contract of hashCode is as follows:</p> <ul> <li>Whenever it is invoked on the same object more than...
<p>I would like to add that you can override hashCode() (don't forget equals() if you do that) to make sure your business objects return the same hashCode everywhere. Those objects will then at least have a predictable hashCode.</p>
23,102
<p>We have the usual <strong>web.xml</strong> for our web application which includes some jsp and jsp tag files. I want to switch to using pre-compiled jsp's. I have the pre-compilation happening in the build ok, and it generates the web.xml fragment and now I want to merge the fragment into the main web.xml.</p> <p...
<p>I use the <a href="http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html" rel="nofollow noreferrer">Tomcat jasper ANT tasks</a> in my project, which precompile the JSPs into servlets and add the new servlet mappings to the original web.xml. In the DEV builds, just skip this step and deploy the JSPs without pre-...
<p>There is the <strong>jasper2</strong> ant task others have noted. I thought I'd mention a couple of other options I've found.</p> <p>One is cactus' <strong>webxmlmerge</strong> ant task, which uses org.codehaus.cargo.module.webapp.WebXmlMerger </p> <p>Another would be to use <strong>JAXB</strong> to manipulate th...
19,602
<p>I am working on a calculator that allows you to perform calculations past the decimal point in octal, hexadecimal, binary, and of course decimal. I am having trouble though finding a way to convert floating point decimal numbers to floating point hexadecimal, octal, binary and vice versa. </p> <p>The plan is to do ...
<p>Hmm... this was a homework assignment in <em>my</em> university's CS "weed-out" course.</p> <p>The operations for binary are described in <em>Schaum's Outline Series: Essential Computer Mathematics</em> by Seymour Lipschutz. For some reason it is still on my bookshelf 23 years later.</p> <p>As a hint, convert oct...
<p>I had this same problem a few days ago. I found <a href="http://www.binaryconvert.com" rel="nofollow noreferrer">http://www.binaryconvert.com</a>, which allows you to convert between floating point decimal, binary, octal, and hexadecimal in any order you want. </p>
42,022
<p>Quite a while ago, I heard about Object databases. Cool concept and all. Now, with the event of ORMs everywhere, does anyone still use any of the Object oriented Databases systems? Are they relevant? Are they practical?</p>
<p>OO databases never got out of a niche market. They are good for some applications - where the data structure lends itself to being represented by an object graph - but never held the compelling advantage over a RDBMS to cross the chasm. The key advantage touted for OODBMS products is the tight integration to the ...
<p>At least from my point of view they are pretty much dead. But then again I'm working primarily in commercial software. Maybe in academic areas they are still in use somewhere.</p>
46,007