instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Do you use Luabind, toLua++, or some other library (if so, which one) or none at all?</p>
<p>For each approach, what are the pro's and con's?</p>
| <p>I can't really agree with the 'roll your own' vote, binding basic types and static C functions to Lua is trivial, yes, but the picture changes the moment you start dealing with tables and metatables; things go trickier very quickly.</p>
<p>LuaBind seems to do the job, but I have a philosophical issue with it. For m... | <p>I don't use any library. I have used SWIG to expose a C library some time ago, but there was too much overhead, and I stop using it.</p>
<p>The pros are better performance and more control, but its takes more time to write.</p>
| 12,889 |
<p>I have a VS solution, with the following projects.</p>
<p>-GUI<br>
-DataAccess<br>
-BusinessLogic<br>
-BusinessObjects </p>
<p>but where should the main model class reside? This is usually a cache of a set of objects which are the results from the data access layer and the GUI using virtual grids to view data in... | <p>This is a subjective question, but often to enforce that your model objects don't have direct dependencies to infrastructure, people often put them in a separate project. you also need to consider what other projects might use these model objects.</p>
<p>Another option for splitting up functionality into separate ... | <p>My solutions have 3 (non-test) projects </p>
<ol>
<li>UI - obvious</li>
<li>Core - all domain objects and business logic</li>
<li>Data Access - Repository pattern for populating/saving Model objects</li>
</ol>
| 37,519 |
<p>So in my simple learning website, I use the built in ASP.NET authentication system. </p>
<p>I am adding now a user table to save stuff like his zip, DOB etc. My question is:</p>
<ol>
<li>In the new table, should the key be the user name (the string) or the user ID which is that GUID looking number they use in the ... | <p>You should use some unique ID, either the GUID you mention or some other auto generated key. However, this number should never be visible to the user.</p>
<p>A huge benefit of this is that all your code can work on the user ID, but the user's name is not really tied to it. Then, the user can change their name (wh... | <p>I agree with Mike Stone. I would also suggest only using a GUID in the event you are going to be tracking an enormous amount of data. Otherwise, a simple auto incrementing integer (Id) column will suffice.</p>
<p>If you do need the GUID, .NET is lovely enough that you can get one by a simple...</p>
<pre><code>Dim ... | 2,689 |
<p>I've created a Visual Basic WPF Application project that contains Toy.edmx, an ADO.NET Entity Data Model generated from a database called Toy.</p>
<p>Its <em>Window1.xaml.vb</em> file looks like this:</p>
<pre>
1 Class Window1
2
3 Private Sub Window1_Loaded( _
4 ByVal sender As System.Object, _
5 ... | <p>The problem is that you're writing code, and expecting the Entity Framework to translate that into SQL... it can't do that. Just like LINQ to SQL can't do that.</p>
<p>Imagine if your property read a file from the "C:\" drive... how do you think it would handle that? - not possible.</p>
| <p>What type is Client class?</p>
<p>You might need to add namespace (same as that in which Client "Entity classs" is defined) to the file containing "IsWashington".</p>
| 32,521 |
<p>At work one of our target platforms is a resource constrained mini-server running Linux (kernel 2.6.13, custom distribution based on an old Fedora Core). The application is written in Java (Sun JDK 1.6_04). The Linux OOM killer is configured to kill processes when memory usage exceeds 160MB. Even during high load ou... | <p>This is pretty much the way *nix (and linux) have worked since the dawn of time(or atleat the dawn of mmus). </p>
<p>To create a new process on *nixes you call fork(). fork() creates a copy of the calling process with all its memory mappings, file descriptors, etc. The memory mappings are done copy-on-write so (in ... | <p>1: Yes.
2: This is divided into two steps: Any system call like fork() is wrapped by the glibc to the kernel. The kernel part of the system-call is in kernel/fork.c
3: I don't know. But I would bet that your kernel has it.</p>
<p>The OOM killer kicks in when Low memory is threatened on 32bit boxes. I've never had a... | 25,764 |
<p>I recently discovered the genshi.builder module. It reminds me of Divmod Nevow's Stan module. How would one use genshi.builder.tag to build an HTML document with a particular doctype? Or is this even a good thing to do? If not, what is the <em>right</em> way?</p>
| <p>It's not possible to build an entire page using just <code>genshi.builder.tag</code> -- you would need to perform some surgery on the resulting stream to insert the doctype. Besides, the resulting code would look horrific. The recommended way to use Genshi is to use a separate template file, generate a stream from i... | <p>Genshi.builder is for "programmatically generating markup streams"[1]. I believe the purpose of it is as a backend for the templating language. You're probably looking for the templating language for generating a whole page.</p>
<p>You can, however do the following:</p>
<pre><code>>>> import genshi.output... | 13,762 |
<p>I'm doing some profiling on a 1.1 app and have identified a problem. It seems that this function is taking forever to load on a certain page:</p>
<p>ParserCacheItem System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String, String, HttpContext)</p>
<p>I've searched around with no luck about what this... | <p>Its really a process of elimination.</p>
<p>I've had similar problems where it seemed where I was the only one that had encounted a particular issue.</p>
<p>By breaking my page down I found the control that was causing the timeout/error and did some more specific searches around it.</p>
<p>I then found that the e... | <p>What does the page consist of?</p>
<p>Have you tried:</p>
<ul>
<li>removing all elements from the page and running the profiler again and seeing if the same error occurs, if it doesn't add each element back to narrow down what was causing it</li>
<li>are all the namespace references correct for the .aspx?</li>
<li... | 19,945 |
<p>I'm reading lines of text that can come in any order. The problem is that the output can actually be indentical to the previous output. How can I detect this, without sorting the output first?</p>
<p>Is there some kind of hash function that can take identical input, but in any order, and still produce the same resu... | <p>The easiest way would seem to be to hash each line on the way in, storing the hash and the original data, and then compare each new hash with your collection of existing hashes. If you get a positive, you could compare the actual data, to make sure it's not a false positive - though this would be extremely rare, you... | <p>So you have input like</p>
<pre><code>A B C D
D E F G
C B A D
</code></pre>
<p>and you need to detect that the first and third lines are identical?</p>
| 8,972 |
<p>I could do this in C#..</p>
<pre><code>int number = 2;
string str = "Hello " + number + " world";
</code></pre>
<p>..and str ends up as "Hello 2 world".</p>
<p>In VB.NET i could do this..</p>
<pre><code>Dim number As Integer = 2
Dim str As String = "Hello " + number + " world"
</code></pre>
<p>..but I get an In... | <p>In VB I believe the string concatenation operator is & rather than + so try this:</p>
<pre><code>Dim number As Integer = 2
Dim str As String = "Hello " & number & " world"
</code></pre>
<p>Basically when VB sees + I suspect it tries do numeric addition or use the addition operator defined in a type (or... | <p>The VB plus (+) operator is ambiguous.</p>
<p>If you don't have Option Explicit on, if my memory serves me right, it is possible to do this:</p>
<pre><code>Dim str = 1 + "2"
</code></pre>
<p>and gets str as integer = 3.</p>
<p>If you explicitly want a string concatenation, use the ampersand operator</p>
<pre><c... | 34,147 |
<p>I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error:</p>
<blockquote>
<p>System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The loc... | <p>The .NET Assembly loader:</p>
<ul>
<li>is unable to find 1.2.0.203</li>
<li>but did find a 1.2.0.200</li>
</ul>
<p>This assembly does not match what was requested and therefore you get this error.</p>
<p>In simple words, it can't find the assembly that was referenced. Make sure it can find the right assembly by putt... | <p>Try adding whatever's missing to the global assembly cache.</p>
| 26,427 |
<p>I am creating an SQL view for a file that strips out the spaces in a particular field. My question is if there is a why to set a key on that new view so a person can still CHAIN the file. We are on V5R3.</p>
| <p>Okay found the answer at <a href="http://archive.midrange.com/midrange-l/200809/msg01062.html" rel="nofollow noreferrer">http://archive.midrange.com/midrange-l/200809/msg01062.html</a>.</p>
<p>It is not possible at V5R3. Supposedly at V6R1 this is possible.</p>
| <p>Could you accomplish the same thing using a logical file or with an <code>OPNQRYF</code> statement? Both of those allow you to set key fields and may be able to strip out the spaces in a file.</p>
| 14,815 |
<p>Could some one point to articles / books on how to create good flow chart diagrams?</p>
| <p><strong>BoUML-it's free!</strong></p>
<p>I've used this open source tool for the last 6 months at work to create UML diagrams:
bouml.free.fr/ </p>
<p>I've used it on both a Macbook running OS X, as well as Ubuntu Linux on a desktop, both with success. It also does codegen (although I haven't used this feature myse... | <p>Tutorial <a href="http://www.nos.org/htm/basic2.htm" rel="nofollow noreferrer">here</a>.</p>
<p>Also get a copy of Microsoft <a href="http://office.microsoft.com/en-gb/visio/default.aspx" rel="nofollow noreferrer">Visio</a>.</p>
| 37,547 |
<p>I'm roughing a layout together and doing some browser testing. Never came across this issue before, check out the contact form in the footer of this page</p>
<p><a href="http://staging.terrilynn.com/fundraising/" rel="nofollow noreferrer"><a href="http://staging.terrilynn.com/fundraising/" rel="nofollow noreferrer"... | <p>I guess I found the problem:</p>
<p>screen.css (line 382)</p>
<pre><code>#footer-contact-form div {
margin:0 300px 10px 0;
overflow:hidden;
}
</code></pre>
<p>"overflow:hidden" causes the problem.</p>
| <p>Have you tried not floating the <code><p></code> elements to the left? Why are you actually doing this? It isn't required in the current layout.</p>
| 23,299 |
<p>So I'm looking for a pattern like this:</p>
<blockquote>
<p>size='0x0'</p>
</blockquote>
<p>In a log file, but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW)</p>
<pre><code>size='0x[0-9a-fA-F]{4,}
</code></pre>
<p>But the same RegEx does not... | <p>You can in fact use awk, with a caveat.</p>
<p>As mentioned on the following page, you need a special command-line option (--re-interval) to make it work out, since the interval expression (the {4,}) is not in the standard:</p>
<p><a href="http://kansai.anesth.or.jp/gijutu/awk/gawk/gawk_28.html" rel="noreferrer">h... | <p>Don't forget the last apostrophe.</p>
<pre><code>'
</code></pre>
| 33,911 |
<p>Greetings, I'm trying to find a way to 'unbind' a socket from a particular IP/Port combination. My pseudocode looks like this:</p>
<pre><code>ClassA a = new ClassA(); //(class A instantiates socket and binds it to 127.0.0.1:4567)
//do something
//...much later, a has been garbage-collected away.
ClassA aa = ne... | <p>(this is what finally got everything to work for me)</p>
<p>Make sure EVERY socket that the socket in A connects to has </p>
<pre><code>socket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.ReuseAddress, true);
</code></pre>
<p>set upon being initiated. </p>
| <p>you can't rely on object being garbage collected in C# (i assume you're using c#, based on tagging) if it holds resources like being bound to the network resource like in your example, or holding some other kind of stream, a file stream would be a common example.</p>
<p>you have to assure to release the resources t... | 7,078 |
<p>I've just changed the motherboard on my Ender 3 Pro with a MKS GEN_L v1.0 and flashed the latest Marlin version on it.</p>
<p>I've calibrated my bed manually using the default XY and Z auto home commands on OctoPrint and a piece of paper.</p>
<p>I'm happy with the calibration, however whenever I launch a print the Z... | <p>I've actually found what the issue was. It turns out that my Z steps were way out of whack (i.e. 4000 steps/mm instead of 400). Apparently, that's the default value in GitHub for version 2.0 of Marlin. Not sure if that's a typo or a valid value, anyhow setting it to 400 fixed it.</p>
| <p>If you are already sure that homing is performed correctly and in valid position, then there are few reasons why printer may start printing in unexpected position.</p>
<p>Do the following checks to narrow down the actual one:</p>
<ul>
<li><p><strong>steps/mm</strong>: use <a href="https://marlinfw.org/docs/gcode/M50... | 1,851 |
<p>My account is in the securityadmin role and I cannot grant myself sysadmin permission. I wish to gain access to a database so I can add my account to a particular role within it. <br />
As I don't yet have access to the database I can't use the UI.</p>
<p>Does anyone know if this is possible and what SQL commands w... | <p>There are two securityadmin roles at play here.</p>
<p>in this case db_securityadmin (database role) won't be much good to you, membership of this role is good for adding users to custom database roles (not the built-in db_* roles)</p>
<p>Books Online is a bit misleading on this.</p>
<p>securityadmin (server role... | <p>The <strong>sysadmin role</strong>, as the name implies, can do anything within SQL Server. It has complete rights over the SQL Server. It is the only role that can add others to the sysadmin role. There isn’t anything within SQL Server a sysadmin role member can’t do.</p>
<p>You could use the system stored procedu... | 30,062 |
<p>I have a CommonUtils lib I have built into a dll which I file reference from several of my projects. CommonUtils depends on log4net.dll which was set as a file reference and copy-local=true when CommonUtils.dll was built. log4net.dll and CommonUtils.dll are not in GAC.</p>
<p>Everything works fine in MyWorkingProje... | <p>This is by design. You need to think about the implications that automatic inheritance of references would cause. While you can logically see what the references should be, there is no such delineation to the compiler. You could, theoretically, end up reproducing the Framework and a good part of your OS if it wal... | <p>When I've had a similar situation in the past, I received a compiler warning within Visual Studio telling me that I needed to add a reference to the dependent library.</p>
<p>Are you receiving such a warning when you compile? If so, follow the advice it gives and you should find Log4net copied to your output direct... | 49,013 |
<p>I have a form that contains a bunch of checkboxes. Before submitting the form, I'd like to grab the values of the checkboxes and stick them into a text field, then submit that.</p>
<p>So I might have:
Red
Orange
X Yellow
Blue
X Green</p>
<p>And I'd like my textfield to end up with the content "Yellow, ... | <p>Just use this code:</p>
<pre><code>$(function(){
$('#YourFormID').bind('submit',function(){
var serializedCheckboxes = '';
$("input[type=checkbox]").each(function() {
if($(this).attr("checked")) {
serializedCheckboxes += (serializedCheckboxes != '' ? ', ' : '') + $(this).att... | <p>First hack at it (without testing):</p>
<pre><code>var serializedCheckboxes = '';
$("input type='checkbox'").each(function() {
if($(this).attr("checked")) {
serializedCheckboxes += $(this).attr("value") + ',';
}
});
$("input name='allchecks').attr("value", serializedCheckboxes);
</code></pre>
| 37,132 |
<p>Sometimes you need to skip execution of part of a method under certain non-critical error conditions. You can use <em>exceptions</em> for that, but exceptions generally are not recommended in normal application logic, only for abnormal situations.</p>
<p>So I do a trick like this:</p>
<pre><code>do
{
bool isGoo... | <p>Bad practice, it depends.</p>
<p>What I see in this code is a very creative way to write "goto" with less sulphur-smelling keywords.</p>
<p>There are multiple alternatives to this code, which can or can not be better, depending on the situation.</p>
<h2>Your do/while solution</h2>
<p>Your solution is inter... | <p>I think I'd have to agree with your colleagues just because of readability, it's not clear atfirst glance what you are trying to accomplish with this code.</p>
<p>Why not just use </p>
<pre><code>if(isGood)
{
...Execute more code
}
</code></pre>
<p>?</p>
| 30,239 |
<p>How to enable inno-db support on installed instance of MySql?</p>
<p>I have installed mysql-5.0.67-win32.
'InnoDB' is 'DISABLED' when executing 'show engines'.
According to documentation MySql is compiled with support of inno-db
(From doc: A value of DISABLED occurs either because the server was started with an opt... | <p>Should be enabled by default. There are some situations where wrong permissions on the MySQL lib folder cause InnoDB to bark. Check your MySQL error log for permission errors.</p>
| <p>have you checked the startup parameters? maybe the shell script or batch file that you use to start up the server disable the engine on the command line.. IIRC command line flags trumps the .ini settings. </p>
| 13,718 |
<p>PostgreSQL allows the creation of 'Partial Indexes' which are basically indexes with conditional predicates. <a href="http://www.postgresql.org/docs/8.2/static/indexes-partial.html" rel="nofollow noreferrer">http://www.postgresql.org/docs/8.2/static/indexes-partial.html</a> </p>
<p>While testing, I found that they ... | <p>Pro:</p>
<blockquote>
<p>This reduces the size of the index,
which will speed up queries that do
use the index. It will also speed up
many table update operations because
the index does not need to be updated
in all cases</p>
</blockquote>
<p>Con:</p>
<p>Since this no longer is a real index, if you do... | <p>Pro:</p>
<blockquote>
<p>This reduces the size of the index,
which will speed up queries that do
use the index. It will also speed up
many table update operations because
the index does not need to be updated
in all cases</p>
</blockquote>
<p>Con:</p>
<p>Since this no longer is a real index, if you do... | 35,923 |
<p>You know, sometimes it happens that you run out of ideas for your next hobbistic programming project, and then... you ask for help on StackOverflow :)</p>
<p>So: what would it be your suggestion for a rocking web application (it may be implemented using <a href="http://code.google.com/appengine/" rel="nofollow nore... | <p>Why not join an existing Open Source project using those technologies? In my opinion it is a great way to learn new stuff and picking up good habits :-)</p>
| <p>An application tracking allergies (symptoms, counter indicators, food lists and places where you can actually buy such food).</p>
<p>The tricky part would be to allow users to filter the data without exposing their own health to the world. I was thinking about a client side CSS file which hides the part of the site... | 45,314 |
<p>I am using SQL Server 2005 CE framework 3.5 and attempting to use merge replication between my hand held and my SQL Server. When I run the code to synchronise it just seems to sit forever, and when I put a breakpoint in my code it never gets past the call to Synchronize().</p>
<p>If I look at the replication monit... | <p>Another thing you can do to speed up the Synchronize operation is to specify a db file path that is in your PDA's main program memory (instead of on the SD Card as in your example). You should see a speed improvement of up to 4X (meaning the Sync may take only 25% as long as it's taking now).</p>
<p>If you're runn... | <p>I have since discovered that it was just taking a long time to copy the data to the physical disk. Although the sql server replication had completed, it was still copying the data to the sd card.</p>
<p>I identified this by reducing the amount of tables I am replicating and I got a more immediate response (well an... | 35,145 |
<p>Suppose I have two classes with the same interface:</p>
<pre><code>interface ISomeInterface
{
int foo{get; set;}
int bar{get; set;}
}
class SomeClass : ISomeInterface {}
class SomeOtherClass : ISomeInterface {}
</code></pre>
<p>Suppose I have an instance of ISomeInterface that represents a SomeClass. I... | <p>Isn't the point of an interface to not have to do that? Are you doing something with the concrete implementation of SomeOtherClass? Instead of using the concrete implementation, use the interface and it shouldn't matter if you use SomeClass or SomeOther class.</p>
<p>Other than that, the best you could do is to wri... | <p><a href="https://stackoverflow.com/users/12950/tvanfosson">Tvanfosson</a>'s answer can be extended using a static generic method defined in the interface:</p>
<pre><code>public interface IPerson
{
string Name { get; set; }
static void CopyProperties<A, B>(A source, B dest) where A : IPerson where B : ... | 39,002 |
<p>I want to use the <a href="http://msdn.microsoft.com/en-us/library/system.enterpriseservices.internal.publish.gacremove(VS.80).aspx" rel="nofollow noreferrer">Publish.GacRemove</a> function to remove an assembly from GAC. However, I don't understand what path I should pass as an argument.</p>
<p>Should it be a path... | <p>I am using the <code>GacInstall</code> to publish my assemblies, however once installed into the gac, I sometimes delete my ‘temporary’ copy of the assemblies.</p>
<p>And then, if I ever wanted to uninstall the assemblies from the gac I do not have the files at the original path. This is causing a problem since I c... | <p>I am not exactly sure about it but I believe GacRemove should do the same thing as gacutil /u. So, it should be the path of your DLL. However it doesn't have to be the same DLL file. Copy of the original should suffice since what counts is the uniqueID of the DLL.</p>
| 6,772 |
<p>I need to bitwise shift a value 64 times in JavaScript. But JavaScript starts rounding after <code>32</code>.</p>
<p>For example:</p>
<pre><code>for(var j = 0; j < 64; j++)
{
mask = mask << 1;
console.log(mask);
}
</code></pre>
<p>This prints value from <code>0</code> to <code>1073741824</code> b... | <p>"In Java, the bitwise operators work with integers. JavaScript doesn't have integers. It only has double precision floating-point numbers. So, the bitwise operators convert their number operands into integers, do their business, and then convert them back. In most languages, these operators are very close to th... | <p>With <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt" rel="nofollow noreferrer">BigInt</a> you can use bitwise operators, except <code>>>></code>.</p>
<p>For example:</p>
<pre class="lang-js prettyprint-override"><code>console.log(1n << 32n); // 4294967... | 43,776 |
<p>How would you format/indent this piece of code?</p>
<pre><code>int ID = Blahs.Add( new Blah( -1, -2, -3) );
</code></pre>
<p>or</p>
<pre><code>int ID = Blahs.Add( new Blah(
1,2,3,55
)
);
</code></pre>
<hr />
<h3>Edit:</h3>
<p>My class has lots of parameters actually, so that might effect your response.</p... | <p>I agree with Patrick McElhaney; there is no need to nest it....</p>
<pre><code>Blah aBlah = new Blah( 1, 2, 3, 55 );
int ID = Blahas.Add( aBlah );
</code></pre>
<p>There are a couple of small advantage here:</p>
<ol>
<li>You can set a break point on the second line and inspect 'aBlah'. </li>
<li>Your diffs will b... | <p>int ID = Blahs.Add(new Blah(1,2,3,55)); // Numbers n such that the set of base 4 digits of n equals the set of base 6 digits of n.</p>
| 40,136 |
<p>Topic: Programmatically manipulate web browser in OS X 10.4.x+ Tiger/Leopard.
Subjects: Webkit, Safari, Firefox, APIs, Applescript, Automator, Javascript, Ruby, Ruby on Rails, OS X, Tiger
Goal: Collect/Read/Extract URLs from Safari into text (Ruby on Rails code) file.
Note: A solution that uses FF would be very appr... | <p>For Safari, this would be pretty trivial to do with Applescript. I'd suggest starting with something like <a href="http://www.macosxhints.com/article.php?story=20060227192533174" rel="nofollow noreferrer">Bookmark all tabs</a> to get the basic tab-grabbing logic that you'll need, and maybe merge it into John Gruber... | <p>The most simple solution in Firefox is "Bookmark all open tabs" (in the bookmark menu). Give this "bookmark folder" a specific name. You can then go into your profile (<a href="http://support.mozilla.com/en-US/kb/Profiles" rel="nofollow noreferrer">http://support.mozilla.com/en-US/kb/Profiles</a>) and open the file ... | 38,320 |
<p>I work with a bunch of sets in order to generate constrained random traffic, but I want to be able to call a Specman macro that computes the complement of a set with syntax like:</p>
<pre><code>COMPLEMENT begin
domain=[0..10,24..30],
complementing_set=[2..3,27..30]
end
</code></pre>
<p>and have it generate... | <p>You can try this:</p>
<pre><code>var domain: list of int = {0..10, 24..30};
var complementing_set: list of int = {2..3, 27..30};
var complement: list of int = domain.all(it in complementing set);
</code></pre>
<p>The <code>all</code> pseudo-method generates a sublist of the parent list of all the elements in the ... | <p>one more way may be to use uints, say you have a 500 possible values:</p>
<pre><code>domain : uint(bits:500);
complement : uint(bits:500);
set : uint(bits:500) = domain & ~complement;
</code></pre>
<p>you can later extract the indices with</p>
<pre><code>set_l : list of uint = set[.]].all_indices(it==1);
</co... | 14,284 |
<p>As kind of a follow up to <a href="https://stackoverflow.com/questions/111605/what-kind-of-prefix-do-you-use-for-member-variables">this question about prefixes</a>, I agree with most people on the thread that prefixes are bad. But what about if you are using getters and setters? Then you need to differeniate the pub... | <p>This is a completely subjective question. There is no "better" way.</p>
<p>One way is:</p>
<pre><code>private int _x;
public get x():int { return _x; }
public set x(int val):void { _x = val; }
</code></pre>
<p>Another is:</p>
<pre><code>private int x;
public get X():int { return x; }
public set X(int val):void {... | <p>In a case sensitive language I just use:</p>
<pre><code>private int myValue;
public int MyValue
{
get { return myValue; }
}
</code></pre>
<p>Otherwise I would use an underscore</p>
<pre><code>Private _myValue As Integer
Public ReadOnly Property MyValue As Integer
Get
Return _myValue
End Get
... | 20,424 |
<p>Is it possible to compile and run OpenGL programs from under Cygwin? If yes, how?</p>
| <p>It is possible to compile and run OpenGL programs under Cygwin. I illustrate the basic steps here:</p>
<ol>
<li><p>I assume you know OpenGL programming. If not, get the <a href="http://www.opengl-redbook.com/" rel="noreferrer">Red Book</a> (<em>The OpenGL Programming Guide</em>). It is mandatory reading for OpenGL ... | <p>I remember doing this once with some success, a few years ago, basically trying to cross compile a small Linux OpenGL C++ program. I do recall problems with Windows OpenGL drivers being behind the times (due to MS's focus on DirectX). I had NVidia OpenGL and DirectX drivers installed on my Windows system, but cygwin... | 3,510 |
<p>i.e. as I compose my test suites to include other suites as well as test cases,
is there a global count of how many tests the TestRunner has executed, will be executing?</p>
<p>Any way I can progammatically access that count?</p>
| <p>not sure about how many it has executed, but couldn't you check how many total tests using <code>self.methods.grep(/test_/)</code>?</p>
| <p><code>Test::Unit::TestSuite#size</code> may be helpful.</p>
<p><code>Test::Unit::TestCase#size</code> probably isn't, as it returns 1.</p>
| 33,145 |
<p>So I've got some scripts I've written which set up a Google map on my page. These scripts are in included in the <code><head></code> of my page, and use jQuery to build the map with markers generated from a list of addresses on the page.</p>
<p>However, I have some exact co-ordinate data for each address whic... | <p>I would not reccomend using style to hide something, it will show up in browsers without (or with disabled) css suppor and look strange.</p>
<p>You could store it in a javascript variable or add a form with hidden values like this
(inside an unused form to be sure it validates):</p>
<pre><code><form action="#" ... | <p>If the information should not be visible to the user, it should not stay in the document. The data can stay in a script region for example. However if for various reasons this is not possible, you could use a div with style="display:none" that will hide the information.</p>
| 44,174 |
<p>Given the following canvas:</p>
<pre><code><Canvas>
<Canvas.LayoutTransform>
<ScaleTransform ScaleX="1" ScaleY="1" CenterX=".5" CenterY=".5" />
</Canvas.LayoutTransform>
<Button x:Name="scaleButton" Content="Scale Me" Canvas.Top="10" Canvas.Left="10" />
<Butt... | <p>Not in XAML. You can do this in code by building the reverse transform and applying it to the object you don't want transformed.</p>
<p>If you want to go fancy, you can build a dependency property that you can attach in XAML to any object you don't want to be transformed by any parent transforms. This dependency pr... | <p>You could also restructure the elements so that the elements you don't want to scale with the <code>Canvas</code> are not actually children of that <code>Canvas</code>.</p>
<pre><code><Canvas>
<Canvas>
<Canvas.LayoutTransform>
<ScaleTransform ScaleX="1" ScaleY="1" Center... | 18,647 |
<p>I'm looking for a Windows tool that is able to log every action (read & write) that were made to a specific path inside the local Filesystem in order to debug a program (find out why it is sometimes slow and sometimes not).
In theory it could work like a virus scanner that is recognizing every file that any of t... | <p>To store a photo in AD, you can use the <code>jpegPhoto</code> attribute (see <a href="http://msdn.microsoft.com/en-us/library/ms676813(VS.85).aspx" rel="nofollow noreferrer">formal description in MSDN</a>). Here is <a href="http://www.arricc.net/active-directory-photos-sharepoint.php#" rel="nofollow noreferrer">a w... | <p>Outlook will only display the photo from a personal contact, not the GAL or AD. Making a new form is not as option.</p>
<p>I have managed to use the PersonName smart tag to add a menu option to the context menu which looks up and displays the photo in a browser. Not optimal. Anyone got other ideas?</p>
| 35,030 |
<p>Do we really need a server side architecture to create a RIA application?</p>
<p>My idea is the following:</p>
<ul>
<li>Create a complete RIA application using only Html pages, JQuery and a full client side UI set of components (choose your poison between the large number of different components available open sou... | <p>You could as easily have asked about implementing a first-class backend getting the server side right, while avoiding the latest trendy client-side fad. And I think it would be a legitimate goal in either case. You don't mention whether this is an existing application, but if it is, then I'd say, first memeorize the... | <p>Or don't even bother with the REST / Json part and use something like DWR to talk directly from your client side code to your server POJOs.</p>
| 39,791 |
<p>I have the following fields:</p>
<ul>
<li>Inventory control (16 byte record)
<ul>
<li>Product ID code (int – 4 bytes)</li>
<li>Quantity in stock (int – 4 bytes)</li>
<li>Price (double – 8 bytes)</li>
</ul></li>
</ul>
<p>How do I create a fixed length random access file using the above lengths? I tried some exampl... | <p>java.io.RandomAccessFile is the class you're looking for. Here's an example implementation (you'll probably want to write some unit tests, as I haven't :)</p>
<pre><code>package test;
import java.io.IOException;
import java.io.RandomAccessFile;
public class Raf {
private static class Record{
private f... | <p>With recent Java versions, you can manage Random access files using FileChannel. SeekableByteChannel interface define methods which allow you to change the position of the pointer in the destination entity like file which the channel is connected to. FileChannel implements SeekableByteChannel allowing you to manage ... | 24,369 |
<p>When I try to run the following code (from the REPL) in Clojure:</p>
<pre><code>(dotimes [i 5]
(.start
(Thread.
(fn []
(Thread/sleep (rand 1000))
(println (format "Finished %d on %s" i (Thread/currentThread)))))))
</code></pre>
<p>I get the following error:</p>
<pre><code>java.lang.Exception:... | <p>Your code works for me using the latest SVN (1144).</p>
<pre><code>user> (dotimes [i 5] (.start (Thread. (fn [] (Thread/sleep (rand 1000)) (println (format "Finished %d on %s" i (Thread/currentThread)))))))
Finished 0 on Thread[Thread-16,5,main]
Finished 4 on Thread[Thread-20,5,main]
Finished 3 on Thread[Thread... | <p>I think you mean "Calling Java from Clojure". They are still <a href="http://clojure.org/java_interop#toc14" rel="nofollow noreferrer">fiddling with the syntax</a>.</p>
| 44,492 |
<p>I have been experimenting with WPF and rendering strict XAML markup in a web browser, also known as Loose XAML (explained <a href="http://blogs.msdn.com/tims/archive/2005/09/21/472659.aspx" rel="nofollow noreferrer">here</a> and <a href="http://michaelbraude.com/index.php?XML/Projects/XAMLXSLT/XAMLXSLT_page1.xml" re... | <p>At least framework 3.0 is required to view loose XAML pages in IE. You can even check for it on your site by looking for ".NET CLR 3.0" in the user agent string.</p>
<p>A database connection, if it is even possible, would not be done directly in the loose XAML because of the need for procedural code to open the con... | <p>I've done a lot of work in hosting the Dynamic Language Runtime (DLR) and allowing scripts to be embedded in XAML. I'm at the point now that I feel like Loose XAML is not a second class citizen as I can handle events, write value converters, run Python/Ruby/JScript to do things like connect to SQL server.</p>
<p>S... | 19,293 |
<p>I'm making a twitter client, and I'm evaluating the various ways of protecting the user's login information.</p>
<p>IMPORTANT: I need to protect the user's data from other other applications. For example imagine what happens if a bot starts going around stealing Twhirl passwords or Hotmail/GMail/Yahoo/Paypal from a... | <p>This is a catch-22. Either you make the user type in his password every time, or you store it insecurely (obfuscated, encrypted, whatever).</p>
<p>The way to fix this is for more operating systems to incorporate built-in password managers - like OS X's Keychain. That way you just store your password in the Keychain... | <p>OSX: Use the Keychain</p>
<p>Windows: Use CryptProtectData and CryptUnprotectData</p>
<p>Linux: Use GNOME Keyring and KDE KWallet</p>
| 27,920 |
<p>What is the preferred way to use stored procedures between the following two methods and why:</p>
<p>One general SP such as 'GetOrders' which returns all the columns for the table Order. Several different parts of the application will use the same SP.</p>
<p>OR</p>
<p>Several more specific SPs such as 'GetOrders... | <p>I'd recommend optimistic locking instead. you add a "version" property to your object and then hibernate does an update operation at the end and verifies that the version has not changed since you read the object. generally a much better design than pessimistic locking (nothing like finding those db deadlocks!).</... | <p>You can use pessimistic lock although I wouldn't do that, but it may be useful in your case.</p>
<p>Since your object is retrieved from the DB you have to lock the DB so no one else modifies your object while you're working with it.</p>
<p>To do that you should <strong><a href="http://www.hibernate.org/hib_docs/v... | 44,076 |
<p>I'm trying to add support for stackoverflow feeds in my rss reader but <strong>SelectNodes</strong> and <strong>SelectSingleNode</strong> have no effect. This is probably something to do with ATOM and xml namespaces that I just don't understand yet.</p>
<p>I have gotten it to work by removing all attributes from th... | <p>Don't confuse the namespace names in the XML file with the namespace names for your namespace manager. They're both shortcuts, and they don't necessarily have to match.</p>
<p>So you can register "<a href="http://www.w3.org/2005/Atom" rel="noreferrer">http://www.w3.org/2005/Atom</a>" as "atom", and then do a Select... | <p>I just want to use..</p>
<pre><code>XmlNodeList itemList = xmlDoc.DocumentElement.SelectNodes("entry");
</code></pre>
<p>but, what namespace do the <strong>entry</strong> tags fall under? I would assume xmlns="http://www.w3.org/2005/Atom", but it has no title so how would I add that namespace?</p>
<pre><code>XmlD... | 4,440 |
<p>using the Symbian S60 5th edition SDK released on October 2nd, I am compiling/running(on sim) the following code snippet:</p>
<pre><code>void test(wchar_t *dest, int size, const wchar_t *fmt, ...) {
va_list vl;
va_start(vl, fmt);
vswprintf(dest, size, fmt, vl);
va_end(vl);
}
...
wchar_t str[1024];... | <p>To me this looks like a job for stepping into the <code>vswprintf()</code> call. Even if you can only do assembly-level debugging, it should be clear what's more or less going on by keeping a watch on what's going into the the <code>str[]</code> memory.</p>
| <p>Change the %S to a %s - uppercase to lowercase.</p>
<p>In MS-based printfs, %S means unicode characters, so this is why the 123 character string fails, it expects 2 bytes per character. (note %S is not part of the standard, so Symbian may be different here)</p>
<p>Actually, I think that still applies to <a href="h... | 26,293 |
<p>We run a relatively high volume content site. Like most content sites, the majority of each page is relatively static. The articles rarely change, making them good candidates for some form of static/edge caching. There are two big problems, though. Secondary page elements (nav, recent content lists, etc) change ... | <p>set Nginx as a front-end, and use SSI to pick the dynamic parts of the pages. dynamic source can be an HTTP server, like Apache, or a FastCGI server, for example PHP, or Django.</p>
<p>edit:</p>
<p>Many webservers support some form of SSI (Server Side Includes), this feature lets you add some tags into the HTML a... | <p>I know a few people have written about using nginx SSI with the memcache nginx module to splice together content fragments. It's a lot more limited than something like ESI, but still useful.</p>
| 42,542 |
<p>I'd like to ensure my RAII class is always allocated on the stack.</p>
<p>How do I prevent a class from being allocated via the 'new' operator?</p>
| <p>All you need to do is declare the class' new operator private:</p>
<pre><code>class X
{
private:
// Prevent heap allocation
void * operator new (size_t);
void * operator new[] (size_t);
void operator delete (void *);
void operator delete[] (void*);
// ...
// The r... | <p>In my particular situation, if the lock isn't necessary the mutex doesn't even exist, so I think that approach would be rather harder to fit.</p>
<p>I guess the thing I'm really struggling to understand is the justification for prohibiting creation of these objects on the free store.</p>
| 15,179 |
<p>I am using MS SQL Server 2005, I have dates stored in epoch time (starting 1970) I need to create a statement that will affect any record that has not been updated in the last 24 hours.</p>
| <p>To get the current datetime into epoch format, use (<a href="http://wiki.lessthandot.com/index.php/Epoch_Date" rel="nofollow noreferrer">via</a>):</p>
<pre><code>SELECT DATEDIFF(s,'19700101 05:00:00:000',GETUTCDATE())
</code></pre>
<p>To get the epoch time for now - 24 hours use:</p>
<pre><code>SELECT DATEDIFF(s,... | <p>You can convert from SQL Server DateTime to Epoch time by calculating the number of seconds that have elapsed since Jan 1, 1970, like this.</p>
<p><code>Select DateDiff(Second, '19700101', GetDate())</code></p>
<p>To get rows from the last 24 hours....</p>
<pre><code>Select Columns
From Table
Where EpochColumn... | 30,879 |
<p>I would like to be able to query whether or not a service is running from a windows batch file. I know I can use: </p>
<blockquote>
<p>sc query "ServiceName" </p>
</blockquote>
<p>but, this dumps out some text. What I really want is for it to set the <code>errorlevel</code> environment variable so that I can t... | <pre><code>sc query "ServiceName" | find "RUNNING"
</code></pre>
| <p>I have created one based from above but will show if the service is installed first then get whether it is running or not.</p>
<pre><code>sc query "YourService" | find /i "failed" 2>&1>nul && echo.'YourService Not Installed' || (sc query "YourService"| find /i "ru... | 45,994 |
<p>We're building some software for an in-house Kiosk. The software is a basic .net windows form with an embedded browser. The Kiosk is outfitted with a mat that the user steps on. When the user steps on the mat, it sends a key comination through the keyboard. When the user steps off the mat it sends a different key... | <p>If your window is the active window, then you can simply override the forms ProcessCmdKey as such below.</p>
<pre><code>protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYS... | <p>And if your application is NOT the main window, take a look at the <a href="http://msdn.microsoft.com/en-us/library/ms646309.aspx" rel="nofollow noreferrer">RegisterHotkey</a> Win32 API, with some info on <a href="http://pinvoke.net/default.aspx/user32/RegisterHotKey.html" rel="nofollow noreferrer">p/invoke here</a>... | 26,316 |
<p>First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one. </p>
<p>If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python... | <p>You probably want Ruby, because it's the native language for Metasploit, which is the de facto standard open source penetration testing framework. Ruby's going to give you:</p>
<ul>
<li><a href="http://www.metasploit.com/" rel="noreferrer">Metasploit's</a> framework, opcode and shellcode databases</li>
<li>Metasplo... | <p>Well, what kind of exploits are you thinking about? If you want to write something that needs low level stuff (ptrace, raw sockets, etc.) then you'll need to learn C. But both Perl and Python can be used. The real question is which one suits your style more?</p>
<p>As for toolmaking, Perl has good string-processing... | 10,203 |
<h2>Goal</h2>
<p>Java client for Yahoo's HotJobs <a href="http://developer.yahoo.com/hotjobs/resume_search_user_guide/index.html" rel="nofollow noreferrer">Resumé Search REST API</a>. </p>
<h2>Background</h2>
<p>I'm used to writing web-service clients for SOAP APIs, where <a href="https://jax-ws.dev.java.net/jax-ws-... | <p>It's interesting that they provide an HTTP URL as the namespace URI for the schema, but don't actually save their schema there. That could be an oversight on their part, which an email or discussion-list posting could correct.</p>
<p>One approach is to create your own schema, but this seems like a lot of work for l... | <p>Try <code>JdkRequest</code> from <a href="http://http.jcabi.com/" rel="nofollow">jcabi-http</a> (I'm a developer). This is how it works:</p>
<pre><code>String body = new JdkRequest("http://www.google.com")
.header("User-Agent", "it's me")
.fetch()
.body()
</code></pre>
<p>Check this blog post for more detail... | 46,921 |
<p>I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task.</p>
<p>According to the <a href="http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task" rel="noreferrer">Documentation</a>, it passes CCNetArtifactDirectory to MSBuild. But how do I ... | <p>The CCNetArtifactDirectory is passed to the MSBuild by default, so you dont need to worry about it. MSBuild will place the build output in the "bin location" relevant to the working directory that you have specified.</p>
<pre><code><executable>c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable... | <p>Parameters like <code>CCNetArtifactDirectory</code> are passed to external programs using environment variables. They are available in the external program but they aren't inside <code>CCNET</code> configuration. This often leads to confusion.</p>
<p>You can use a preprocessor constant instead: </p>
<pre><code><... | 2,327 |
<p>Every now and then, I accidentally hit C-x C-c in Emacs when I'm intending to just hit C-x or C-c. This, of course, closes all open frames and buffers with no confirmation. I know that I can make Emacs prompt "Are you sure you want to exit?", but I don't want to do that all the time, which would get annoying. I just... | <p>This is what I use:</p>
<pre><code>(defun count-buffers (&optional display-anyway)
"Display or return the number of buffers."
(interactive)
(let ((buf-count (length (buffer-list))))
(if (or (interactive-p) display-anyway)
(message "%d buffers in this Emacs" buf-count)) buf-count))
</code></pre>
<... | <p>Also, you can consider using desktop-mode, which will automatically restore your buffers when you start Emacs again. Just add </p>
<pre><code>(desktop-save-mode 1)
</code></pre>
<p>to your <code>.emacs</code>.
See <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Emacs-Sessions.html" rel="no... | 45,627 |
<p>Well.. we've developed a j2ee application using struts2 ajax capabilities. We find that the dojo implementation is quite slow. We did the following things:
1. Custom build of the dojo library. (increased dojo.js from 240kb to 350kb)
2. Took all the static stuff out of the struts jar and kept it outside.</p>
<p>The ... | <p>First of all check that you did everything on the server to facilitate caching (e.g., setting right HTTP headers, compression, server-side caching, upstream caches, and so on). See <a href="http://lazutkin.com/blog/2007/feb/1/improving-performance/" rel="noreferrer">Improving performance…</a> for more details... | <p>Last I checked, struts was shipping a release of Dojo (0.4) that's going on 2 years old. Dojo did a rewrite for version 0.9/1.0 that had significant performance gains and reduced code size. You should make sure you're running a recent version of Dojo (current version is 1.2.3) and use the build and tips from Eugen... | 42,492 |
<p>Is there any advantage to using <code>__construct()</code> instead of the class's name for a constructor in PHP?</p>
<p>Example (<code>__construct</code>):</p>
<pre><code>class Foo {
function __construct(){
//do stuff
}
}
</code></pre>
<p>Example (named):</p>
<pre><code>class Foo {
function F... | <p>I agree with gizmo, the advantage is so you don't have to rename it if you rename your class. DRY.</p>
<p>Similarly, if you have a child class you can call </p>
<pre><code>parent::__construct()
</code></pre>
<p>to call the parent constructor. If further down the track you change the class the child class inheri... | <p>I think that the main reason is that is the language convention.
You don't need to force a language to act like someone else.</p>
<p>I mean, in Objective-C you prefix the constructors with -init, for example. You can make your own constructor using your class name but why? Are ther some reason to use this schema in... | 26,745 |
<p>We distribute an application that uses an MS Access .mdb file. Somebody has noticed that after opening the file in MS Access the file size shrinks a lot. That suggests that the file is a good candidate for compacting, but we don't supply the means for our users to do that.</p>
<p>So, my question is, does it mat... | <p>In addition to making your database smaller, it'll recompute the indexes on your tables and defragment your tables which can make access faster. It'll also find any inconsistencies that should never happen in your database, but might, due to bugs or crashes in Access.</p>
<p>It's not totally without risk though -- ... | <p>If you don't offer your users a way to decompress and the raw size isn't an issue to begin with, then don't bother.</p>
| 10,014 |
<p>Prompted by discussion in comments of a recent question whether PLA is suitable for parts that need to be in contact with acetone, I did some casual experiments and found that my clear/"natural" 3D Solutech PLA is mostly but not entirely resistant to acetone, while my blue Hatchbox PLA is quickly softened ... | <p>There's only two ways to make sure it is pure PLA without color and additives:</p>
<ul>
<li>Make it yourself. Order PLA-pellets for manufacturing and put them into a filament extrusion machine</li>
<li>Contact your manufacturer and ask them to do the above for you.</li>
</ul>
<p>Note though that the pure PLA might h... | <p>If acetone resistance is what you are after, try PETG:</p>
<p>"While the chemical resistance of PETG is one of its most desirable characteristics, it is also one of the reasons why smoothing PETG prints is challenging. Since dissolving PETG with a solvent, smoothing via solvent application (like acetone smoothi... | 1,690 |
<p>I’d like a visual database tool that will allow me to access multiple database types from the same program. I’m looking for anything that supports Mysql, PostgreSQL, and Derby. Anything else it supports is a bonus.</p>
| <p>If you can get ODBC drivers for your databases (should be available from the DB vendor) you can use MS Access. If you want something free, I recommend <a href="http://www.squirrelsql.org/" rel="noreferrer">SQuirrel SQL Client</a>. It's implemented in Java, so you need JDBC drivers (usually also available for free)... | <p>I think you might be interested in <a href="http://www.sparxsystems.com.au/products/index.html#EA" rel="nofollow noreferrer">Sparx Enterprise Architect</a>. It could help with reverse engineering and creating fancy diagrams. It works with everything you could get drivers for but your database are natively supported.... | 39,260 |
<p>I have a site with the following robots.txt in the root:</p>
<pre><code>User-agent: *
Disabled: /
User-agent: Googlebot
Disabled: /
User-agent: Googlebot-Image
Disallow: /
</code></pre>
<p>And pages within this site are getting scanned by Googlebots all day long. Is there something wrong with my file or with G... | <p>It should be <code>Disallow:</code>, not <code>Disabled:</code>.</p>
| <p>Also I believe that the bot goes down the page and takes the first directive that applies to it. In your case, Googlebot and Googlebot-Image would never see their specific directives because they would respect the "User-Agent: *" first.</p>
<p><strong>Disregard this answer. I found information that points to this n... | 44,837 |
<p>I need to replace all WinAPI calls of the</p>
<ul>
<li>CreateFile, </li>
<li>ReadFile, </li>
<li>SetFilePointer,</li>
<li>CloseHandle </li>
</ul>
<p>with my own implementation (which use low-level file reading via Bluetooth).
The code, where functions will be replaced, is Video File Player and it already works wit... | <p>I suggest that you follow these steps:</p>
<ol>
<li>Write a set of wrapper functions, e.g MyCreateFile, MyReadFile, etc, that initially just call the corresponding API and pass the same arguments along, unmodified.</li>
<li>Use your text editor to search for all calls to the original APIs, and replace these with ca... | <p>I don't think this is best practice but it should work if you put it in an include file that's included everywhere the function you want to change is called:</p>
<pre><code>#define CreateFile MyCreateFile
HRESULT MyCreateFile(whatever the params are);
</code></pre>
<p>Implementation of MyCreateFile looks somethin... | 8,555 |
<p>I Have a problem with my custom Addin to word because sometimes, MS Word was disabled my addin, and I need to write another AddIn, which Was enabled to turn - on/off my first AddIn. Is it possible?</p>
<p>sorry for my English :(</p>
| <p>I agree with divo, your first step would be to add some exception handling/logging in order to prevent the addin from being disabled. You can also refer to this article</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms269003(VS.80).aspx" rel="nofollow noreferrer">Debugging in Application-Level Projects </a... | <p>What kind of add-in technology are you using? VSTO?
What version of Office are you using?</p>
<p>In general it is possible to do what you want. However, the reason that Office disables add-ins is that the add-in threw an unhandled exception. In that case Office will set the <code>LoadBehavior</code> value in the R... | 38,229 |
<p>My company uses a sales model of dealers, territory managers and regional managers, each with a different level of area scope (IE manage based on zips codes, states, or regions.)</p>
<p>I want to create a slimmed down map that is similar to <a href="http://www.onlineatlas.us/map/united-states-map.gif" rel="nofollow... | <p><a href="http://code.google.com/apis/kml/documentation/mapsSupport.html" rel="nofollow noreferrer">KML</a> and <a href="http://www.census.gov/geo/www/tiger/" rel="nofollow noreferrer">Tiger</a>(US) or <a href="http://www.statcan.gc.ca/mgeo/geography-geographie-eng.htm" rel="nofollow noreferrer">Maps and Geo</a>(Can)... | <p>A combination of <a href="http://postgis.refractions.net/" rel="nofollow noreferrer">PostGIS</a> for storing the data, <a href="http://mapserver.osgeo.org/" rel="nofollow noreferrer">MapServer</a> for generating map tiles, and <a href="http://openlayers.org/" rel="nofollow noreferrer">OpenLayers</a> for the interfac... | 46,942 |
<p>At work we use <a href="http://www.atlassian.com/software/confluence/" rel="noreferrer">confluence</a>. </p>
<p>On occasion it crashes, resulting in an error 500 page being generated.</p>
<p>This page includes some interesting reference information, including:</p>
<blockquote>
<p><strong>System Information:</st... | <p>Your Confluence System Favourite Colour (Australian spelling FTW) is also available from Admin -> System Info.</p>
<p>And if I told you any more, I'd have to kill you.</p>
| <p>FWIW, I've frequently put "interesting" information in error dumps -- I've found it's easier to get people to report it in bug reports, and they're more likely to accurately report something like "myrtle" as opposed to "error #47" or whatever...</p>
| 42,717 |
<p>Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise.</p>
| <p>You cannot do it with a plain CEdit, you need to override a few bits.</p>
<p>Implement your own ON_WM_CTLCOLOR_REFLECT handler, then return your coloured CBrush in the handler:</p>
<p>(roughly, you'll need to put the usual resource management in there, rememebr to delete your brush in the destructor)</p>
<pre><co... | <p>This can also be done without deriving from CEdit:</p>
<ol>
<li>Add <code>ON_WM_CTLCOLOR()</code> to your dialog's <code>BEGIN_MESSAGE_MAP()</code> code block.</li>
<li><p>Add <code>OnCltColor()</code> to your dialog class:</p>
<pre><code>afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
</code></pr... | 26,815 |
<p>Is there any good reason that an empty set of round brackets (parentheses) isn't valid for calling the default constructor in C++?</p>
<pre><code>MyObject object; // ok - default ctor
MyObject object(blah); // ok
MyObject object(); // error
</code></pre>
<p>I seem to type "()" automatically everytime. Is the... | <p><strong>Most vexing parse</strong></p>
<p>This is related to what is known as "C++'s most vexing parse". Basically, anything that can be interpreted by the compiler as a function declaration will be interpreted as a function declaration.</p>
<p>Another instance of the same problem:</p>
<pre><code>std::ifstream if... | <p>As the others said, it is a function declaration. Since C++11 you can use brace initialization if you need to see the empty <em>something</em> that explicitly tells you that a default constructor is used.</p>
<pre><code>Jedi luke{}; //default constructor
</code></pre>
| 21,735 |
<p>I am new to threads and in need of help. I have a data entry app that takes an exorbitant amount of time to insert a new record(i.e 50-75 seconds). So my solution was to send an insert statement out via a ThreadPool and allow the user to begin entering the data for the record while that insert which returns a new ... | <p>1) Many :), for example you could disable the "save" button while the thread is inserting the object, or you can setup a Thread Worker which handle a queue of "save requests" (but I think the problem here is that the user wants to modify the newly created record, so disabling the button maybe it's better)</p>
<p>2)... | <p>First, you should probably find out, and fix, the reason why an insert is taking so long... 50-75 seconds is unreasonable for any modern database for a single row insert, and indicates that something else needs to be addressed, like indices, or blocking... </p>
<p>Secondly, why are you inserting the record before ... | 49,110 |
<p>It's gotta be free. It's hobby, after all, not a business!. Creating for-profit software isn't an issue, but anything that requires a hardware mod is out.</p>
| <p>Nope, I don't think so. The only other .NET environment for consoles I know costs money and is called unity3d: <a href="http://unity3d.com/" rel="nofollow noreferrer">http://unity3d.com/</a></p>
<p>I think it supports the iPhone and the Wii and uses Mono as runtime environment. 200 bucks and you are in :)</p>
| <p>It depends what you classifies as a console. The iPod Touch and the iPhone has got the iPhone SDK with which it should be possible to develop quite good games and when you're done they can easily be distributed through App Store either fer free or for a price of which you will be given 70%.</p>
| 14,255 |
<p>I've got a UI front end which talks to and manipulates a SQL Server database, and one of the things it can do is run reports on the data in the database. </p>
<p>This UI can be installed on multiple computers, and so far I've just been keeping the reports in a folder with the install, but this means that any time a... | <p>Great Question! It's kind of coincidental as we've actually just implemented this within the last six months. </p>
<p>As you've suggested, we store the rpt file within the database, but do this in Server 2005 as a Image type. It works just fine and as far as the database goes, there really is no caveats that come t... | <p>.RPT file could be stored in database(sql) by having it type as image.Store byte array into database and then retrieve it as stream.(HINT:Treat it as image file.)</p>
| 22,190 |
<p>I am building on C++ dll, by writing code in C#.</p>
<p>I get an error, saying </p>
<blockquote>
<p>LoaderLock was detected Message:
Attempting managed execution inside OS
Loader lock. Do not attempt to run
managed code inside a DllMain or image
initialization function since doing so
can cause the appl... | <p>The general idea of loader lock:
The system runs the code in DllMain inside a lock (as in - synchronization lock). Therefore, running non-trivial code inside DllMain is "asking for a deadlock", as described <a href="https://devblogs.microsoft.com/oldnewthing/20040128-00/?p=40853" rel="nofollow noreferrer">... | <p>This problem occurs because of the way in which the debugger in Visual Studio runs managed applications that use Microsoft Foundation Classes version 8.0 in one or more DLL files.</p>
<p>Have a thorough reading at: <a href="http://msdn.microsoft.com/en-us/library/aa290048(vs.71).aspx" rel="nofollow">http://msdn.mic... | 8,061 |
<p>My company is transitioning from assembly coded microcontrollers to C. We are considering Microchip, Atmel, Renasas, et. al. for future projects using C code. Are there good training resources to bring our engineers up to speed with C? Seminars, instructors, classes, etc. The experience level of the engineers va... | <p>Welcome to the 80's. :) Start with the either classic K&R C book or my favorite C: a Reference Manual by Harbinson & Steel if you can find one. I work with PICs and there are several useful books about PIC programming. I was already familiar with C from using PCs I didn't find them useful in that regard.
<br... | <p>The first thing that comes to mind is documentation on writing Linux device drivers. This is loosely related to what you're interested, but coding for 16 bit devices is covered in <a href="http://www.xml.com/ldd/chapter/book/ch10.html" rel="nofollow noreferrer">this</a> O'Reilly book on driver programming. In genera... | 33,935 |
<p>Is there a WMI event you can subscribe to that will fire when a remote machine boots up and comes online, or goes offline?</p>
<p>My application needs to be able to monitor machines for their availability, and ideally, I'd like something that can work via events instead of continuous polling.</p>
| <p>Subscribing to a shutdown event is theoretically possible. You could subscribe to get updates to the "System" Event Log. You'd be looking for an event from Source = "EventLog" and EventID = 6006. This event contains the message:</p>
<blockquote>
<p>The Event log service was stopped.</p>
</blockquote>
<p>This i... | <p>A perusal around Microsoft's and other sites doesn't yield any information on a "boot" event in WMI. However, this <a href="http://bytes.com/forum/thread838283.html" rel="nofollow noreferrer">thread</a> suggests installing something in the startup folder on the server(s) you want to monitor.</p>
| 37,096 |
<p>I've heard some people saying that enums are evil and shouldn't be used in web services because of the mismatches that could occur between the server and the client if some values are assigned, or if the enum is marked with the <a href="http://msdn.microsoft.com/en-us/library/system.flagsattribute(VS.71).aspx" rel="... | <p>The reason people recommend to avoid enums in webservices is because they create subtle backwards compatible problems.</p>
<p>The same applies to regular enums but in web services the problem is even more clear specially in .NET-generated proxies (see below).</p>
<ul>
<li>If the enumerate is input only you have no... | <p>Here's an approach. Maybe it's cumbersome. I just really dislike not being able to use enums.</p>
<p>It gracefully handles deserialization of an unrecognized value, returning the default value instead. The default value would need to be safe - either an acceptable fallback or something that the application could re... | 42,280 |
<p>I'm writing a financial application in C# where performance (i.e. speed) is critical. Because it's a financial app I have to use the Decimal datatype intensively. </p>
<p>I've optimized the code as much as I could with the help of a profiler. Before using Decimal, everything was done with the Double datatype and th... | <p>You say it needs to be fast, but do you have concrete speed requirements? If not, you may well optimise past the point of sanity :)</p>
<p>As a friend sitting next to me has just suggested, can you upgrade your hardware instead? That's likely to be cheaper than rewriting code.</p>
<p>The most obvious option is to ... | <p>What about MMX/SSE/SSE2?</p>
<p>i think it will help...
so...
decimal is 128bit datatype and SSE2 is 128bit too... and it can add, sub, div, mul decimal in 1 CPU tick...</p>
<p>you can write DLL for SSE2 using VC++ and then use that DLL in your application</p>
<p>e.g
//you can do something like this</p>
<p><stro... | 47,878 |
<p>Reading up the new Vista/Win2008 features, I wonder what is the point of the Thread Ordering Service. In other words, in which scenario the "classic" scheduler's "fair to all" policy is not sufficient, and a definite order of threads is preferrable?</p>
<p>To clarify. What would be a concrete application that would... | <p><a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.fillschema.aspx" rel="noreferrer">SqlDataAdapter.FillSchema</a></p>
| <p>Do a query that normaly would return your data and add a where clause so that no rows are returned.</p>
| 29,661 |
<p>When I start my process from Visual Studio, it is always created inside a job object. I would like to know how to turn this behaviour off. Any ideas?</p>
<p>I expect that it is created in a job object to be debugged. I want to place my program in a different job object.</p>
<p>It's not the hosting process. I'm tal... | <p>This happens when <code>devenv.exe</code> or <code>VSLauncher.exe</code> run in compatibility mode. The <a href="http://msdn.microsoft.com/en-us/library/bb756937.aspx" rel="noreferrer">Program Compatibility Assistant</a> (PCA) attaches a job object to the Visual Studio process, and every child process inherits it. ... | <p>I'm not aware of any ways to control this aspect of processes spawned for debugging by VS.NET. But there's a workaround, which is applicable to any situation in which VS.NET can't or doesn't start your process in the exact way you want:</p>
<p>Start your process (possibly using a wrapper EXE that runs as part of th... | 11,525 |
<p>How do I find out which sound files the user has configured in the control panel?</p>
<p>Example: I want to play the sound for "Device connected".</p>
<p>Which API can be used to query the control panel sound settings?</p>
<p>I see that there are some custom entries made by third party programs in the control pan... | <p><a href="https://learn.microsoft.com/en-us/previous-versions/ms712879(v=vs.85)" rel="nofollow noreferrer"><code>PlaySound</code></a> is the API.</p>
<p>Also see <a href="https://learn.microsoft.com/en-us/windows/win32/multimedia/using-playsound-to-play-system-sounds" rel="nofollow noreferrer">Play System Sounds</a>.... | <p>Not Win32, but for .net anyway, you can do this using the following in C#:</p>
<pre><code>System.Media.SystemSounds.Asterisk.Play();
// Plays the Asterisk sound (used for Information (i))
// Also available:
// Exclamation (Warning /!\)
// Hand (aka Critical Stop - Error (X))
// Question (?)
// Beep (aka Default Bee... | 9,777 |
<p>I want to access/read the Firmware Number of a Pendrive attached on a USB Port of a PC.</p>
<p>How can I do this?</p>
| <p>After hunting around for a little while I found the following links which may point you in the right direction.</p>
<ol>
<li><a href="http://www.alanmacek.com/usb/" rel="nofollow noreferrer">Alan Macek</a></li>
<li><a href="http://www.usb.org/developers" rel="nofollow noreferrer">USB-IF Developers Area</a></li>
</o... | <p>After hunting around for a little while I found the following links which may point you in the right direction.</p>
<ol>
<li><a href="http://www.alanmacek.com/usb/" rel="nofollow noreferrer">Alan Macek</a></li>
<li><a href="http://www.usb.org/developers" rel="nofollow noreferrer">USB-IF Developers Area</a></li>
</o... | 47,668 |
<p>Drawing a parallelgram is nicely supported with Graphics.DrawImage:</p>
<pre><code>Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height);
using (Graphics gr = new Graphics.FromImage(destImage))
{
Point[] destPts = new Point[] { new PointF(x1, y1),
new PointF(x2, y2), new PointF(x4, y4)};
g... | <p>Normally you would do this with a 3x3 Matrix, but the Matrix class only lets you specify 6 values instead of 9. You might be able to do this in Direct X.</p>
| <p>Closest I can find is <a href="http://vckicks.110mb.com/image-distortion.html" rel="nofollow noreferrer">this information</a>, which is extremely laggy.</p>
| 5,922 |
<p>I've removed a checked in file from the CVS branch, i.e.:</p>
<pre><code>cvs remove -f file.txt
cvs commit
</code></pre>
<p>How do I restore the file?</p>
| <p>I believe that:</p>
<pre><code>cvs add file.txt
cvs commit file.txt
</code></pre>
<p>... will resurrect it from the attic.</p>
| <p>Here's what I do. I just create an empty file of the same name, then add and commit it, then retrieve the older version and re-commit that.</p>
| 17,444 |
<p>I'm trying to evaluate the purchase of a statistical tool. This will be used in part by non-programming users (doing clinical studies) and in part by programmers, so I'm trying to find a good compromise between usability and automation. Of course, cost is an issue, but if I can build a solid case, we could probably ... | <p><a href="http://www.stata.com/" rel="nofollow noreferrer">Stata</a> and <a href="http://www.spss.com/" rel="nofollow noreferrer">SPSS</a> tend to be the most commonly used packages in clinical studies. Both are pretty easy to pick up and use for non-technically minded folks but are generally flexible enough. I've ... | <p>Consider Excel one more time. It is well known, and widely available. Refer this <a href="http://books.slashdot.org/books/08/10/01/1329243.shtml" rel="nofollow noreferrer">book</a> or this <a href="https://rads.stackoverflow.com/amzn/click/com/0471387347" rel="nofollow noreferrer" rel="nofollow noreferrer">book</a>.... | 22,947 |
<p>Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications - how do you test this observer with rSpec?</p>
| <p>You are on the right track, but I have run into a number of frustrating unexpected message errors when using rSpec, observers, and mock objects. When I am spec testing my model, I don't want to have to handle observer behavior in my message expectations. </p>
<p>In your example, there isn't a really good way to spe... | <p>no_peeping_toms is now a gem and can be found here: <a href="https://github.com/patmaddox/no-peeping-toms" rel="nofollow">https://github.com/patmaddox/no-peeping-toms</a></p>
| 5,301 |
<p>I am trying to setup a multi module SpringMVC appfuse applicaiton in Eclipse but it seems that I'm facing lots of errors in Eclipse after I import the project in Eclipse. Can anyone please help me with a step by step guideline showing the ideal way to setup such application in Eclipse?</p>
| <p>Have you tried using maven eclipse plugin?
You can just go to the project root folder (the one that contains your pom.xml file) and run "mvn eclipse:eclipse" from the command line.</p>
<p>This will build project files for each of your modules and also create inter-dependencies. You can just treat your multi-module ... | <p>What are the errors? The most common problem I can think of is library errors, in which case you have to edit the build path. </p>
| 17,558 |
<p>I'm new to Windows programming and after reading the Petzold book I wonder: </p>
<p>is it still good practice to use the <code>TCHAR</code> type and the <code>_T()</code> function to declare strings or if I should just use the <code>wchar_t</code> and <code>L""</code> strings in new code?</p>
<p>I will target only... | <p>The short answer: <strong>NO</strong>.</p>
<p>Like all the others already wrote, a lot of programmers still use TCHARs and the corresponding functions. In my humble opinion <strong>the whole concept was a bad idea</strong>. <a href="http://en.wikipedia.org/wiki/UTF-16/UCS-2" rel="noreferrer">UTF-16</a> string proc... | <p>Just adding to an old question:</p>
<h1>NO</h1>
<p>Go start a new CLR C++ project in VS2010. Microsoft themselves use <code>L"Hello World"</code>, 'nuff said.</p>
| 29,011 |
<p>I've seen the following code to enable double buffering on a winform:</p>
<pre><code>// Activates double buffering
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint, true);
this.UpdateStyles();
</code></pre>
<p>Is... | <p><code>Control.DoubleBuffering</code> performs</p>
<pre><code>SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, value);
</code></pre>
<p>so your code sets <code>ControlStyles.UserPaint</code> as well (which probably has no effect at this point).</p>
| <p>In .NET 1.<em>x</em>, there was no <code>DoubleBuffered</code> property on controls, so <code>SetStyle</code> was the only way to enable it. Code your see that uses <code>SetStyle</code> is probably either still around from 1.<em>x</em> days, or from developers who just haven't changed their habits since then.</p>
| 38,868 |
<p>I have to compute at libraries quite often these days, and have been having some issues with my U3 smart drive. Despite working on some computers, public libraries here restrict the execution of EXE files and disable AutoPlay, rendering my U3 apps useless. Is there a good way of getting around the restriction and ge... | <p>If you succeed in bypassing the restrictions and get caught, you may be banned entirely from using the computers at the library. I recommend living without the executables or finding a computer to use somewhere else.</p>
| <p>I suspect that the restrictions are in place to prevent precisely that. Perhaps the restrictions are operating as intended.</p>
| 29,924 |
<p>suppose I declare a dynamic array like</p>
<pre><code>int *dynArray = new int [1];
</code></pre>
<p>which is initialized with an unknown amount of int values at some point.</p>
<p>How would I iterate till the end of my array of unknown size?</p>
<p>Also, if it read a blank space would its corresponding position ... | <p>No portable way of doing this. Either pass the size together with the array, or, better, use a standard container such as <code>std::vector</code></p>
| <p>Use a vector, which has a vector.size() function that returns an integer and a vector.end() function that returns an iterator.</p>
| 49,534 |
<p>If I have data in the following format</p>
<pre><code> id subid text
1 1 Hello
1 2 World
1 3 !
2 1 B
2 2 B
2 3 Q
</code></pre>
<p>And would like it in this format:</p>
<pre><code> id fold
1 HelloWorld!
2 BBQ
</code></p... | <p>I would strongly suggest against that. That is the sort of thing that should be handled in your application layer.</p>
<p>But... if you must:<br>
<a href="https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/" rel="nofollow noreferrer">Concatenating Row Values in Transact-SQL<... | <p>Wrap this in a function for a single execution...</p>
<pre><code>DECLARE @returnValue varchar(4000)
SELECT @returnValue = ISNULL(@returnValue + ', ' + myTable.text, myTable.text)
FROM myTable
RETURN @returnValue
</code></pre>
<p>For a small number of records this will work... any more than 5 or 10 is too many ... | 35,277 |
<p>I've created a small python script to toggle between two files I'm using for testing.</p>
<p>My question is, what is a good Python format style for the following code:</p>
<pre><code>import filecmp
import shutil
local = "local.txt"
remote = "remote.txt"
config_file = "C:\some\path\file.txt"
shutil.copyfile( remo... | <p>For the conditional statement, I would probably go with:</p>
<pre><code>if filecmp.cmp(local, config_file):
shutil.copyfile(remote, config_file)
else:
shutil.copyfile(local, config_file)
</code></pre>
<p>There's little need to use the inline <code>y if x else z</code> in this case, since the surrounding co... | <p>What about:</p>
<pre><code>import filecmp
import shutil
local = "local.txt"
remote = "remote.txt"
config_file = "C:\some\path\file.txt"
if filecmp.cmp( local, config_file):
to_copy = remote
else:
to_copy = local
shutil.copyfile( to_copy, config_file )
</code></pre>
<p>yikes, this open id screen name ... | 42,986 |
<p>I am having issues with a website that I am working on in which images and background-images fail to load in Internet Explorer 6.</p>
<p>Here is an example of a page on which you might experience this issue:</p>
<p><a href="http://www.infinitieurope.com/aboutinfiniti/environment/infiniti-environment.html" rel="nof... | <p>Twice now I've had people have problems with photos not showing up, and it was because they were in an incorrect colorspace, using CMYK instead of RGB.</p>
| <p>is it only ie6 and not ie7 too? IE is pretty strict with html sometimes, versus firefox lets you get away with more. Not sure if this helps, but I just debugged weird IE6/7 bugs by slowly taking away content. But if it's only intermittent, as in happens with the same code on and off, that's a really weird one.</p... | 20,868 |
<p>I'm always wondering who should do it. In <a href="http://ruby-lang.org/" rel="nofollow noreferrer">Ruby</a>, we have the <a href="http://daemons.rubyforge.org/" rel="nofollow noreferrer">Daemons</a> library which allows Ruby scripts to daemonize themselves. And then, looking at <a href="http://god.rubyforge.org/"... | <p>You probably cannot get a definitive answer, as we generally end up with both: the process has the ability to daemonize itself, and the process monitor has the ability to daemonize its children.</p>
<p>Personally I prefer to have the process monitor or script do it, for a few reasons:<br>
1. if the process monitor ... | <p>I would say it is better for your script to do it. I don't know your process monitoring tool there, but I would think users could potentially use an alternative tool, which means that having the script do it would be preferable.</p>
<p>If you can envision the script run in non-daemon fashion, I would add an option... | 15,467 |
<p>For example if the user is currently running VS2008 then I want the value VS2008.</p>
| <p>I am assuming you want to get the name of the process owning the currently focused window. With some P/Invoke:</p>
<pre><code>// The GetForegroundWindow function returns a handle to the foreground window
// (the window with which the user is currently working).
[System.Runtime.InteropServices.DllImport("user32.dll... | <pre><code>using System;
using System.Windows;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace FGHook
{
class ForegroundTracker
{
// Delegate and imports from pinvoke.net:
delegate void WinEventDelegate(IntPtr hWinEventHook, uint eventType,
IntPtr hwnd, ... | 12,276 |
<p>I usually, almost without thinking anymore, use forward declarations so that I won't have to include headers. Something along this example:</p>
<pre><code>//-----------------------
// foo.h
//-----------------------
class foo
{
foo();
~foo();
};
//-----------------------
// bar.h
//-----------------------
... | <p>You can't. The compiler needs to know the size of the object when declaring the class.</p>
<p>References are an alternative, although they have to be instantiated at construction time, so it's not always feasible.</p>
<p>Another alternative are smart pointers, but I suppose that's technically still a pointer.</p>
... | <p>If you are able to use a reference, you can retain the same use syntax. However, your reference has to be initialised straight away in the constructor, so your ctor absolutely must be defined out-of-line. (You will also need to free the object in the destructor too.)</p>
<pre><code>// bar.h
class foo;
class bar {
... | 39,346 |
<p>I have a .Net 2.0/3.5 WebApplication.</p>
<p>I want to be able to take money over the internet for my service.</p>
<p>Each of my customers will have an AccountNo.</p>
<p>I wish to offer several products each of which will have fixed price.</p>
<p>I need for my customer to login to my system and elect to pay me m... | <p><a href="https://www.paypal.com/" rel="nofollow noreferrer">Paypal</a> is fairly straight forward and <strong>secure</strong>.</p>
| <p>google and yahoo both offer decent service, and they don't require your customers to create an account.</p>
| 24,040 |
<p>Whenever I alter (or even just resave without altering) a Perl file, it completely takes down our backend. I have no idea what the problem could be. Permissions are correct. Encoding is correct. Encoding is UTF-8. Transfer mode was ASCII.</p>
<p>I might not deal with Perl too much but I have no idea what the proble... | <p>Try setting binary mode in your FTP client. That will allow you to experiment with different line endings (dos2unix) on the client side, without worrying about them being translated during transfer.</p>
| <p>Response to rebra: No frameworks are used, and I don't know what kind of server this is on. This is basically a one man project on a shared host which was pretty horribly maintained and I'm trying to clean house.</p>
<p>Yeah that does make sense and I asked the server people about that, one of my first questions ac... | 43,061 |
<p>Is there any way in SSRS2008 to deploy multiple instances of the ReportServer running separate code sets?</p>
<p>I'm developing a very specific deployment of reporting services where I have a number of custom extensions plugged in. But, my company typically deploys multiple versions of a release at once on the sam... | <p>You can install multiple RS front ends onto one DB backend.</p>
<p>It works well. We use it to have 2 primary RS boxes (load balanced) with 3rd BCP/DR hot standby box. They are all in the farm.</p>
<p>You can have multiple instances on the same box too.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms15... | <p>FWIW I have been running two separate report server installations against the same databases without issues. The volumes are fairly low.</p>
| 15,261 |
<p>I'm using a logging module that can have reporting enabled/disabled at runtime. Calls generally go something like:</p>
<pre><code>WARN(
"Danger Will Robinson! There are "
+ boost::lexical_cast<string>(minutes)
+ " minutes of oxygen left!"
);
</code></pre>
<p>I'm using an inline function for WA... | <p>If you need to be able to selectively enable and disable the warnings at run-time, the compiler will <em>not</em> be able to optimize out the call.</p>
<p>What you need is to rename your <em>function</em> to <code>WARN2</code> and add a macro something like:</p>
<pre><code>#define WARN(s) do {if (WARNINGS_ENABLED)... | <p>Can't you just define the whole thing out using the preprocessor?</p>
<pre><code>void inline void LogWarning(const string &message)
{
//Warning
}
#ifdef WARNINGS_ENABLED
#define WARN(a) LogWarning(a)
#else
#define WARN(a)
#endif
</code></pre>
<p>This is just how the ASSERT() macro works. All the code insid... | 35,791 |
<p>I am connecting to a MySQL DB trough a terminal who only have a program with an ODBC connection to a MySQL DB. I can put querys in the program, but not access MySQL directly.</p>
<p>I there a way to query the DB to obtain the list of fields in a table other than</p>
<pre><code>select * from table
</code></pre>
<p... | <pre><code>describe *tablename*
</code></pre>
| <p>This:</p>
<pre><code>SHOW COLUMNS FROM Tablename
</code></pre>
<p>lists the fields in a table and their properties (data type, whether null values are allowed, whether the field is a primary key, the default value if one has been set, etc.)</p>
| 39,796 |
<p>We have a weird intermittent problem with saving from Word 2007 to our SharePoint 2007 (MOSS) document libraries that gives a dialog box that never goes away - it is titled "Content Types" and the message "Getting list of available content types..." with a green progress-type bar that keeps scrolling. It happens a l... | <p>sudo vim /etc/php5/apache2/php.ini</p>
<h1>Add time zone</h1>
<p>date.timezone="Europe/London"</p>
<p>restart apache2
/etc/init.d/apache2 restart</p>
| <p>Try and set your timezone explicitly in the <code>httpd.conf</code>:</p>
<pre><code>SetEnv TZ GMT+2
</code></pre>
| 29,958 |
<p>I'm developing a system that needs to execute Intersystems Cache Terminal Scripts.</p>
<p>When I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calling the routine within a Caché t... | <p>After a while I finally discovered why the session was being terminated. You must wait for something at the end or the script just terminates. But you must be sure that the string you are waiting for is not something that will be printed until the code finishes.</p>
<p>So, I've just changed the program to print "Op... | <p>Is there a chance it's not a timeout, but some other problem? Possibly a runtime error that's not being trapped/logged?</p>
<p>The main difference between running from the interactive console and as a script is that when you run interactively you're in Programmer Mode, but in the script you're in User Mode. I can... | 24,181 |
<p>There are (at least) two ways that technical debts make their way into projects. The first is by conscious decision. Some problems just are not worth tackling up front, so they are consciously allowed to accumulate as technical debt. The second is by ignorance. The people working on the project don't know or don't r... | <p>One example of this is running a database in a mode that does not support Unicode. It works right up until the time that you are forced to support Unicode strings in your database. The migration path is non-trivial, depending on your database. </p>
<p>For example, SQL Server has a fixed maximum row length in bytes,... | <p>Not having a cohesive design up front tends to lead to it. You can overcome it to a degree if you take the time to refactor frequently, but most people keep bashing away at an overall design that does not match their changing requirements. This may be a more general answer that what your looking for, but does tend t... | 39,943 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.