instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>When including a header file in C++, what's the difference between...</p>
<ol>
<li><p>including the <em>.h</em> part versus not including <em>.h</em> part when wrapping it in <em><></em> signs?</p>
<p>#include <iostream> vs. #include <iostream.h></p>
</li>
<li><p>wrapping the header name in double ... | <p>In short:</p>
<p><code>iostream.h</code> is deprecated—it is the original Stroustrup version. <code>iostream</code> is the version from the standards committee. Generally, compilers point them both to the same thing, but some older compilers won't have the older one. In some odd cases, they will both exist ... | <p>The compiler is free to add a missing ".h" (or whatever it wants) to a standard header name in order to determine the name of the actual disk file to read, if the compiler indeed gets standard headers from actual disk files. So the user program can say "#include <iostream>" and the compile... | 26,337 |
<p>Since C# is in many ways a direct derivative of Java I wondered whether there was any advantage to learning Java after the fact of having learnt quite a reasonable about about C#?</p>
<p><strong>Note:</strong> Please provide clear, direct advice rather than discussion in order to keep in line with SO guidelines.</p... | <p>If you want to program in Java, learn Java. It really is that simple.</p>
<p>The patterns, algorithms, and design ideas aren't going to be different enough that learning the language on its own is reward enough.</p>
<p>However, Java runs acceptably well on vastly more platforms than does C# (though with mono that... | <p>Absolutely. A lot of jobs want java specifically. Having learnt Java and being able to put it convincingly on your resume means you wont have to wrangle with HR and recruiters who do not have that much clue.</p>
<p>And since both are more or less same except in a few places, its a very good return on investment. No... | 15,095 |
<p>In my database, I have a model which has a field which should be selected from one of a list of options. As an example, consider a model which needs to store a measurement, such as 5ft or 13cm or 12.24m3. The obvious way to achieve this is to have a decimal field and then some other field to store the unit of measur... | <p>Have you seen <a href="http://github.com/vigetlabs/constant_cache/tree/master" rel="nofollow noreferrer">constant_cache</a>? It's sort of the combination of the best of 1 and 2 - lookup data is stored in the DB, but it's exposed as class constants on the lookup model and only loaded at application start, so you don'... | <p>Do you need to perform lookups on these values? If not, you could as well store them as a string and parse the string later on in the application that reads the values. While you risk storing unparseable data, you gain speed and reduce DB complexity. Sometimes normalizing a database is not helpful. In the end /somet... | 14,629 |
<p>Is it possible to call a function from PHP using <code>onsubmit</code> from JavaScript? If so could someone give me an example of how it would be done?</p>
<pre><code>function addOrder(){
$con = mysql_connect("localhost", "146687", "password");
if(!$con){
die('Could not connect: ' . mysql_error())
... | <h2>You can not call a PHP function from Javascript...</h2>
<p>Javascript is a client language (it's executed on the Web browser, after receiving the web page) while PHP is on the server side (it's executed before the web page is rendered). You have no way to make one call another.</p>
<h2>...but you can get the resu... | <p>Yes, another great and easy tutorial for learning ajax is:</p>
<p><a href="http://24ways.org/2005/easy-ajax-with-prototype/" rel="nofollow noreferrer">http://24ways.org/2005/easy-ajax-with-prototype/</a></p>
<p>Prototype is another thing I recommend if you havent gone to far with your project and need to revert a ... | 27,286 |
<p>I have the source of a program (taken from cvs/svn/git/...) and I'd like to build a Debian/Ubuntu package for it. The package is present in the repositories, but:</p>
<ul>
<li>It is an older version (lacking features I need)</li>
<li>I need slightly different compile options than the default.</li>
</ul>
<p>What is... | <p>you can use the special package "checkinstall" for all packages which are not even in debian/ubuntu yet.</p>
<p>You can use "uupdate" (<code>apt-get install devscripts</code>) to build a package from source with existing debian sources:</p>
<p>Example for libdrm2:</p>
<pre><code>apt-get build-dep libdrm2
apt-get ... | <p><a href="http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/" rel="nofollow noreferrer">Here</a> is a tutorial for building a Debian package.</p>
<p>Basically, you need to:</p>
<ol>
<li>Set up your folder structure</li>
<li>Create a <strong>control</strong> file</li>
<li>Optionally create <stro... | 15,897 |
<p>I am consuming the Twitter API and want to convert all URLs to hyperlinks. </p>
<p>What is the most effective way you've come up with to do this?</p>
<p>from</p>
<pre><code>string myString = "This is my tweet check it out http://tinyurl.com/blah";
</code></pre>
<p>to</p>
<pre><code>This is my tweet check it out... | <p>Regular expressions are probably your friend for this kind of task:</p>
<pre><code>Regex r = new Regex(@"(https?://[^\s]+)");
myString = r.Replace(myString, "<a href=\"$1\">$1</a>");
</code></pre>
<p>The regular expression for matching URLs might need a bit of work.</p>
| <p>/cheer for RedWolves</p>
<blockquote>
<p>from: this.replace(/[A-Za-z]+://[A-Za-z0-9-<em>]+.[A-Za-z0-9-</em>:%&\?/.=]+/, function(m){...</p>
<p>see: /[A-Za-z]+://[A-Za-z0-9-<em>]+.[A-Za-z0-9-</em>:%&\?/.=]+/</p>
</blockquote>
<p>There's the code for the addresses "anyprotocol"://"anysubdomain/domain"... | 5,260 |
<p>Using C / C++ socket programming, and the "read(socket, buffer, BUFSIZE)" method. What exactly is the "buffer" I know that char and byte are the same thing, but does it matter how many elements the byte array has in it? Does the buffer need to be able to hold the entire message until the null character?</p>
| <p>BUFSIZE should be equal to the size of your buffer in bytes. read() will stop reading when the buffer is full. Here is an example:</p>
<pre><code>#define MY_BUFFER_SIZE 1024
char mybuffer[MY_BUFFER_SIZE];
int nBytes = read(sck, mybuffer, MY_BUFFER_SIZE);
</code></pre>
| <p>Your sockets implementation doesn't require the buffer, to be big enough, to hold the entire message for sure, but it might be convenient depending on, what You are doing.</p>
| 17,288 |
<p>Is there an easy way in either language to generate a large set of random data quickly so far all the functions I've tried haven't worked too well when I need to generate a group of say 500,000 characters :( Any ideas?</p>
| <blockquote>
<p>Use UUIDGen.</p>
</blockquote>
<p>Don't. GUIDs aren't really random. You can actually generate large amounts of data very fast using the <code>System.Random</code> class in VB.NET. 500,000 characters/bytes are no problem:</p>
<pre><code>Dim buffer As Byte() = Nothing
Array.Resize(buffer, 500000)
Cal... | <p>Use <a href="http://msdn.microsoft.com/en-us/library/ms526809(EXCHG.10).aspx" rel="nofollow noreferrer">UUIDGen</a>. At least the chunks will be bigger.</p>
| 43,087 |
<p>I'm <em>considering</em> migrating my c# application from using custom GDI+ drawn controls to a WPF application with custom controls etc. I would like to know what's involved and what to expect.</p>
<p>Are there any resources people can recommend that might help? Or indeed any personal experiences that might be ben... | <p><em>(I apologize in advance for the long post ... there was just so much I wanted to convey ... I hope it helps you.)</em></p>
<p>This is what we are doing now (migrating a Windows Forms application with heavy use of custom (GDI+) drawn controls to WPF). In fact, my role on the team was to build these GDI+ controls... | <p>This is actually a project i am working on at the moment although I have been lucky enough to be able to start again. If you can do this I would strongly recommend it, obviously keeping the core functionality of the old system/controls but start afresh. It is always nice to start from a base and to know where things... | 34,174 |
<p>I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solut... | <p>I remember reading an article that may be of help to you: <em><a href="http://home.pipeline.com/~hbaker1/CheneyMTA.html" rel="noreferrer">Cheney on the M.T.A.</a></em> :-)</p>
<p>Some implementations of Scheme I know of, such as <a href="http://sisc.sourceforge.net/" rel="noreferrer">SISC</a>, allocate their call f... | <p>Use an explicit stack instead.</p>
| 2,824 |
<p>Is there a stand-alone GUI designer that can read and write the .form files that NetBeans (Matisse) generates? I like the GUI designer, but I don't want all the overhead of a complete Java IDE just to create and edit .form XML files.</p>
| <p>You could check out <a href="http://www.jformdesigner.com/" rel="nofollow noreferrer">JFormDesigner</a>. I know it can import Netbeans .form files, but I'm not sure how it works vice versa. Available both as stand-alone and as plug-in to severals IDEs.</p>
| <p>There are probably none available. The form editor has several features that are not trivial to implement, such as custom controls and code.<br>
It's simply to complex and not useful enough.</p>
| 33,056 |
<p>I had telephone interview question yesterday.
The interviewer asked me if I had faced any challenging debugging issue?
I told him I once faced a problem debugging someone else's code and it took me 3-4 days to solve that. I used Windbg, symbols and a crash dump to solve the problem.</p>
<p>Now is this enough to tel... | <p>The general rule for interviews is to use the STAR model (my co-op coordinator is going to be proud here...):</p>
<p><b>S</b> - Describe the situation you were in<br />
<b>T</b> - Explain the task, providing enough info so that the interviewer understands the problem.<br />
<b>A</b> - Describe the action you took t... | <p>Interview questions (well, the good ones at least) are not concerned about you telling the knowledge you have, its explaining to the interviewer's satisfaction that you actually do know it. </p>
<p>So, whilst you could explain the full intricacies of windbg, he won't care. He will care that you know what to do and ... | 37,212 |
<p>I'm new to Castle Windsor and am confused about the order in the config file. This is taken from the GettingStarted1 sample. The HttpServiceWatcher class takes an IFailureNotifier implementor in it's constructor. However, no matter how I order the two components that implement this interface -- AlarmFailureNotifi... | <p>This was resolved with Castle 2.0 (that went RTM early last year).</p>
<p>The latest version of Castle is 2.1.1: </p>
<p><a href="http://sourceforge.net/projects/castleproject/files/InversionOfControl/2.1/Castle-Windsor-2.1.1.zip/download" rel="nofollow noreferrer">http://sourceforge.net/projects/castleproject/fil... | <p>I don't know which version you're using, but I believe this was a bug some time ago and it has been corrected in the build server version. Try that one and see what happens.</p>
<p>Also, you could use default components like this: <a href="http://www.nablasoft.com/alkampfer/index.php/2008/05/27/castle-windsor-and-d... | 49,614 |
<p>Is there a way to run a regexp-string replace on the current line in the bash?</p>
<p>I find myself rather often in the situation, where I have typed a long commandline and then realize, that I would like to change a word somewhere in the line.</p>
<p>My current approach is to finish the line, press <kbd>Ctrl</kbd... | <p>G'day,</p>
<p>What about using vi mode instead? Just enter set -o vi</p>
<p>Then you can go to the word you want to change and just do a cw or cW depending on what's in the word?</p>
<p>Oops, forgot to add you enter a ESC k to o to the previous line in the command history.</p>
<p>What do you normally use for an... | <p>G'day,</p>
<p>What about using vi mode instead? Just enter set -o vi</p>
<p>Then you can go to the word you want to change and just do a cw or cW depending on what's in the word?</p>
<p>Oops, forgot to add you enter a ESC k to o to the previous line in the command history.</p>
<p>What do you normally use for an... | 4,788 |
<p>Two users wanted to share the same database, originally written in MS Access, without conflicting with one another over a single MDB file.</p>
<p>I moved the tables from a simple MS Access database to MySQL using its <a href="http://www.mysql.com/products/tools/migration-toolkit/" rel="noreferrer">Migration Toolkit... | <p>I had an application that worked likewise: an MS Access frontend to a MySQL backend. It was such a huge pain that I ended up writing a Win32 frontend instead. From the top of my head, I encountered the following problems:</p>
<ul>
<li>Development of the ODBC link seems to have ceased long ago. There are various dif... | <p>If it's only two users, then Access should do just fine if you put the .mdb on a shared drive.</p>
<p>Have you tried it first rather than just assume it will be a problem. </p>
<p>I believe the recommended max concurrent users for Access is 5 but on occasion I've pushed it past this and never come unstuck.</p>
<p... | 2,767 |
<p>Using MS Access 2007, I am creating a student management database. I have tables for:</p>
<ul>
<li>Students </li>
<li>Courses</li>
<li>CourseSection</li>
</ul>
<p>What I needed is a way to assign students to a course section. So I created a table that links students and sessions:</p>
<ul>
<li>StudentsInSection (c... | <p>Create a form bound to the StudentsInSection table. If you want to be able to edit the students in the section, the easiest thing to do is to use a combo box with a row source based on the Students table with the bound column of the combo box tied to the student ID in the recordset underlying the StudentsInSection f... | <p>The easiest thing you can do is create a sub-form off a main form.
Base the main form off of Students and base the sub-form off of StudentsSection.
On the sub form, add a pull down for selecting the course.</p>
<p>That way the StudentSection will get populated with the StudentID (I assume that's your key) from the... | 38,768 |
<p>My app is installed via NSIS.</p>
<p>I want the installer to install the program for all users.</p>
<p>I can do this, by installing to the 'program files' directory.</p>
<p>There is a database file (firebird), that all user accounts on the system should share. </p>
<p>If I store this database file in the 'progr... | <p>Data for all users should be stored in %ALLUSERSPROFILE%, or call SHGetFolderPath() with the parameter CSIDL_COMMON_APPDATA to get the all users storage area.</p>
<p>See <a href="http://www.deez.info/sengelha/2006/02/28/windows-vista-changes/" rel="nofollow noreferrer">http://www.deez.info/sengelha/2006/02/28/windo... | <p>This is a security hole, see: <a href="http://blogs.msdn.com/oldnewthing/archive/2004/11/22/267890.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2004/11/22/267890.aspx</a></p>
| 13,941 |
<p>How can I have a dynamic variable setting the amount of rows to return in SQL Server? Below is not valid syntax in SQL Server 2005+:</p>
<pre><code>DECLARE @count int
SET @count = 20
SELECT TOP @count * FROM SomeTable
</code></pre>
| <pre><code>SELECT TOP (@count) * FROM SomeTable
</code></pre>
<p>This will only work with SQL 2005+</p>
| <p>Its also possible to use dynamic SQL and execute it with the exec command:</p>
<pre><code>declare @sql nvarchar(200), @count int
set @count = 10
set @sql = N'select top ' + cast(@count as nvarchar(4)) + ' * from table'
exec (@sql)
</code></pre>
| 21,198 |
<p>At work we use <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">WiX</a> for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine.</p>
<p>I've read on several places on the Internet about a major upgrade bu... | <p>In the newest versions (from the 3.5.1315.0 beta), you can use the <a href="http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html" rel="noreferrer" title="Major upgrade">MajorUpgrade element</a> instead of using your own.</p>
<p>For example, we use this code to do automatic upgrades. It prevents d... | <p>This is what worked for me, even with major <strong>DOWN</strong> grade:</p>
<pre><code><Wix ...>
<Product ...>
<Property Id="REINSTALLMODE" Value="amus" />
<MajorUpgrade AllowDowngrades="yes" />
</code></pre>
| 13,935 |
<p>Well, we have a web app, running over JBoss and we're having an "OutOfMemory" error when trying to insert a lot of rows in several tables of a postgres DB.
This is the complete environment for this error:<br/>
* JBoss 4.3.x GA<br/>
* Java 1.6.0<br/>
* Hibernate 3.0<br/>
* postgreSQL-8.3 (driver)<br/>
About actual co... | <p>That sounds like you keep all beans for all 200 documents in memory.</p>
<p>Instead of keeping all the data in RAM the whole time, try to get rid of it as quickly as possible.</p>
<p>So when you are done with reading the data for some bean, persist it and then forget about it (set the object reference to null) exc... | <p>The short answer is more information is required. I suggest using a tool like <a href="http://www.ej-technologies.com/products/jprofiler/overview.html" rel="nofollow noreferrer">JProfiler</a> to help understand where memory is being consumed.</p>
<p>Based on your described design: Why use two pools? If you just ha... | 48,975 |
<p>I've got a Subversion repository, and there are a number of users checking things in and out. However, I also need to frequently check in work for other people. I need to track the original author of the work.</p>
<p>I was considering creating a property in SVN, like "originalauthor", which could track this. In ... | <p>Subversion has two kinds of properties</p>
<ul>
<li>Properties on a file or directory. These properties are versioned</li>
<li>Revision properties. These are specific to the reversion on which they apply.</li>
</ul>
<p>The first type is only usefull if you want all versions of the file to be marked.</p>
<p>To mar... | <p>Why not have a separate branch for all the other users (who need proxies) and then when you review them (I assume you check in on their behalf because they are not allowed to do so) then you promote to the trunk?</p>
<p>I am not sure why the other users are not allowed to check in on their own. PErhaps if you expl... | 37,957 |
<p>I currently have a class and I'm trying to create an easy GUI to create a collection of this class. Most of the attributes of this class are strings. However, one of the attributes I want the user to be able to set is an Enum. Therefore, I would like the user interface, to have a dropdownlist for this enum, to rest... | <p>I do not know if that would work with a DataGridView column but it works with ComboBoxes:</p>
<pre><code>comboBox1.DataSource = Enum.GetValues(typeof(MyEnum));
</code></pre>
<p>and:</p>
<pre><code>MyEnum value = (MyEnum)comboBox1.SelectedValue;
</code></pre>
<p>UPDATE: It works with DataGridView columns too, jus... | <p>Or, if you need to do some filtering of the enumerator values, you can loop through <code>Enum.GetValues(typeof(EnumeratorName))</code> and add the ones you want using:</p>
<pre><code>dataGridViewComboBoxColumn.Items.Add(EnumeratorValue)
</code></pre>
<p>As an aside, rather than using a DataTable, you can set the ... | 8,038 |
<p>I work in the technical department of a design agency. We use XP to manage our department's software development. I have been asked to give a short presentation describing Scrum and whether it would be suitable, in a broader context, for managing <em>client project work</em>.</p>
<p>Scrum would be applied to cross ... | <p>Based on my experience, I would say the key features of Scrum are:</p>
<ul>
<li>High visibility of progress.</li>
<li>Regular feedback from customer.</li>
<li>Predictable rhythm.</li>
<li>Measurable productivity (via burndown, velocity, etc.).</li>
<li>Cross-functional, self-organising teams.</li>
<li>Inspect and a... | <p>Team Spirit
High visibility of progress.
Frequent demonstration and early feedback from stakeholders
Problems are identified early
Quality of product and Improved productivity
Higher customer satisfaction</p>
| 25,574 |
<p>This is an SQL problem I can't wrap my head around in a simple query Is it possible?</p>
<p>The data set is (letters added for ease of understanding):</p>
<pre><code>Start End
10:01 10:12 (A)
10:03 10:06 (B)
10:05 10:25 (C)
10:14 10:42 (D)
10:32 10:36 (E)
</code></... | <p>Assuming you also have (or Create) a table named @Times with one record for each ten minute start time,
How about...</p>
<pre><code> Select T.Start,
(Select Count(*) From testTab
Where Start Between T.Start
And DateAdd(minute, 10, T.Start)) New,
(Select Count(*) From testTab
... | <p>The New and ActiveAtEnd are fairly straightforward (assuming the the period's start and end being stored in temporary variables): </p>
<pre><code>select @periodStart PeriodStart
, @periodEnd PeriodEnd
, n.[new]
, ae.ActiveAtEnd
from (
select count(*) [new]
from @times
where [start] >= @periodStart
and... | 38,723 |
<p>How can i make the inner table to overlap the parent div with 5 px while resizing?</p>
<p>my current solution:</p>
<pre><code><div id="crop">
<table style="width:105%; height:105%;">
//table cells
</table>
</div>
</code></pre>
<p>problem is that it gets smaller when resizing... ... | <p>The folling seems to work nicely in FF3, Chrome and IE7. Though using expressions in CSS styles for IE is not ideal.</p>
<p>You should see that when rendered, the blue "outer" div is displayed within the "inner" div. The "inner" div will be red for browsers other than IE where it will be green instead.</p>
<p>Al... | <p>Have you tried the following:</p>
<pre><code>table {
position: relative;
top: 5px;
left: 5px;
margin-top: -5px;
margin-left: -5px;
}
</code></pre>
<p>This table will overlap the div with 5px at the right hand side and at the bottom. Margins are added to make the table fill the left hand side and top. Just omit the... | 44,660 |
<p>All front-end developers know the pain of coding for Firefox, then viewing our then mangled pages in IE6.
IE6 is still widely used (it is, however disappearing <a href="http://www.w3schools.com/browsers/browsers_stats.asp" rel="nofollow noreferrer">slowly but surely</a>... in a year and a half from the writing of t... | <p>As far as I know <a href="http://www.debugbar.com/" rel="nofollow noreferrer">Debugbar</a> is currently the most sophisticated debugging tool for IE. It's definitely better than IE developer, but it's still not quite as slick as firebug.</p>
| <p><a href="http://www.microsoft.com/en-us/download/details.aspx?id=18359" rel="nofollow noreferrer">Internet Explorer Developer Toolbar</a> seems to be the best option.</p>
| 11,030 |
<p>When writing fairly typical Mac code in an OS X 10.5+ environment, what are the disadvantages to using garbage collection?</p>
<p>So far everything else I've written has been either 10.4 compatible or on the iPhone, so I've become fairly comfortable with retain/release, but now that I'm working on a larger project ... | <p>If you are writing new Cocoa code and targeting Mac OS X 10.5, use Objective-C garbage collection.</p>
<p>If you are writing some code that may also need to run on the iPhone, you can write <em>and test</em> that code for both models very easily by keeping that code in a separate framework, writing it with property... | <p>GC is deprecated starting with 10.8. It was actually never a good idea to adopt this technology, cheerleading aside, because performance and stability goals were never met.</p>
<p>Managing memory "manually" is actually very simple, because the management code can largely be factored out. My code base has <1% c... | 46,545 |
<p>I'm trying to create a form that has an expandable widget. The problem is that when the widget is open, The form extends outside the limit in the content box, and it looks bad.</p>
<p>I tried using <code>overflow:scroll</code> but it creates 2 ugly scrollbars that do not disappear even if the content is smaller the... | <p>Change your overflow to <code>auto</code> and define the height and/or width of the element.</p>
| <p>Swilliams gave a good answer about how to treat the symptom. But, you might want to think about the root cause too - if the content box were not constrained to a fixed size, it could shrink and/or expand to fit any size form, without scroll bars. Web pages are flexible by design, and attempts to "fix" that flexibili... | 28,448 |
<p>I have a page which does quite a bit of work and I don't want the user to be able to navigate away from that page (close browser, hit back button, etc.) without getting a warning. I found that the onbeforeunload event (which I think is IE-specific, which works fine for me as the project uses lots of ActiveX) works g... | <p>Let me guess: the help "icon" is actually a link with a <code>javascript:</code> url? Change it to a real button, a real link, or at least put the functionality in an onclick event handler (that prevents the default behavior). Problem solved.</p>
<pre><code><!-- clicking this link will do nothing. No onbeforeunl... | <p>I have a method that is a bit clunky but it will work in most instances.</p>
<p>Create a "Holding" popup page containing a FRAMESET with one, 100% single FRAME and place the normal onUnload and onbeforeUnload event handlers in the HEAD.</p>
<pre><code><html>
<head>
<script language="Javascript" type... | 8,219 |
<p>In an embedded application, we have a table describing the various address ranges that are valid on out target board. This table is used to setup the MMU.<br>
The RAM address range is marked as cacheable, but other regions are marked at not cacheable. Why is that?</p>
| <p>This is done so that the processor does not use stale values due to caching.
When you access (regular) cached RAM, the processor can "remember" the value that you accessed. The next time you look at that same memory location, the processor will return the value it remembers without looking in RAM. This is caching.... | <p>Some areas like Flash can be read in one cycle, so do not need to be cached.</p>
| 11,563 |
<p>Does anyone know is there a way to open a project in Eclipse in read-only mode? If there is a lot of similar projects open it is easy to make changes to a wrong one.</p>
| <p>Putting project in read-only mode is really useful, when you make another instance from the previous project. So you copy all files from old project, then make changes in the new instance. It's really simple to edit files from old project by mistake (they have the same names)!</p>
<p>Serg if you use linux, I sugges... | <p>You can also use the close project/open project feature : close all projects and only open the one you need to work on ?</p>
| 12,250 |
<p>I'm looking for techniques to generate 'neighbours' (people with similar taste) for users on a site I am working on; something similar to the way last.fm works.</p>
<p>Currently, I have a compatibilty function for users which could come into play. It ranks users on having 1) rated similar items 2) rated the item si... | <p>In the book Programming Collective Intelligence<br>
<a href="http://oreilly.com/catalog/9780596529321" rel="nofollow noreferrer">http://oreilly.com/catalog/9780596529321</a><br></p>
<p>Chapter 2 "Making Recommendations" does a really good job of outlining methods of recommending items to people based on similaritie... | <p>The problem seems like to be 'classification problems'. Yes there are so many solutions and approaches. </p>
<p>To start exploration check this:
<a href="http://en.wikipedia.org/wiki/Statistical_classification" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Statistical_classification</a></p>
| 18,126 |
<p>I'm using Server.HtmlEncode on a utf-8 string in asp-classic, which works fine until there are some accents in the string e.g. Rüstü Recber, which appears as Rüstü Recber (R&#195;&#188;st&#195;&#188; Recber in the source).</p>
<p>I've tried setting the Response.Charset property to utf-8 but this d... | <p>Update (Solved): Adding <%@CODEPAGE=65001%> at the start of the page corrected the problem (<a href="http://technet.microsoft.com/en-us/library/bb742422.aspx" rel="noreferrer">http://technet.microsoft.com/en-us/library/bb742422.aspx</a>)</p>
<p>Many thanks for all of the suggestions.</p>
| <p>Check if the editor you are using to view the text is set to show utf-8.</p>
| 31,189 |
<p>I need to hide a Windows form from the taskbar but I can't use <code>WS_EX_TOOLWINDOW</code> because I need the system menu and min/max buttons on the form's title bar. </p>
<p>If I switch the form to a tool window at runtime the form skinning is stuffed up. From searching on the Web I see that VB has a ShowInTaskb... | <p>There's an interesting discussion of this exact problem <a href="http://www.vbaccelerator.com/home/VB/Code/Libraries/Windows/Forcing_a_Window_to_Show_in_the_TaskBar/article.asp" rel="noreferrer">here</a> (from a VB6 persepective).</p>
<p>The most relevant bit from your question's perspective is:</p>
<blockquote>
... | <p>One way to do this in C# is:</p>
<pre><code>ShowWindow(_window, SWHide);
int style = GetWindowLong(_window, GWL_EXSTYLE);
style |= WS_EX_TOOLWINDOW;
SetWindowLong(_window, GWL_EXSTYLE, style);
ShowWindow(_window, SWShow);
</code></pre>
| 32,722 |
<p>I'm looking to re-organize the way we release our internal software. All of the code (PHP webapps, some Java apps and Perl scripts) is checked into Subversion repositories but there are no branches or tags, everything is checked into trunk (only around 1-3 devs per app). On the production linux servers, the software... | <p>Continuous Integration is definitely the way to go - any CI (even minimalist batch files) is better than none - but it'll only be as good as the policies you have in place. Since your files don't really end up as a 'binary' or 'distributable', marking a release might merely require only that you tag the repository, ... | <p>Some Continuous Integration Servers do this sort of thing, <a href="http://hudson-ci.org/" rel="nofollow noreferrer">Hudson</a>, for example, has subversion integration. It can tag, run test, and deploy for you.</p>
| 31,205 |
<p>Is there a server implementation of <a href="http://www.freedesktop.org/wiki/Software/dbus" rel="nofollow noreferrer">DBus</a> for Java? There's a <a href="http://dbus.freedesktop.org/doc/dbus-java/" rel="nofollow noreferrer">lib</a> for clients and services (not servers).</p>
| <p>It seems like since you originally asked your question, the library has gained support for what you ask for, at least the <a href="http://dbus-java.sourcearchive.com/documentation/2.8-2/DBusDaemon_8java_source.html" rel="nofollow">DBusDaemon</a> source contains a <a href="http://dbus-java.sourcearchive.com/documenta... | <p>I'm not following why it would be necessary to have a language specific implementation of the server. I don't get the impression that more then one instance of DBus is intended to run in parallel on a server, so whichever events you public/subscribe to is all client side. If it's all client side that's all in java... | 31,731 |
<p>I'm a developer not a wordsmith and as such I'm stuck. </p>
<p>We have a subscription based site whereby users may well come across our 401 page.</p>
<p>We've decided that the IIS 401;2 page needs replacing.</p>
<p>Does anyone have any examples or advise about writing a good non offensive 401 page? </p>
| <p>This is an actual example - and a really funny one - supposedly taken from michaelbloomberg.com</p>
<blockquote>
<p>Unauthorized (401)</p>
<p>Through a series of highly
sophisticated and complex algorithms,
this system has determined that you
are not presently authorized to use
this system function. ... | <p>It is a safe bet that Don Norman's and Jakob Nielsen's principles for Human Computer Interaction design is still valid for web design and 401 pages.</p>
<p>The 401 pages is still a web-page, the main difference is a slightly more confused/frustrated user.</p>
<p>Here is the design principles:</p>
<ul>
<li>Visibil... | 26,027 |
<p>I have a 3rd party XLL addin I'd like to wrap in my own custom vba function. How would I call the 3rd party function from my code?</p>
| <p><strong>Edit:</strong> There are at least two ways to do this:</p>
<hr>
<p><strong>Option 1:</strong> <code>Application.Run(...)</code></p>
<p>This looks like the best way to go about it, since your arguments are automatically converted to an appropriate type before being sent to the XLL function.</p>
<pre><code... | <p>I know this is a way late answer, but I discovered this alternate method and think it's worth sharing. You can declare the 3rd party functions in the same manner as a Win32 call. This has the added benefit of showing up in the Intellisense completion when you are coding.</p>
<pre><code>Private Declare Function XL... | 49,150 |
<p>I have a class which extends <code>DefaultTableCellRenderer</code>, which renders strings in a monospace font, with a particular color. By default, it appears that tabs are not rendered at all (0 spaces). How can I set the tab size and/or cause them to be rendered?</p>
<p><strong>edits:</strong>
By "tabs" I mean ta... | <p><a href="http://docs.oracle.com/javase/6/docs/api/javax/swing/table/DefaultTableCellRenderer.html" rel="nofollow noreferrer"><code>DefaultTableCellRenderer</code></a> is a <a href="http://docs.oracle.com/javase/6/docs/api/javax/swing/JLabel.html" rel="nofollow noreferrer"><code>JLabel</code></a> and does what a <cod... | <p>Half baked answer: replace them with space characters, the quantity you need (need some computing if used beyond just indentation of lines).</p>
| 23,456 |
<p>I've found a few resources on the subject, but they all require a deep understanding of <a href="http://en.wikipedia.org/wiki/Smalltalk" rel="noreferrer">SmallTalk</a> or <a href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29" rel="noreferrer">Haskell</a>, neither of which I know.</p>
| <p>Here are some parser combinator libraries in more mainstream languages:</p>
<ul>
<li><a href="http://spirit.sourceforge.net/documentation.html" rel="noreferrer">Spirit</a> (C++)</li>
<li><a href="http://jparsec.codehaus.org/" rel="noreferrer">Jparsec</a> (Java)</li>
</ul>
| <p><s>Cay Horstmann has <a href="http://horstmann.com/sjsu/cs152/schedule.html" rel="nofollow noreferrer">4 combinator parser lectures in Scala</a>, with exercises.</s> There is an example of parsing external DSLs in Scala <a href="http://debasishg.blogspot.com/2008/04/external-dsls-made-easy-with-scala.html" rel="nofo... | 3,843 |
<p>Is Microsoft Project the best tool for managing software development or IT projects or is there an alternative that is better?</p>
| <p>Project is not good for <em>managing</em> development at all. I find it marginally useful for scheduling / work breakdown.</p>
<p>If you're on a Microsoft stack, <a href="http://msdn.microsoft.com/en-us/tfs2008/default.aspx" rel="nofollow noreferrer">Team Foundation Server</a> is a good project management solution.... | <p>We use <a href="http://www.acunote.com/" rel="nofollow noreferrer">Acunote</a> at my work place, but we follow a Agile/Scrum methodology. </p>
<p>What constitutes the "best tool" depends on many things. How you run your projects, who will be using them, etc.</p>
| 32,075 |
<p>Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding.
Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI.</p>
<p>Has anyone found a way to load a dynamic xml string (for example load... | <p>Here is some code I used to load a XML file from disk and bind it to a TreeView. I removed some of the normal tests for conciseness. The XML in the example is an OPML file.</p>
<pre><code>XmlDataProvider provider = new XmlDataProvider();
if (provider != null)
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocu... | <p>using your webservice get your XML and create an XML Document from it, You can then set the Source of your xmlDataProvider to the XMLDocument you got from the service.</p>
<p>I'm not at a pc with visual studio to test it but it should be possible for you to do this.</p>
<p>The steps are as you mentioned in your qu... | 8,509 |
<p>I've been looking into implementing an external activator in SQL Server Express 2005, and I added the queues, services, contracts, and event notifications to the database. I also added a trigger to send a message to the target queue. Everything parses, runs, and the trigger is firing. However, when I select from the... | <p>In answer to your first question, hopefully, you'll see something in the sys.transmission_queue system view. See
<a href="http://msdn.microsoft.com/en-us/library/ms190336.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms190336.aspx</a> for documentation on that.</p>
<p>If you Google that, y... | <p>John,</p>
<p>I've only recently begun looking into the service broker in order to implement asynch messaging between DB instances. I found the following to be quite useful in getting my head around it.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb839489(SQL.90).aspx" rel="nofollow noreferrer">http://m... | 20,299 |
<p>I have valid <code>HBITMAP</code> handle of <code>ARGB</code> type. How to draw it using <em>GDI+</em>?</p>
<p>I've tried method:</p>
<pre><code>graphics.DrawImage(Bitmap::FromHBITMAP(m_hBitmap, NULL), 0, 0);
</code></pre>
<p>But it doesn't use alpha channel.</p>
| <p>I've got working sample:</p>
<p><em>Get info using bitmap handle: image size, bits</em></p>
<pre><code>BITMAP bmpInfo;
::GetObject(m_hBitmap, sizeof(BITMAP), &bmpInfo);
int cxBitmap = bmpInfo.bmWidth;
int cyBitmap = bmpInfo.bmHeight;
void* bits = bmpInfo.bmBits;
</code></pre>
<p><em>Create & draw ne... | <p>Ah... but .Net doesn't use HBITMAP and GDI+ is a C++ library atop the basic Windows GDI, so I'm assuming you're using non-.Net C++.</p>
<p>GDI+ has a Bitmap class, which has a FromHBITMAP() method.</p>
<p>Once you have the GDI+ Bitmap instance, you can use it with the GDI+ library.</p>
<p>Of course, if you can wr... | 22,110 |
<p>I have an XML that needs to be databound to a <strong>WPF TreeView</strong>. Here the XML can have different structure. The TreeView should be databound generic enough to load any permutation of hierarchy. However an <strong>XAttribute</strong> on the nodes (called <strong>Title</strong>) should be databound to the ... | <p>Hurrah !!! I figured out how to bind XAttribute. It is not intuitive and it's not easily imaginable. But here is how it can be done.</p>
<pre><code><TreeViewItem Header="{Binding Path=Attribute[Title].Value}"/>
</code></pre>
<p>It is hard to imagine that Title can directly be used in square braces.</p>
<p><... | <p>I think all you need to do is create a <a href="http://msdn.microsoft.com/en-us/library/system.windows.hierarchicaldatatemplate.aspx" rel="nofollow noreferrer">HierarchicalDataTemplate</a> for each node type in your XML, load your xml it into an <a href="http://msdn.microsoft.com/en-us/library/ms749287.aspx" rel="no... | 29,464 |
<p>I need to do a simple mail merge in OpenOffice using C++, VBScript, VB.Net or C# via OLE or native API. Are there any good examples available?</p>
| <p>I haven't come up with a solution I'm really happy with but here are some notes:</p>
<ul>
<li><p>Q. What is the OO API for mail merge?</p>
<p>A. <a href="http://api.openoffice.org/docs/common/ref/com/sun/star/text/MailMerge.html" rel="noreferrer">http://api.openoffice.org/docs/common/ref/com/sun/star/text/MailMerg... | <p>You should take a look at <strong><a href="http://api.openoffice.org" rel="nofollow noreferrer">Apache OpenOffice API</a></strong>. A project for creating an API for Open Office. A few languages they said to support are: C++, Java, Python, CLI, StarBasic, JavaScript and OLE.</p>
<p><a href="http://codesnippets.serv... | 5,982 |
<p>How do I create a batch file timer to execute / call another batch through out the day Maybe on given times to run but not to run on weekends ? Must run on system times can also be .cmd to run on xp server 2003 </p>
| <p>For the timer part of your script i highly reccomend using:</p>
<pre><code>echo.
echo Waiting For One Hour...
TIMEOUT /T 3600 /NOBREAK
echo.
echo (Put some Other Processes Here)
echo.
pause >nul
</code></pre>
<p>This script waits for 1 hour (3600 seconds) and then continues on with the script and the user cann... | <p>You could also do this></p>
<pre><code>@echo off
:loop
set a=60
set /a a-1
if a GTR 1 (
echo %a% minutes remaining...
timeout /t 60 /nobreak >nul
goto a
) else if a LSS 1 goto finished
:finished
::code
::code
::code
pause>nul
</code></pre>
<p>Or something like that.</p>
| 38,353 |
<p>I'm a long time Windows developer, and it looks like I'm going to be involved in porting a Windows app to the Mac.</p>
<p>We've decided to use Flex/Air for the gui for both sides, which looks really slick BTW.</p>
<p>My Windows application has a C++ DLL that controls network adapters (wired and wireless). This is ... | <p>Xcode is the IDE for Mac OS X, you can download the latest version by joining the Apple Developer Connection with a free Online membership.</p>
<p>I don't believe there are any supported APIs for controlling wireless networking adaptors. The closest thing would be the System Configuration framework, but I don't kn... | <p>Xcode is used a lot, as far as I know the combination editor (e.g. <a href="http://macromates.com/" rel="nofollow noreferrer">Textmate</a>), command line gcc is in fairly heavy use too. (that's what I do on OS X)</p>
<p>For all API needs head to <a href="http://developer.apple.com" rel="nofollow noreferrer">Apple's... | 31,639 |
<p>I have a sql database that stores some documents.</p>
<p>A user can sign into the application, and view a list of their documents.</p>
<p>When clicking a linkbutton download in a gridview of their docs, I get the file from the database, write it to the file system, and then execute this code.</p>
<pre><code> S... | <p>How are you sending the actual content of the file?? </p>
<p>I usually use <a href="http://msdn.microsoft.com/en-us/library/12s31dhy(VS.80).aspx" rel="nofollow noreferrer">Response.TransmitFile</a> method, it basically opens the file and sends its content to the Response.OutputStream</p>
| <p>Have you tried setting the content-disposition to "attachment" rather than "inline"? I believe that the browser will then prompt the user to open or save the document.</p>
<p>Also, you can usually bypass the file system by writing your byte stream from the database directly to the Response object with the BinaryWri... | 43,631 |
<p>When should I use an interface and when should I use a base class? </p>
<p>Should it always be an interface if I don't want to actually define a base implementation of the methods?</p>
<p>If I have a Dog and Cat class. Why would I want to implement IPet instead of PetBase? I can understand having interfaces for IS... | <p>
Let's take your example of a Dog and a Cat class, and let's illustrate using C#:</p>
<p>Both a dog and a cat are animals, specifically, quadruped mammals (animals are waaay too general). Let us assume that you have an abstract class Mammal, for both of them:</p>
<pre class="lang-cs prettyprint-override"><code>pub... | <p>In addition to those comments that mention the IPet/PetBase implementation, there are also cases where providing an accessor helper class can be very valuable.</p>
<p>The IPet/PetBase style assumes that you have multiple implementations thus increasing the value of PetBase since it simplifies implementation. Howev... | 8,099 |
<p>I bought a self-made Reprap Prusa Mendel 3 printer, modified to be built from cheaper materials, and immediately after the deal I got various problems. I fixed the majority of them, but don't know what the reason of the strange extruder behavior is: The stepper motor is not rotating while extruding filament, it's mo... | <p>Your controller board probably requires calibration.</p>
<p>It sounds like, maybe, the extruder's stepper motor is <em>not receiving sufficient</em> current, to make it turn. <strong>Or</strong>, somewhat confusingly, maybe the stepper is <em>receiving too much current</em>, and overheating.</p>
<p>You don't say whi... | <p>I also faced similar problem. Mine was a self-made marlin/repetier. The problem was that the motor current was much less than the motor requirement and the axis were not calibrated properly. Giving recommended current according to your motor ratings and limiting your feedrate according to your calibration should wor... | 442 |
<p>I have an ASP.NET page which pulls a set of images from a database table, and using an enumerator, goes through all of them and displays then.</p>
<p>This all happens in the codebehind (VB.NET), where the code adds the placeholder and some controls inside tables (tables inside the placeholder).</p>
<p>I've added a... | <p><code>cmdMyButton.attributes.add("onclick", "alert('hello');")</code> ?</p>
| <p><code>button.Attributes.Add("onclick", "javascript:fireLightBox()")</code></p>
<p>that's the C# but I think that the VB.NET would be pretty similar.</p>
| 22,769 |
<p>It seems like if you compile a Visual Studio solution and have a version # in your AssemblyInfo.cs file, that should propagate to say, the Windows Explorer properties dialog. This way, someone could simply right click on the *.exe and click 'properties' to see the version #. Is there a special setting in Visual Stud... | <p>Note, that the <em>AssemblyFileVersion</em> attribute is not available under .NET <strong>Compact Framework</strong>!</p>
<p>See <a href="http://www.danielmoth.com/Blog/2004/11/assemblyfileversion-on-cf.html" rel="noreferrer">this</a> article from Daniel Mooth for a workaround.</p>
| <p>I'm not sure that RevisionNumber is the correct field to be looking for.</p>
<p>Try explorer, right click -> version tab, and look at the AssemblyVersion field there.</p>
| 15,445 |
<p><a href="https://stackoverflow.com/questions/2556/whats-the-best-online-payment-processing-solution">This question</a> talks about different payment processors and what they cost, but I'm looking for the answer to what do I need to do if I want to accept credit card payments?</p>
<p>Assume I need to <em>store</em> ... | <p>I went through this process not to long ago with a company I worked for and I plan on going through it again soon with my own business. If you have some network technical knowledge, it really isn't that bad. Otherwise you will be better off using Paypal or another type of service.</p>
<p>The process starts by get... | <p>There's a lot to the whole process. The single easiest way to do it is to use services similar to paypal, so that you never actually handle any credit card data. Apart from that, there's a quite a bit of stuff to go through to get approved to offer credit card services on your website. You should probably talk wit... | 7,397 |
<p>I've written a command line utility that detects which network interface is connected, and sets the staitc ip address and dns servers for it (by calling netsh). However, I can't seem to figure out how to set the dns search suffixes. netsh doesnt appear capable of doing that. How do I do that otherwise (WMI perhaps)... | <p>I think you have to set the value(s) you want in the DNSDomainSuffixSearchOrder property of the Win32_NetworkAdapterConfiguration WMI object.</p>
<p>Here's and example of setting values in WMI, if you need it:
<a href="http://www.developerfusion.com/article/5450/using-wmi-from-managed-code/3/" rel="nofollow norefer... | <p>The dns search suffixes are valid for the whole machine, not for a single network adapter. You can also get them from registry:</p>
<pre><code>string searchList = "";
try
{
using (var reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(tcpSettingsSubKey))
{
searchList = (reg.GetValue(&q... | 19,960 |
<p>I have a MySQL query that I use to retrieve random rows from a table. The query is:</p>
<pre><code>SELECT * FROM QUESTION WHERE TESTID=1 ORDER BY RAND() LIMIT 10;
</code></pre>
<p>Now I need to change this query to <strong><em>Hibernate</em></strong>. Did a bit of googling but couldn't find the answer. Can someone... | <p>According to this <a href="http://cephas.net/blog/2004/05/21/hibernate-returning-n-records-in-a-random-order/" rel="nofollow noreferrer">post</a>, you can do that :</p>
<pre><code>String query = "from QUESTION order by newid()";
Query q = session.createQuery(query);
q.setMaxResults(10);
</code></pre>
<p>Not sure i... | <p>According to this <a href="http://cephas.net/blog/2004/05/21/hibernate-returning-n-records-in-a-random-order/" rel="nofollow noreferrer">post</a>, you can do that :</p>
<pre><code>String query = "from QUESTION order by newid()";
Query q = session.createQuery(query);
q.setMaxResults(10);
</code></pre>
<p>Not sure i... | 43,278 |
<p>A classic ASP.NET app - AppSrv + MS SQL DB. Both servers are heavy-lifters 8 cores, 20 GB of RAM. When load testing, the throughput goes somewhere to 400 VirtualUsers (according to LoadRunner) with CPU being approximately 30% utilized an DB server primarily idling - response times go dramatically up, to the point of... | <p>Does the host utilize App Pool?</p>
<p>Did you try increase the number to 5 to 10 in </p>
<pre><code>An Application Pool -> Performance ->
Web Garden -> Max Number of worker processes
</code></pre>
| <p>Also check for network saturation. Make sure you aren't maxing out the network connection between your load test machine and the web server. Also, if you are returning alot of heavy text/binary data between your web and database server monitor that network connection. </p>
| 30,036 |
<p>I'm building an iPhone application that talks to a Ruby on Rails backend. The Ruby on Rails application will also service web users. The restful_authentication plugin is an excellent way to provide quick and customizable user authentication. However, I would like users of the iPhone application to have an account cr... | <p>I think you shouldn't use the phone identifier alone to authenticate as it is not a secret and it is probably also guessable/predictable. Don't forget that if someone wanted to hack your web app they don't have to use your code - they can just guess device IDs and try to mess with your users data using any web clien... | <p>Have you tried to use another auth scheme like <a href="http://authlogic.rubyforge.org/" rel="nofollow noreferrer">Authlogic</a>? I've found restful_authentication rather intrusive (although I cheated by using <a href="http://matthall.wordpress.com/2008/09/09/a-bort-fork-rails-base-application/" rel="nofollow noref... | 45,784 |
<p>Hey so what I want to do is snag the content for the first paragraph. The string <code>$blog_post</code> contains a lot of paragraphs in the following format:</p>
<pre><code><p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p>
</code></pre>
<p>The problem I'm running into is t... | <p>Well, sysrqb will let you match anything in the first paragraph assuming there's no other html in the paragraph. You might want something more like this</p>
<pre><code><p>.*?</p>
</code></pre>
<p>Placing the <code>?</code> after your <code>*</code> makes it non-greedy, meaning it will only match as lit... | <p>Using Regular Expressions for html parsing is never the right solution. You should be using XPATH for this particular case:</p>
<pre><code>$string = <<<XML
<a>
<b>
<c>texto</c>
<c>cosas</c>
</b>
<d>
<c>código</c>
</d>
</a>
XM... | 5,964 |
<p>I want to create a view that consists solely of a <code>UITextView</code>. When the view is first shown, by default, I'd like the keyboard to be visible and ready for text entry. This way, the user does not have to touch the <code>UITextView</code> first in order to begin editing.</p>
<p>Is this possible? I see the... | <p>to accomplish that just send the becomeFirstResponder message to your UITextField, as follows (assuming you have an outlet called textField, pointing to the field in question):</p>
<pre><code>- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[textField becomeFirstResponder];
}
</code>... | <p>Following worked fine for me using Swift</p>
<pre><code>override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
// Show keyboard by default
billField.becomeFirstResponder()
}
</code></pre>
<p>Key is to use the viewDidAppear function. </p>
| 32,467 |
<p>I have a home-grown automated build script in the form of a DOS batch file. In part of that script, I check out (with "svn checkout") a section of our SVN repository that includes a bunch of third-party stuff that's used in our projects. This batch file performed pretty well for a long time, but now people have ch... | <p>This is possible: you can <code>svn checkout</code> an empty directory, and then <code>svn update filename</code> for each file that you <em>do</em> want.</p>
<p>Your script can do something like:</p>
<ol>
<li><code>svn checkout svn://path/to/repos/directory --depth empty</code></li>
<li><code>svn list --recursive... | <p>The most simple and a correct way to do this: DON'T DO IT! </p>
<p>If there is some crap in third party folder where there suppose to be .dll files that needs to be checkout - remove that crap to a different location! It does not belong here anyway.</p>
| 23,430 |
<p>It's common to see a UISearchBar in an application, that upon a click, will enlarge and animate into view with a keyboard. I'm curious, is this something the iPhone SDK provides for free, or is the Animation code more than likely written by the developer? I use a UISearchBar in several controllers, however by defaul... | <p>There is a discussion <a href="http://discussions.apple.com/thread.jspa?threadID=1652157&tstart=0" rel="nofollow noreferrer">"UISearchBar like Contacts"</a> on this at the apple site.</p>
| <p>Did you put it in through Interface Builder or programatically? Because by default the keyboard animation should play.</p>
| 46,642 |
<p>I'm running Vista on my laptop, but would like to virtualize Ubuntu so that I can boot it from time to time for my personal use (e.g. running code, testing Linux programs). I tried this with Virtual PC 2007 (I allocated 1G of RAM for Ubuntu), and it was very slow. Should I try Hyper-V instead? (Note: I know very lit... | <p>I'm using the free <a href="http://www.virtualbox.org/" rel="nofollow noreferrer">Virtual Box</a> and that's worked fine for me.</p>
| <p>If you don't need to have both Windows and Ubuntu running at the same time, you could try <a href="http://wubi-installer.org/" rel="nofollow noreferrer">Wubi, the Windows-based Ubuntu Installer</a>, a program that installs Ubuntu into a set of files on your Windows disk and sets you up to dual boot, without having t... | 39,124 |
<p>I want to be able to check the status of a publication and subscription in SQL Server 2008 T-SQL. I want to be able to determine if its okay, when was the last successful, sync, etc.. Is this possible?</p>
| <p>I know this is a little late....</p>
<pre><code>SELECT
(CASE
WHEN mdh.runstatus = '1' THEN 'Start - '+cast(mdh.runstatus as varchar)
WHEN mdh.runstatus = '2' THEN 'Succeed - '+cast(mdh.runstatus as varchar)
WHEN mdh.runstatus = '3' THEN 'InProgress - '+cast(mdh.runstatus as varchar)
WHEN mdh.r... | <p>In case it's helpful, I've combined parts of the two answers given and taken sp_replmonitorhelppublication and sp_replmonitorhelpsubscription and placed them into Temp Tables so I can sort them and exclude columns as needed.</p>
<p>Note, the subscriber script excludes some merge columns from sp_replmonitorhelpsubscr... | 27,130 |
<p>In the case of languages that support single decision and action without brackets, such as the following example:</p>
<pre><code>if (var == true)
doSomething();
</code></pre>
<p>What is the preferred way of writing this? Should brackets always be used, or should their usage be left as a preference of the indiv... | <p>There isn't really a right answer. This is what coding standards within the company are for. If you can keep it consistent across the whole company then it will be easy to read. I personally like</p>
<pre><code>if ( a == b) {
doSomething();
}
else {
doSomething();
}
</code></pre>
<p>but this is a hol... | <p>Our boss makes us put { } after a decision statement no matter what, even if it's a single statement. It's really annoying to add two extra lines. The only exception is ternary operators.</p>
<p>I guess it's a good thing I have my code monitor in portrait orientation at 1200x1600.</p>
| 3,228 |
<p>Are there any techniques for getting a smooth finish for parts printed with co-polyester (PET) filaments? More specifically, I am looking for an alternative that does not roughen the look of the part - such as using sandpaper - but rather works like acetone baths for ABS.</p>
<p>In particular, I want to treat Color... | <p>Ethyl acetate (sold as a MEK substitute) is supposed to work for vapor smoothing PET. It doesn't seem very toxic (it's used to decaffinate cofee and tea, and as a nail polish remover), but you might want to look more into it. There's a post on Printed Solid's blog where he vapor smoothed colorFabb XT and MadeSolid... | <p>I've found a <a href="http://www.plasticsintl.com/plastics_chemical_resistence_chart.html" rel="nofollow">chart</a> which covers several plastics and solvents and only two of them (<a href="https://en.wikipedia.org/wiki/Chloromethane" rel="nofollow">Chloromethane</a> and <a href="https://en.wikipedia.org/wiki/Chloro... | 152 |
<p>I'm working on a large legacy java application for which an important feature was automatic scaling of GUI Components based on monitor resolution. We are upgrading the JVM on which it runs from 1.4.2 to 1.6 and now the scaling is broken due to a change in the implementation of java.awt.Container.getPreferredSize().... | <p>It sounds like they are protecting the internal state of the component better in 1.6 than before. Maybe they ran <a href="http://findbugs.sourceforge.net/" rel="nofollow noreferrer">FindBugs</a> on it and fix the <a href="http://findbugs.sourceforge.net/bugDescriptions.html#EI_EXPOSE_REP" rel="nofollow noreferrer">... | <p>Changing layout managers seems like good solutions, but would, in this case, necessitate a complete redesign of the UI (which includes thousands of components) so this isn't really a practical solution for this application. </p>
| 22,790 |
<p>Does anyone know of a good way to compress or decompress files and folders in C# quickly? Handling large files might be necessary.</p>
| <p>I've always used the SharpZip Library.</p>
<p><a href="http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx" rel="noreferrer">Here's a link</a></p>
| <p>You can create zip file with this method:</p>
<pre class="lang-cs prettyprint-override"><code>public async Task<string> CreateZipFile(string sourceDirectoryPath, string name)
{
var path = HostingEnvironment.MapPath(TempPath) + name;
await Task.Run(() =>
{
if (File.Exists(path)) File.Del... | 2,260 |
<p>I'm just curious how most people make their ASP.NET pages printer-friendly? Do you create a separate printer-friendly version of the ASPX page, use CSS or something else? How do you handle situations like page breaks and wide tables?</p>
<p>Is there one elegant solution that works for the majority of the cases? </p... | <p>You basically make another CSS file that hide things or gives simpler "printer-friendly" style to things then add that with a <code>media="print"</code> so that it only applies to print media (when it is printed)</p>
<pre><code><link rel="stylesheet" type="text/css" media="print" href="print.css" />
</code></... | <p>I am a php user, but the point must be that the result no matter what is HTML and HTML is styled with CSS and there is an option for your style sheets for just using the style for printing. This should be the way to do it, imho. About big tables, there isnt really a magic "fix" for that. Page will break where it b... | 6,891 |
<p>I have been using git for several months in a project developed only by myself. I have a local repository and push it regularly to github for backup purposes.</p>
<p>I want to add another developer to this project, however I will have the responsibility of integrating the whole project.</p>
<p>What is the recommen... | <p>Git is geared towards <em>pulling</em>, rather than pushing. Ideally, the other developer would clone from your <em>public</em> repo on Github; then, when he was done with his changes, you'd either pull from a repo that he makes available to you, or you'd integrate his changes with patches that he emails to you. Eit... | <p>A word of advice... make sure you're both clear on which git operations will rewrite history. Resetting branch pointers, rebasing, appending commits, etc. will rewrite the history which is okay but only for private branches. For branches that you are sharing (pushing to or pulling from) you should avoid rewriting ... | 36,300 |
<p>I'm experiencing a strange behavior of SVN.
I've got SVN repository running on Apache 2.2.9 with mod_dav, mod_dav_svn and SVN 1.5.2.
When I try to check out (from remote 1.5.4 client or server-local 1.5.2 client - both "default" svn binaries), I'm getting something like:</p>
<p>mx-mac:Test mx$ svn ci -m ""
Adding ... | <p>Finally, I figured out that redefined ErrorDocument in .htaccess file for the same VirtualHost as the SVN's caused invalid data to be sent to SVN client on some occasions and for some reason intercepting with commit process.</p>
| <p>Daren, you are not exactly correct right now. I've tried all the possible combinations of working copies, new repositories and so on. I've tried mostly everything. At last, I've found one strange message in NEON debug messages, displaying my 404 page on a homepage, which I mostly forgot about. Then, I've realized - ... | 40,038 |
<p>I am working in Java on a fairly large project. My question is about how to best structure the set of Properties for my application.</p>
<p>Approach 1: Have some static Properties object that's accessible by every class. (Disadvantages: then, some classes lose their generality should they be taken out of the con... | <p>I like using Spring dependency injection for many of the properties. You can treat your application like building blocks and inject the properties directly into the component that needs them. This preserves (encourages) encapsulation. Then, you assemble your components together and create the "main class". </p... | <p>I usually go for a singleton object that resides in a common project and contains a hashtable of itself keyed on namespace, resulting in a properties class for each. </p>
<p>Dependency injection is also a nice way of doing it.</p>
| 31,179 |
<p>I'm looking for a component for C#.NET 2008 Professional that is capable of doing the majority of the network communications work that is required of our application so our programmers don't have to.</p>
<p>This component should function similarly to the way <a href="http://www.realthinclient.org/" rel="nofollow no... | <p>You should look at IPWorks from www.NSoftware.com Not only do they have a Dot Net library, they have a Delphi component as well. This might help you convert. If you buy their Red Carpet Subscription you'd get all libraries.</p>
| <p>You should look at IPWorks from www.NSoftware.com Not only do they have a Dot Net library, they have a Delphi component as well. This might help you convert. If you buy their Red Carpet Subscription you'd get all libraries.</p>
| 36,745 |
<p>Is it possible to test the use of a given layout using RSpec with Rails, for example I'd like a matcher that does the following:</p>
<pre><code>response.should use_layout('my_layout_name')
</code></pre>
<p>I found a use_layout matcher when Googling but it doesn't work as neither the response or controller seem to ... | <p>David Chelimsky posted a good answer over on the <a href="http://www.ruby-forum.com/topic/216851" rel="noreferrer">Ruby Forum</a>:</p>
<pre><code>response.should render_template("layouts/some_layout")
</code></pre>
| <p>Here's a version of dmcnally's code that allows no arguments to be passed, making "should use_layout" and "should_not use_layout" work (to assert that the controller is using any layout, or no layout, respectively - of which I would expect only the second to be useful as you should be more specific if it is using a ... | 13,457 |
<p>Programming languages had several (r)evolutionary steps in their history. Some people argue that model-driven approaches will be The Next Big Thing. There are tools like openArchitectureWare, AndroMDA, Sculptor/Fornax Platform etc. that promise incredible productivity boosts. However, I made the experience that it i... | <p>I think, it will take time, till the tools get more refined, more people gain experience with MDD. At the moment if you want to get something out of MDD you have to invest quite a lot, so its use remains limited.</p>
<p>Looking at openArchitectureWare for example: While it is quite robust and basic documentation ex... | <p>This is a very late reply, but I am currently searching for MDD tools to replace Rose RT, which is unfortunately being supplanted by Rhapsody. We are in the real-time, embedded and distributed C++ space and we get a LOT out of MDD. We are trying to move on to a better tool and get more widespread use of the tool i... | 4,141 |
<p>I'm trying to port an old library (that doesn't use namespaces as far as I can tell) to modern compilers. One of my targets can't tell the difference between System::TObject and ::TObject (without a namespace). System::TObject is native to the compiler.</p>
<p>I've tried a using directive, i.e. using ::TObject;</p>... | <p>You can do as Dib suggested, with a slight modification:</p>
<pre><code>// In a wrapper header, eg: include_oldlib.h...
namespace oldlib
{
#include "oldlib.h"
};
#ifndef DONT_AUTO_INCLUDE_OLD_NAMESPACE
using namespace oldlib;
#endif
</code></pre>
<p>This allows you to #define the exclusion in only the files w... | <p>If you have the source to the library, maybe include a header file at the top of each source where that header file has only:</p>
<pre><code>#define TObject TMadeUpNameObject
</code></pre>
| 23,044 |
<p>Ran into an “Out of Stack Space” error trying to serialize an ASP.Net AJAX Array object. </p>
<p>Here is the scenario with simplified code:</p>
<ol>
<li><p><code>Default.aspx</code></p></li>
<li><p><code>MainScript.js</code></p>
<pre><code>function getObject(){
return new Array();
}
function function1(obj){
... | <p>This problem happens because Sys.Serialization.JavaScriptSerializer can't serialize objects from others frames, but only those objects which where instantiated in the current window (which calls serialize() method). The only workaround which is known for me it's making clone of the object from other frame before cal... | <p>I have no way of testing your code right now, but it looks like a bug in JavaScriptSerializer.serialize to me. My guess is that it tries to do some kind of type checking on the array via the CLR and that it doesn't handle an empty array properly. </p>
<p>Have you tried to add an item of a serializable type to the a... | 8,102 |
<p>I am not too familiar with .NET desktop applications (using <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005" rel="noreferrer">Visual Studio 2005</a>). Is it possible to have the entire application run from a single .exe file?</p>
| <p>Yes, you can use the <a href="https://github.com/dotnet/ILMerge" rel="nofollow noreferrer">ILMerge</a> tool. It is also available <a href="https://www.nuget.org/packages/ilmerge" rel="nofollow noreferrer">as a NuGet package</a>.</p>
| <p><a href="http://www.microsoft.com/en-us/download/details.aspx?id=17630" rel="nofollow noreferrer">ILMerge</a> can combine assemblies to one single assembly provided the assembly has only managed code. You can use the commandline application, or add reference to the EXE file and programmatically merge. For a GUI vers... | 15,401 |
<p>I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g.</p>
<pre><code>XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"),
new XElement(ns + "urlset"... | <p>The "more correct way" would be:</p>
<pre><code>XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"),
new XElement(ns + "urlset",
new XElement(ns + "url",
new XElement(ns + "loc", "http://www.example.com/page"),
new XElement(ns + "lastmod", "2008-09-14"))));
</code></pre>
<p>Same as your... | <p>If one element uses a namespace, they all must use one. In case you don't define one on your own the framework will add a empty namespace as you have noticed. And, sadly, there is no switch or something similiar to suppress this "feature".</p>
<p>So, there seems to be no better method as to strip it out. Using <em>... | 8,619 |
<p>I recently read this Phil Haack post (<a href="http://haacked.com/archive/2007/06/13/the-most-useful-.net-utility-classes-developers-tend-to-reinvent.aspx" rel="nofollow noreferrer">The Most Useful .NET Utility Classes Developers Tend To Reinvent Rather Than Reuse</a>) from last year, and thought I'd see if anyone h... | <p>People tend to use the following which is ugly and bound to fail:</p>
<pre><code>string path = basePath + "\\" + fileName;
</code></pre>
<p>Better and safer way:</p>
<pre><code>string path = Path.Combine(basePath, fileName);
</code></pre>
<p>Also I've seen people writing custom method to read all bytes from file... | <p>Path.Append is always forgotten in stuff I have seen.</p>
| 21,515 |
<p>I have this in a page :</p>
<pre><code><textarea id="taEditableContent" runat="server" rows="5"></textarea>
<ajaxToolkit:DynamicPopulateExtender ID="dpeEditPopulate" runat="server" TargetControlID="taEditableContent"
ClearContentsDuringUpdate="true" PopulateTriggerControlID="hLink" ServicePat... | <p>The problem is that the white space is ignored by default when the XML is processed. Try to add the <code>xml:space="preserve"</code> attribute to the string element. You'll also need to define the xml prefix as <code>xmlns:xml="http://www.w3.org/XML/1998/namespace"</code>.</p>
| <p>Try to add the following style on textarea: <strong>style="white-space: pre"</strong></p>
| 8,533 |
<p>I have just installed C# for the first time, and at first glance it appears to be very similar to VB6. I decided to start off by trying to make a 'Hello, World!' UI Edition.</p>
<p>I started in the Form Designer and made a button named "Click Me!" proceeded to double-click it and typed in</p>
<pre><code>MessageBox... | <p>MessageBox.Show also returns a DialogResult, which if you put some buttons on there, means you can have it returned what the user clicked. Most of the time I write something like</p>
<pre><code>if (MessageBox.Show("Do you want to continue?", "Question", MessageBoxButtons.YesNo) == MessageBoxResult.Yes) {
//som... | <p>In the <code>System.Windows.Forms</code> class, you can find more on the <a href="http://www.msdn.com/" rel="nofollow">MSDN</a> page for this here. Among other things you can control the message box text, title, default button, and icons. Since you didn't specify, if you are trying to do this in a webpage you should... | 7,158 |
<p>How do i measure how long a client has to wait for a request. </p>
<p>On the server side it is easy, through a filter for example.
But if we want to take into accout the total time including latency and data transfer, it gets diffcult.</p>
<p>is it possible to access the underlying socket to see when the request i... | <p>There's no way you can know how long the client had to wait purely from the server side. You'll need some JavaScript.</p>
<p>You don't want to synchronize the client and server clocks, that's overkill. Just measure the time between when the client makes the request, and when it finishes displaying its response.</... | <p>You could set a 0 byte socket send buffer (and I don't exactly recommend this) so that when your blocking call to HttpResponse.send() you have a closer idea as to when the last byte left, but travel time is not included. <strong><em>Ekk</em></strong>--I feel queasy for even mentioning it. You can do this in Tomca... | 11,150 |
<p>I want to achieve going to the parent element then to the prev element get the atrribute id of the element which has class: classname.</p>
<pre><code><div>
<span><span id="190" class="classname">blabla</span></span>
<span><a href="#" class="button">blabla</a></sp... | <p>For your example:</p>
<pre><code>$(this).parent().prev().children( '.classname' ).attr( 'id' );
</code></pre>
| <p>I would use <code>find</code> as you have suggested.</p>
| 44,680 |
<p>Has anyone figured out how to use Crystal Reports with Linq to SQL?</p>
| <p>You can convert your LINQ result set to a <code>List</code>, you need not strictly use a <code>DataSet</code> as the reports <code>SetDataSource</code>, you can supply a Crystal Reports data with an <code>IEnumerable</code>. Since <code>List</code> inherits from <code>IEnumerable</code> you can set your reports' Dat... | <p>The above code wont work in web application if you have dbnull values. You have to convert the results list object to dataset or datatable. There is no built in method for it. I have gone through the same issue and after hours of exploring on the internet, I found the solution and wanna share here to help anyone stu... | 12,295 |
<p>Imagine you had a group of product categories organized in a nice tree hierarchy and you wanted to provide hackable urls to browse these. You could do something like this</p>
<pre><code>/catalog/categorya/categoryb/categoryc
</code></pre>
<p>You could then quite easily figure out which category you should list the... | <p>Deep paths irk me. They're hideous to share. </p>
<pre><sub>
/product/1234/oblivion --> direct page
/product/oblivion --> /product/1234/oblivion if oblivion is a unique product,
--> ~ Diambiguation page if oblivion is not a unqiue product.
/product/1234/notoblivion -> /product/1234/oblivion
/c... | <p>@Lou Franco yeah either method needs a sturdy fallback mechanism and sending it to some sort of suggestion page or seach engine would be good candidates</p>
<p>@Stefan the problem with treating both as targets are how to distinguish them (like I described). At worst case scenario is that you first hit your database... | 36,953 |
<p>I had filament on my 3D45 coming out of threads on the nozzle.</p>
<p>To fix this I removed the nozzle to find the PTFE Liner in really bad shape. It looked crushed and deformed. Now the tough part, how do I replace the PTFE Liner. You can't seem to buy the liner and getting a replacement nozzle assembly from Dremel... | <p>The initial problem you had with filament coming out of the threads at the nozzle is caused by improper seating of the heat break to the nozzle. In a "from the ground up" installation, you'd have an empty heat block, containing your heater core and your thermistor. Threaded into the "bottom" of t... | <p>Capricorn sells 3x2mm ptfe heat break tube. Havnt used it long enough to know if it will hold up to its claims of withstanding temps up to 275c and beyond for any length of time; but I do know the generic ptfe I had in it before lived up to its reputation of going funny at 240c even though they sell it as rated for ... | 1,707 |
<p>I have a large collection of static 'Utility' classes that contain very generic static methods. For example, I have a CollectionUtility class that has useful methods like:</p>
<p>public static void RemoveDuplicates(ICollection collection)... etc</p>
<p>With C# 3.0 I've been converting these to extension methods.</... | <p>You're talking about code that would be shared library stuff. Static methods do have a place in shared libs. Check out System.Linq.Enumerable</p>
<p>I'd follow these guidelines:</p>
<ul>
<li>These aren't static methods by default. They should only be static methods because they are naturally stateless (behavior ... | <p>Absolutely not. Utility modules over time turn into large collections of cruddy code.</p>
| 22,392 |
<p>Both Session.Clear() and Session.Abandon() get rid of session variables. As I understand it, Abandon() ends the current session, and causes a new session to be created thus causing the End and Start events to fire.</p>
<p>It seems preferable to call Abandon() in most cases, such as logging a user out. Are there s... | <p><code>Session.Abandon()</code> <strong>destroys the session</strong> and the <strong>Session_OnEnd event</strong> is triggered. </p>
<p><code>Session.Clear()</code> just <strong>removes all values</strong> (content) from the Object. The session with the same key is still alive.</p>
<p>So, if you use <code>Session.... | <p>I had this issue and tried both, but had to settle for removing crap like "pageEditState", but not removing user info lest I have to look it up again.</p>
<pre><code>public static void RemoveEverythingButUserInfo()
{
foreach (String o in HttpContext.Current.Session.Keys)
{
if (o != "UserInfoIDontWan... | 45,198 |
<p>Is it correct to say that typically user_dump_dest is on a local drive?</p>
<p>If so, are there issues with mounting a NAS volume to both Unix and Windows and pointing user_dump_dest at that?</p>
<p>If so, what are they? </p>
<p>Are any issues worth not doing this in prod? </p>
| <p>I've run 9.2 instances with user_dump_dest on a NAS and never had a problem with it.</p>
<p>If you are concerned though, have oracle write them locally, then sync them across to your NAS and remove them from local, I've never needed to do that though.</p>
| <p>Yes, typically (and by default), user_dump_dest is on a local drive. I wouldn't expect there are any specific issues with putting it on NAS; but it would have all the potential issues that any application might: (1) If the NAS could not be reached, Oracle would not be able to write out user dump files, and (2) the... | 24,756 |
<p>My function iterates through every node of an instance of an <code>XMLDocument</code>. It checks to see if the current node's name is in a lookup list. If it is, it applies appropriate validation to the value of the current node.</p>
<p>When the validation method indicates that the value has been changed, I want ... | <p>Can you not modify the existing nodes (which ate already in the correct structure and in an XMLDocument, then re-serialise the XMLDocument? If the nodes are simple text containters then the </p>
<pre><code>.InnerText
</code></pre>
<p>property is the one you want.</p>
| <p>I know I always go back to this but this sounds like an example where clever use of apply-templates and <a href="http://msdn.microsoft.com/en-us/library/system.xml.xsl.xsltargumentlist.addextensionobject.aspx" rel="nofollow noreferrer">ExtensionObjects</a> in XSLT would be efficient.</p>
<p>That said XMLDocument is... | 43,258 |
<p>Is there any reason not to use the bitwise operators &, |, and ^ for "bool" values in C++? </p>
<p>I sometimes run into situations where I want exactly one of two conditions to be true (XOR), so I just throw the ^ operator into a conditional expression. I also sometimes want all parts of a condition to be evalu... | <p><code>||</code> and <code>&&</code> are boolean operators and the built-in ones are guaranteed to return either <code>true</code> or <code>false</code>. Nothing else.</p>
<p><code>|</code>, <code>&</code> and <code>^</code> are bitwise operators. When the domain of numbers you operate on is just 1 and 0... | <p>IIRC, many C++ compilers will warn when attempting to cast the result of a bitwise operation as a bool. You would have to use a type cast to make the compiler happy.</p>
<p>Using a bitwise operation in an if expression would serve the same criticism, though perhaps not by the compiler. Any non-zero value is consi... | 4,416 |
<p>How would one configurably set http-headers to cache files in IIS >= 6?</p>
<p>Example:</p>
<ul>
<li><code>*.cache.*</code> => cache nearly forever</li>
<li><code>*.nocache.*</code> => never cache</li>
</ul>
<p>An example framework using this naming would be the GWT framework.</p>
| <p>I think you're referring to setting the cache-control header.</p>
<p>See here <a href="http://support.microsoft.com/kb/247404" rel="nofollow noreferrer">http://support.microsoft.com/kb/247404</a></p>
| <p><a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/23ea6f24-4b44-4fa0-a275-a1b907e1afb6.mspx?mfr=true" rel="nofollow noreferrer">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/23ea6f24-4b44-4fa0-a275-a1b907e1afb6.mspx?mfr=true</a></p>
<p>Explains the diff... | 9,933 |
<p>What is the best way to determine which ASP.NET button was clicked on a single page using JavaScript?</p>
| <p>I just the set the OnClientClick event handler for the button with the JavaScript function I wanted executed when the button was clicked during the Page_Load event.</p>
<pre><code>protected void Page_Load(object sender, EventsArgs e)
{
MyButton.OnClientClick = "MyJavaScriptMethod();";
}
</code></pre>
| <p>You can easily add a client side Javascript click handler to an ASP button like this.</p>
<pre><code>Button1.Attributes.Add("onclick", "alert('You clicked me!');");
</code></pre>
| 49,738 |
<p>If someone logs on to my application this user contains a dictionary with certain permissions.</p>
<pre><code>ex: module.view.workspace = true
module.view.reporting = false
...
</code></pre>
<p>Then we know to what parts of the application the user has access.
What I want to know is how we can apply these ... | <p>There's several different ways of doing this, with varying efficiency, depending on how good your query optimiser is, and the relative size of your two tables:</p>
<p>This is the shortest statement, and may be quickest if your phone book is very short:</p>
<pre><code>SELECT *
FROM Call
WHERE phone_number NOT... | <pre><code>SELECT name, phone_number FROM Call a
WHERE a.phone_number NOT IN (SELECT b.phone_number FROM Phone_book b)
</code></pre>
| 48,018 |
<p>Apologies in advance for the long-winded question.</p>
<p>I'm really a database programmer, but have inherited support of a classic-ASP intranet application which has recently been migrated from IIS 5 to a new server running IIS 6. The user-base is about a dozen, all using IE 6.</p>
<p>The UI displays hierarchies ... | <p>This smacks of an IE6 bug where the browser makes multiple requests for the same resource. For example if the content calls for the display of a small icon repeated 20 times in a list, instead of just fetching that image once, it attempts to fetch it 20 times. OK 19 of the responses are 304 Not Modified but that'... | <p>You may want to focus your attention on tweaking the caching settings on the client end. If the images are being sent by the server, then its not likely to be an IIS issue. If the HTML for the images is being sent to the browser, its not an ASP issue. That leaves the client.</p>
<p>The proxy may be mitigating some... | 39,171 |
<p>I have a one to many relationship between two tables. The many table contains a clob column. The clob column looks like this in hibernate:</p>
<pre><code>@CollectionOfElements(fetch = EAGER)
@JoinTable(name = NOTE_JOIN_TABLE, joinColumns = @JoinColumn(name = "note"))
@Column(name = "substitution")
@IndexColumn(name... | <p>To follow up with jodonnell's comment, a Web service connection can be made in just about any server-side language. It is just that the API example they provided was in Java probably because PlanPlusOnline is written in Java. If you have a URL for the service, and an access key, then all you really need to do is fig... | <p>Are you trying to implement a client to a web service hosted somewhere else? If so, Java's not necessary. You can do web service clients in <a href="http://www.dotnetjunkies.ddj.com/Tutorial/4D13CEFA-D0FD-44BE-8749-8D17B5757564.dcik" rel="nofollow noreferrer">.NET</a>, <a href="http://sourceforge.net/projects/nuso... | 7,672 |
<p>I have a string that I need to convert to the equivalent array of bytes in .NET. </p>
<p>This ought to be easy, but I am having a brain cramp.</p>
| <p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding?redirectedfrom=MSDN&view=netframework-4.7.2" rel="noreferrer">You need to use an encoding</a> (<code>System.Text.Encoding</code>) to tell .NET what you expect as the output. For example, in <a href="https://learn.microsoft.com/en-us/dotne... | <p>Like this:</p>
<pre><code> string test = "text";
byte[] arr = Encoding.UTF8.GetBytes(test);
</code></pre>
| 29,883 |
<p>I got this page, and have some problems with ie < 7 and opera 7.11</p>
<p><a href="http://browsershots.org/png/original/c5/c5bac9b3838ba30cfebae2f03f896548.png" rel="nofollow noreferrer">This</a> is what i hoped to be the layout in all browsers, and these are the IE ones instead: <a href="http://browsershots.org... | <p>Do you <em>really</em> need to support IE5.5? That seems needlessly painful. Unless you're explicitly doing this for a client who's using the browser, you can pretty much assume that everyone uses IE6 or later.</p>
<p>The CSS support in IE6 is flaky, and almost nonexistent in IE versions older than that. Your best ... | <p>Take a look at a stripped-down layout that works, such as on <a href="http://www.alistapart.com/d/holygrail/example_1.html" rel="nofollow noreferrer">A List Apart</a>.
Start with a working layout such as this and then edit it to your liking. I find this is easier than trying to fix a broken layout.</p>
| 40,913 |
<p>I'm using the After Effects CS3 Javascript API to dynamically create and change text layers in a composition.</p>
<p>Or at least I'm trying to because I can't seem to find the right property to change to alter the actual text of the TextLayer object.</p>
| <p>Hmm, must read docs harder next time.</p>
<pre><code>var theComposition = app.project.item(1);
var theTextLayer = theComposition.layers[1];
theTextLayer.property("Source Text").setValue("This text is from code");
</code></pre>
| <p>I wrote a simple function for myself to change properties. Here it is:</p>
<pre><code>function change_prop(prop, name, value){
var doc = prop.value;
doc[name] = value;
prop.setValue(doc);
return prop;
}
</code></pre>
<p>Example use:</p>
<pre><code>// Changing source text
change_prop(text_layer.p... | 9,483 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.