input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Creating XML in C++ Code <p>In my project there are situations where we have to send xml messages (as char *) among modules. They are not really large ones, just 10-15 lines. Right now everybody just creates the string themselves. I dont think this is the right approach. We are already using xerces DOM library. So why ... | <p>If you are really just creating small XML messages, Xerces is an overkill, IMHO. It is a parser library and you are not parsing anything.</p>
|
Linux cross-compilation for ARM architecture <p>I am interested in cross-compiling a Linux kernel for an ARM target on a x86 host. Are there some good practices you recommend? Which is the best cross-compile suite in your opinion?
Have you settled up a custom cross-compile environment? If yes, what advices do you have?... | <p>There are two approaches I've used for ARM/Linux tools. The easiest is to download a pre-built tool chain directly.<br>
<strong>Pro</strong>: It just works and you can get on with the interesting part of your project<br>
<strong>Con</strong>: You are stuck with whichever version of gcc/binutils/libc they picked</p>
... |
Does anyone know any gems/plugins/tutorials related to exporting events to iCal, Google Calendar, Outlook from a Rails application? <p>I am trying to figure out if there is already a plug in that does the interaction with iCal, Google APIs that I can use or do I need to just get my hands dirty and write it myself. </p>... | <p>Check out the <a href="http://benjamin.francisoud.googlepages.com/googlecalendar">Google Calendar gem</a> for rails. It lets you display a user's Google Calendar in your rails app and they have sample snippets showing how to export events to Google Calendar:</p>
<pre><code>require 'googlecalendar'
g = GData.new
g.l... |
Why no compiler error for main() without a return at the end? <p>I'm working on a C-brain teaser: Write the standard Hello-World program, without semi-colons.</p>
<p>My best answer so far is:</p>
<pre><code>int main(void)
{
if (printf("Hello World!\n"), exit(0), 0)
{
/* do nothing */
}
}
</code><... | <p>As Jens pointed out in a comment, the posted code does not exhibit undefined behavior. The original answer here isn't correct and doesn't even really seem to answer the question anyway (on re-reading everything a few years later).</p>
<p>The question can be summed up as, "why doesn't MSVC issue warning C4716 for <c... |
amending a single file in a past commit in git <p>I want to fix a file in past commit. This might affect all ascending commits.</p>
<p>Is there an easy way to do that? Can you give me a guideline of how to do that?</p>
<p>Many times when I commit twice I find that I've had error in the first commit, and I wish to fix... | <p>If you only want to amend the second to last commit (eg. not long ago, especially not before many branches and merges), then I use this procedure:</p>
<ol>
<li><code>git checkout -b tmp bad-commit</code></li>
<li>fix the files</li>
<li><code>git commit --amend</code></li>
<li><code>git rebase tmp master</code></li>... |
How to Convince Programming Team to Let Go of Old Ways? <p>This is more of a business-oriented programming question that I can't seem to figure out how to resolve. I work with a team of programmers who have been working with BASIC for over 20 years. I was brought in to help write the same software in .NET, only with ... | <p>Firstly I must admit it's not absolutely clear to me from your description what the data structures and logic flows in the existing structures actually are. This does imply to me that perhaps you are not making yourself clear to your co-workers either, so one of your priorities must be to be able explain, either ve... |
Converting a string to a class name <p>I have a string variable that represents the name of a custom class. Example: </p>
<pre><code>string s = "Customer";
</code></pre>
<p>I will need to create an arraylist of customers. So, the syntax needed is:</p>
<pre><code>List<Customer> cust = new ..
</code></pre>
<p>... | <p>Well, for one thing <code>ArrayList</code> isn't generic... did you mean <code>List<Customer></code>?</p>
<p>You can use <code>Type.GetType(string)</code> to get the <code>Type</code> object associated with a type by its name. If the assembly isn't either mscorlib or the currently executing type, you'll need ... |
Why does my service reference only generate asynchronous methods? <p>I have a Service Reference (not a web reference) in VS2008 to a web service that I did not write. The reference works, but only asynchronous versions of each method are available for me to use.</p>
<p>In the "Configure Service Reference" dialog, the ... | <p>I'd be willing to wager ten up-votes that it's because you're doing this in Silverlight. Unfortunately I don't have the tools installed so I can't test this theory, but I do know that service calls from Silverlight can only be asynchronous. Perhaps you are using a Silverlight project template and are creating the se... |
Browser Detection in HttpModule <p>Is there a way to detect what browser the request is made in the HttpModule?</p>
<p>Thanks.</p>
| <pre><code>public class TestModule : IHttpModule
{
public void Dispose() {
throw new NotImplementedException();
}
public void Init(HttpApplication context) {
context.Request.Browser....;
}
}
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.browser(VS.8... |
How do you convert a url to a virtual path in asp.net without manual string parsing? <p>I've seen similar questions and answers regarding conversions from virtual to absolute and url, but how can I convert a url to a virtual path without manual string parsing?</p>
<p>Example: </p>
<p>I want "http://myserver/home.aspx... | <p>You can get most of it from the Uri class:</p>
<pre><code>new Uri("http://myserver.com/home.aspx").AbsolutePath
</code></pre>
<p>Then you just have to prepend the ~</p>
<p>Though, that will might break if you host in a subdirectory - I don't think there's a way to do it specifically in the context of the applicat... |
fread example from C++ Reference <p>I often use the website www.cplusplus.com as a reference when writing C code.</p>
<p>I was reading the example cited on the page for <a href="http://www.cplusplus.com/reference/clibrary/cstdio/fread.html" rel="nofollow">fread</a> and had a question.</p>
<p>As an example they post:<... | <p>Technically, yes it is a memory leak. But any memory allocated by a process is automatically freed when that process terminates, so in this example the calls to free (and fclose) are not really required.</p>
<p>In a more complex program, this would probably be a real problem. The missing free would create a memory ... |
Nhibernate: Handling an ITransaction Exception So That New Transactions Can Continue with same ISession <p>I have a list of 10 data objects that I want to insert/update to the database using NHibernate. If one throws an exception (say a primary key violation) I want to still insert/update the other 9. I rolled each obj... | <p>It's not possible to re-use an NHibernate session after an exception is thrown. <a href="http://nhforge.org/doc/nh/en/index.html#manipulatingdata-exceptions">Quoting the documentation</a>:</p>
<pre><code>If the ISession throws an exception you should immediately rollback the
transaction, call ISession.Close() and ... |
Persistent connection with client <p>Is there a general way to implement part of an application with JavaScript and supplying a persistent connection to a server? I need the server to be able to push data to the client, regardless of the client being behind a firewall. Thanks in advance</p>
| <p>See <a href="http://en.wikipedia.org/wiki/Comet_%28programming%29" rel="nofollow">Comet</a> - it's like ajax, but it holds a connection open so the server can push information to the client.</p>
<p>Note that compliant browsers will only hold 2 connections (note: <a href="http://stackoverflow.com/questions/5751515/o... |
What open source license for my web application that uses both GPL & LGPL? advice? <p>I've written an application I'd like to release as open source, but i'm not sure what to license it under.</p>
<p>It's all my own code <em>apart from</em> jQuery which is GPL 2.1 and TinyMCE editor which is LGPL 2.1. I'd like to dist... | <p>jQuery is available under the <a href="http://docs.jquery.com/License" rel="nofollow">MIT or GPL licenses</a>. If you're happy to make the code of your application available under GPL then you're fine. Usually people have issue because they don't want to. And it seems like distributing your application (including... |
VBA: preceding zeros dropped when copied over <p>I am creating a copy of an Excel file using VBA. In the file, there is a column that includes numbers with preceding zeros. The copy of the file is created, but the data in this column is dropped. I need to keep the values with the preceding zeros. How can I resolve this... | <p>The best way is to pre-format the column as Text by setting Range.NumberFormat to "@". This way, if a user edits the cell, the cell will stay as text and maintain it's leading zeros. Here is a VBA example:</p>
<p>ActiveSheet.Range("C:C").NumberFormat = "@"</p>
|
How to build ImageButton Control Adapter (or more general, how to build a simple control adapter)? <p>My inspiration for this question was my discovery of the very annoying default style (<code>border-width: 0px;</code>) on the ImageButton web control. The simple solution is to override it by adding your own style to t... | <p>There are two ways to do this. Both will require writing up a custom Control Adapter. Either you can set the actual value in code, or you can just not include the value at all and then use CSS to set your value. Here's the code you'll need to do this.</p>
<pre><code>namespace TestApp
{
using System.IO;
usin... |
How do I copy my entire working copy between hard drives? <p>Whenever I try to copy an entire working copy using simple drag and drop between two computers (e.g. from an old computer to a new one, or from one VM to another) in order to avoid having to redownload the entire several GB set of code from our online reposit... | <p>I can't answer for Vista, but on XP you just copy the directory.</p>
<p>I guess that Vista has decided that the files are hidden and so do not need to be copied, or they're locked and not available for copying. In the former, make them un-hidden (with the global file options in explorer's Organise menu, under folde... |
protect_from_forgery vs. Firefox <p>I've recently switched from storing session data in a cookie to storing it in the database.</p>
<p>Now every POST request causes an <b>ActionController::InvalidAuthenticityToken</b> error. It only happens in Firefox, and only on my home machine (I tried it out at work today in the ... | <p>The exact same thing happened to me when I switched one of my sites. Delete the Rails session cookie for that site in your home Firefox Browser.</p>
<p>It only happens if you had a pre-existing session that used the cookie store. So, hopefully, only you and your browser will ever see the issue. After you've delet... |
How different is CakePHP from Ruby on Rails? <p>I almost never hear the word CakePHP without hearing the word Rails shortly afterwards. Are these two frameworks mainly similar based on how they adhere to the MVC model or do they have other significant similarities/differences? </p>
<p>One of the main attractions of Ra... | <p>CakePHP is like a cheap, bastardized ripoff of Rails. It tries to be like Rails without doing any of the stuff that makes Rails great. It kinda feels similar, I guess.</p>
<p>CakePHP has an Ajax helper that does something similar to the Ajax-related helper methods in Rails, so yes, in some way, it's also true.</p>
... |
How can I upload a document to SharePoint with Perl? <p>I have a Perl app that runs some perforce operations, in the end I would like it to upload the results to SharePoint website. </p>
<ul>
<li>What is the simplest Perl script that can accomplish a task of adding a document to SharePoint? </li>
</ul>
<p>The script ... | <p>This sounds like a job for <a href="http://search.cpan.org/perldoc?WWW::Mechanize" rel="nofollow">WWW::Mechanize</a>. It has excellent support for dealing with forms.</p>
|
Check all radio controls with a specific substring on an ASP.NET form <p>I'm working on a .NET-powered questionnaire which contains several repeater controls, each row of which contains three radiobuttons. I'm trying to write a simple Javascript function to check all the controls on the page which contain the word "chk... | <p>You don't need to eval the _control.checked line.</p>
<pre><code>for (i = 0; i < document.Form1.elements.length; i++) {
var _control = document.Form1.elements[i]; // EDIT: you want the element, not the id of the element
if (_control.indexOf("chkGreen") > 0) {
_control.checked = true;
}
}
</code></p... |
Java: how do I check if a Date is within a certain range? <p>I have a series of ranges with start dates and end dates. I want to check to see if a date is within that range.</p>
<p>Date.before() and Date.after() seem to be a little awkward to use. What I really need is something like this pseudocode:</p>
<pre><code>b... | <pre><code>boolean isWithinRange(Date testDate) {
return !(testDate.before(startDate) || testDate.after(endDate));
}
</code></pre>
<p>Doesn't seem that awkward to me. Note that I wrote it that way instead of </p>
<pre><code>return testDate.after(startDate) && testDate.before(endDate);
</code></pre>
<p>so... |
Director 11 and Flash with AS 2 communication <p>I have a Director project with 3 scripts (2 behaviors and 1 movie script). I have the following code in my movie script:</p>
<pre><code>on startRecording ()
--do stuff
_movie.script["script2"].passGrade(75, 3, 4)
end
</code></pre>
<p>and in one of my behavior scrip... | <p>The syntax for calling the behavior script should rather be:</p>
<p>script("script2").passGrade(75, 3, 4)</p>
<p>Alternatively you could attach your behavior to the flash sprite (the instance of your flash on the stage), and send the call to the sprite:</p>
<p>sendSprite (flashSpriteNumOrNameOrRef, #passGrade, 75... |
Creating an AJAX Script Control <p>Call me a 'n00b', but I am new to creating Script Controls. I want to create a simple control with 3 text boxes. I have a .cs file that looks like this:</p>
<pre><code> public class SmokingCalc : ScriptControl
{
public SmokingCalc()
{
Render(htmlWri... | <p>Did you try <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.createchildcontrols.aspx" rel="nofollow"><code>CreateChildControls</code></a>?:</p>
<pre><code>public class SmokingCalc : ScriptControl
{
protected override void CreateChildControls()
{
this.Controls.Add(costTextbox);... |
Two encodings used in RTF string won't display correct in RichTextBox? <p>I am trying to parse some RTF, that i get back from the server. For most text i get back this works fine (and using a RichTextBox control will do the job), however some of the RTF seems to contain an additional "encoding" and some of the charac... | <p>I don't know why it's happening, but the encoding appears to be <a href="http://en.wikipedia.org/wiki/GBK" rel="nofollow">GBK</a> (or something sufficiently similar).</p>
<p>Perhaps the server tries to do some "clever" matching to find the characters, or the server's default character encoding is GBK or so, and tho... |
How do you display custom UIViews in InterfaceBuilder? <p>I seem to enjoy designing new <code>UIViews</code> and <code>UIControls</code> that implement their own <code>-drawRect:</code> method. This work well for me, especially when composed using <code>UIViews</code> in <em>Interface Builder</em>.</p>
<p>But composin... | <p>In order to do this, you actually have to create a plug-in for Interface Builder that uses your custom class. Once you create and install your plug-in, you will be able to drag and drop instances of your class (your view) onto another window/view/whatever just like any other control. To get started with creating IB ... |
Why does MIcroQuill Smartheap throw "mem_bad_pointer" errors after I embed perl? <p>I am embedding perl in a C++ application that uses <a href="http://www.microquill.com/smartheap/index.html" rel="nofollow">Smartheap</a>. Regardless of whether I compile the perl to use its own malloc or the system's I get a bunch of e... | <p>Without seeing the code it is hard to debug the problem.
Perhaps you are allocating memory using both smartheap and the regular memory manager. this can be caused when you allocat memory in a dll build without smart heap.</p>
<p>Depending on your code, the allocation could be fine and you may be writing outside th... |
How does TransactionScope roll back transactions? <p>I'm writing an integration test where I will be inserting a number of objects into a database and then checking to make sure whether my method retrieves those objects.</p>
<p>My connection to the database is through NHibernate...and my usual method of creating such ... | <p>Essentially TransactionScope doesn't track your Adapter's, what it does is it tracks database connections. When you open a DB connection the connections will looks if there is an ambient transaction (Transaction Scope) and if so enlist with it. Caution if there are more the one connection to the same SQL server this... |
Should I be testing a methods implementation using mocks <p>I'm having a bit of trouble doing some unit-testing using moq.</p>
<p>If I have a function like this:</p>
<pre><code>public string GetName(IMapinfoWrapper wrapper)
{
return wrapper.Evaluate("My com command");
///"My comm command" is the same all the ti... | <p>It depends on what you are actually testing.</p>
<p>If the expectation is that any string passed to Evaluate will return "TableName", then use the call to IsAny.</p>
<p>Otherwise, if you are expecting specific output given specific input, like the case of passing "My com command", then pass the second.</p>
<p>It ... |
How do I control the format in which MS-SQL Server returns datetime values? <p>Specifically, I wish to get the date format in a pure (ISO) format:</p>
<p>YYYY-MM-DD HH:mm:ss</p>
<p>I'm looking for a SET command or something that I can use.</p>
<p>I do not wish to rely on the culture setting of the server.</p>
<p>No... | <p>To change the default format you need to add a new language (sp_addlanguage), set it's date format, then set the default language to it. More details can be found on this old <a href="http://support.microsoft.com/kb/173907" rel="nofollow">technet article</a>.</p>
<p>If you don't want to do that, then you can chang... |
WS Addressing and Multiple "ReplyTo" <p>Please any one clarify me WS Addressing in WCF does support the multiple ReplyTo or not?.</p>
| <p>This would answer your question in depth <a href="http://msdn.microsoft.com/en-us/magazine/cc163412.aspx" rel="nofollow">@ Microsoft</a></p>
<p>...</p>
<p><strong>Multiple Endpoints and Unique Addresses</strong></p>
<p>There are a few reasons why you might wish to expose multiple endpoints on a particular service... |
Top 1 on Left Join SubQuery <p>I am trying to take a person and display their current insurance along with their former insurance. I guess one could say that I'm trying to flaten my view of customers or people. I'm running into an issue where I'm getting multiple records back due to multiple records existing within m... | <p>In Sql server 2005 you can use OUTER APPLY</p>
<pre><code>SELECT p.person_id, s.e.employee_id
FROM person p
OUTER APPLY (SELECT TOP 1 *
FROM Employee
WHERE /*JOINCONDITION*/
ORDER BY /*Something*/ DESC) s
</code></pre>
<p><a href="http://technet.microsoft.com/en-us/library/ms175156.a... |
How many sub-directories should be put into a directory <p>At SO there has been much discussion about how many files in a directory are appropriate: on older filesystems stay below a fey thousand on newer stay below a few hundred thousand.
Generally the suggestion is to create sub-directories for every few thousand fil... | <p>From a practicality standpoint applications might not handle well large directory entries.
For example Windows Explorer gets bogged down with with several thousand directory entries (I've had Vista crash, but XP seems to handle it better).</p>
<p>Since you mention nesting directories also keep in mind that there ar... |
GLSL versions change log? <p>Is there someplace I can read about the changes and additions made in GLSL from version 1.1 to 1.2 and from 1.2 to 1.3?<br />
Google seem to be at a loss for this and I really don't want to start reading the complete specification.</p>
| <p><a href="http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.08.withchanges.pdf">Version 1.3</a> of the spec has differences from 1.2 marked, it also lists changes from 1.2. <a href="http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf">Version 1.2</a> has a list of changes from 1.1.</p>
|
How bad is this pattern? <p>I've been using this pattern when I need to control how long various async operations take. I don't mean specifically for WebRequest (I know you can set the timeout property), I just used this as an example for the pattern.</p>
<pre><code> var request = WebRequest.Create(someUri);
... | <p>The WaitHandles wait methods supports time out, use that. Something like:</p>
<pre><code> var asyncResult = request.BeginGetResponse(...
asyncResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10))
</code></pre>
|
How to determine if a linked list has a cycle using only two memory locations <p>Does anyone know of an algorithm to find if a linked list loops on itself using only two variables to traverse the list. Say you have a linked list of objects, it doesn't matter what type of object. I have a pointer to the head of the li... | <p>I would suggest using <code>Floyd's Cycle-Finding Algorithm</code> <em>aka</em> The <code>Tortoise and the Hare Algorithm</code>. It has O(n) complexity and I think it fits your requirements.</p>
<p>Example code:</p>
<pre><code>function boolean hasLoop(Node startNode){
Node slowNode = Node fastNode1 = Node fastN... |
Java security in non-web app <p>Does anyone know of a good, open source security framework for java?</p>
<p>I've played with jSecurity a bit, and it seems really cool, but the documentation is so sparce I can't seem to make any progress. </p>
<p>Spring security seems web-app oriented -- but I may be wrong. </p>
<p>I... | <p>The last time I looked at Spring-Security it seemed very much web based.</p>
<p>But... the Spring guys are pretty good and I suspect that they have lot of building blocks you could use from the core Spring-Security library. </p>
|
Unix Shell scripting for copying files and creating directory <p>I have a source directory eg <strong>/my/source/directory/</strong> and a destination directory eg <strong>/my/dest/directory/</strong>, which I want to mirror with some constraints.</p>
<ul>
<li>I want to copy files which meet certain criteria of the <s... | <p>This is remarkably similar to a (closed) question: <a href="http://stackoverflow.com/questions/363209/bash-scripting-copying-files-without-overwriting/363305#363305">Bash scripting copying files without overwriting</a>. The answer I gave cites the '<code>find | cpio</code>' solution mentioned in other answers (minu... |
List of CSS features not supported by IE6 <p>I just finished slicing and coding a very nice table-less css template for my website, all the time I was testing with IE7 and Chrome.</p>
<p>Then I just had the brilliant idea of testing this template with IE6, I installed Windows XP on a Virtual PC and then I opened my we... | <p>IE6 has LOTS of CSS bugs so that will be contributing to your page rendering. <a href="http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx">The official list of what is and isn't supported is here</a>.</p>
<p>What might also help you is <a href="http://positioniseverything.net/">positioniseverything.net</a... |
Moodle / Joomla / JFusion - best development platform for e-learning, communication and information portal? <p>I've been asked to develop an information and e-learning website with an emphasis on community aspects that will also encompass a lot of other areas. There is a tight budget to this project, so I'm looking to ... | <p>Is your primary task to provide a featured LMS, custom social-type extension around an LMS, or merely content?</p>
<p>Moodle is an excellent product, and I think it's likely that you can do what you need around that, but the JFusion solution you're outlining sounds promising to me on the face of it. At that point I... |
C# data structure for multiple unit conversions <p>I have a C# app and I need to convert between 3 different units (say for example: litres, gallons, and pints). </p>
<p>The app needs to know about certain volumes of liquid, say: 1 pint, 10 pints, 20 pints and 100 pints. I intend to do the calculations and hard code t... | <p>You can store a matrix of conversion factors where</p>
<ul>
<li>a: Is litres</li>
<li>b: Is pints</li>
<li>c: Are gallons</li>
</ul>
<p>You'd have (not accurate, but assuming there are two pints to a litre and 4 litres to a gallon)</p>
<pre><code> a b c
a 1 2 0.25
b 0.5 1 0.125
c 4 ... |
Wrapping the Credential Manager API in .NETCF <p>think I successfully made a managed wrapperclass to the Credential API functions mentioned <a href="http://msdn.microsoft.com/en-us/library/aa922921.aspx" rel="nofollow">here</a> with a little help from <a href="http://blogs.msdn.com/peerchan/pages/487834.aspx" rel="nofo... | <p>The things I'd check are</p>
<ol>
<li>If you manually log in using the dialog, does it store anything at the expected credential registry key(HKLM/Comm/Security/Credman/1..)? If not, then I'd say it's pretty strong evidence that it isn't using the Cred Manager.</li>
<li>If you do manual NTLM authentication (with E... |
Any way to make Intellisense work, when opening a cs file that's not part of the project? <p>What we ideally need is, to know how Microsoft handles XAML generated code (Those *.g.cs files). If you goto a XAML code behind, intellisense will work even if the *.g.cs file is not part of the project!! </p>
<p><hr /></p>
<... | <p>Intellisense is driven by a memory cache of identifiers and types. These types are cached based on the project you are in and the references that project has. If the code file you are editing is not part of a project, Visual Studio would have to load every possible assembly and create intellisense data for each ty... |
C# ASMX webservice semi -permanant storage requirement <p>I'm writing a mock of a third-party web service to allow us to develop and test our application. </p>
<p>I have a requirement to emulate functionality that allows the user to submit data, and then at some point in the future retrieve the results of processing ... | <p>Self-answer.</p>
<p>For the pruposes of dev and test, I realised it would be easiest to limit the lifetime of the persisted objects, and use </p>
<pre><code>HttpRuntime.Cache
</code></pre>
<p>to store the objects. This has just enough flexibility to cope with my situation.</p>
|
"cloud architecture" concepts in a system architecture diagrams <p>If you design a distributed application for easy scale-out, or you just want to make use of any of the new âcloud computingâ offerings by Amazon, Google or Microsoft, there are some typical concepts or components you usually end up using:</p>
<ul>
... | <p>Here are two sets of symbols that map nicely to concepts in cloud platforms.</p>
<p>For Windows Azure:
<a href="http://davidpallmann.blogspot.com/2011/07/windows-azure-design-patterns-part-1.html" rel="nofollow">http://davidpallmann.blogspot.com/2011/07/windows-azure-design-patterns-part-1.html</a> (download <a hre... |
C#: How to make a form remember its Bounds and WindowState (Taking dual monitor setups into account) <p>I have made a class which a form can inherit from and it handles form Location, Size and State. And it works nicely. Except for one thing: </p>
<p>When you maximize the application on a different screen than your ma... | <p>There's no built in way to do this - you'll have to write the logic yourself. One reason for this is that you have to decide how to handle the case where the monitor that the window was last shown on is no longer available. This can be quite common with laptops and projectors, for example. The <a href="http://msdn.m... |
ORM or something to handle SQL tables with an order column efficiently <p>I got an Java application using SQL tables that contains an ordered list of entities, ordered by
an order column. I would like to add/remove things in/from the middle
of the list. Now, I'm wondering if some persistence framework / orm / you-name-... | <p>My advice is to do two things:</p>
<ol>
<li>Choose very large increments between your items, say one million. This way you can move an item at 8,000,000 to before 7,000,000 by changing just it to 6,500,000; and</li>
<li>Every now and again reorder the items as a batch job.</li>
</ol>
<p>The large increments don't... |
How can I keep variables from being re-initialized every time I call a C++ function? <p>How do I get past this variable initialization problem? If I only could figure out how to only initialize them only once...</p>
<pre><code>* Main.cpp : main project file.
/************************** Begin Header *************... | <p>You're doing really well! The simple answer is to write static in front of your variables:</p>
<pre><code>static int const MAX = 5; // Creat array size variable
static int lowest; // The integer it will use to store the place of the lowest jar sales in the array
static int highest; // The integer it will use to st... |
Should failing tests make the continuous build fail? <p>If one has a project that has tests that are executed as part of the build procedure on a build machine, if a set tests fail, should the entire build fail?<br />
What are the things one should consider when answering that question? Does it matter which tests are ... | <p>If it's in any way doable, then do it. It greatly reduces the <a href="http://www.pragprog.com/the-pragmatic-programmer/extracts/software-entropy">broken-window-problem</a>:</p>
<p>In a system with no (visible) flaws, introducing a small flaw is usually seen as a very bad idea. So if you've got a project with a gre... |
TFS build agent, same port as team server? <p>My team foundation is setup to use port 8080, when I am creating a new build agent it defaults to port 9191.</p>
<p>Which one should I use?</p>
<p>I am getting an error when I try and run my build, it says the build agent was unreachable.</p>
<p>I created a share on my d... | <p>Has the Build service been started? This is probably the most common issue as the service will need to be started first. And yes, 9191 is the default port for the build agents. Can you also check your firewall?</p>
|
SQL Server - Transactional Replication (partial data only) <p>I have 6 months of data, how do I replicate only the most current 3 months of data to the subscribers?</p>
| <p>You can use filtered replication. When you read examples about filtered replication, you'll probably see it referring to a branch office scenario where a single central office stores data for several branch offices, and each branch only wants to replicate their own data. It involves creating filters on a key, and ... |
Can we write a sub function or procedure inside another stored procedure - SQL Server <p>I want to check if SQL Server(2000/05/08) has the ability to write a nested stored procedure, what I meant is - WRITING a Sub Function/procedure inside another stored procedure. NOT calling another SP. </p>
<p>Why I was thinking a... | <p>It does not have that feature. It is hard to see what real benefit such a feature would provide, apart from stopping the code in the nested SPROC from being called from elsewhere.</p>
|
How to use a ThrottlingFilter for Jetty in Restlet <p>I would like to configure a webservice so that once the accept queue is full the service returns 503. Currently, these requests seem to just time out. </p>
<p>I did set paramters like <strong>maxThreads</strong> and <strong>acceptQueuesize</strong> (as described he... | <p>You won't be able to take advantage of ThrottlingFilter unless you deploy your application as a WAR file into Jetty. JettyServerHelper bootstraps Restlet as a standalone server using Jetty to accept HTTP connections and hence cannot utilize a Servlet Filter. I'm not sure if there is anyway to utilize similar process... |
SMTP server that saves all mail to a folder? <p>Are there any free SMTP servers that just accept the mail sent through them, and save it to your hard disk, without sending it to the recipient. I would like to use this for testing my applications. Instead of just waiting around for the mail to go through, it would be... | <p>You can use the standard smtp settings in your app or web.config and just specify what folder you want the emails to go.</p>
<pre><code><smtp
deliveryMethod="specifiedPickupDirectory"
from="from address">
<specifiedPickupDirectory>Your folder here</specifiedPickupDirectory>
</smtp>
</... |
How do I write a value to the registry on a Windows Mobile 5 device? <p>I have a string value that I want to write to the registry as a Dword to read via another program. How can i create a new key/string using c# .net?</p>
| <p>You need to use Microsoft.Win32.Registry to add to the mobile device registry. All of the methods have mobile support: <a href="http://msdn.microsoft.com/en-us/library/microsoft.win32.registry_members.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.win32.registry_members.aspx</a></p>
|
Best way to Implement a MySQL Hash Table? <p><strong>Background</strong></p>
<p>I'm currently developing an online community and I want to store some temporary information in a hash table. Currently this information is being stored in memcached, however, should the memcached service need to be restarted or failed, I w... | <p>You already laid out most of the solution for now: one table, three columns (probably a fourth that's a meaningless integer ID for a primary key), and an index on the hash value column. Ask again later when you have a testable / fixable problem to overcome.</p>
<p>"...premature optimization is the root of all evil"... |
Remove server.policy from sun application server <p>I encounter <code>java.lang.StackOverflowError</code> error after deployment of the java web application (<code>.war</code>). If I remove the <code>server.policy</code> file. I will not encounter this error however it means that there will be no security. I realize th... | <p>The obvious way to get a <code>StackOverflowError</code> due to having security enabled is by not giving code that is involved in security checks privileges. So I guess it's something to do with your configuration, perhaps where a codeBase has changed or exactly the same code appears in the search order before the c... |
Should I use Top(1) in a SubQuery <p>Example Query:</p>
<pre><code>select *
from A join B on A.ID = B.SOMEVALUE
where A.VALUE="something" and
B.ID =
(select ID from B where SOMEVALUE = A.ID and
THISDATE = (select max(SOMEDATE) from B where ...))
</code></pre>
<p>so, if you can read SQL you sho... | <p>Normally TOP 1 is a good idea.</p>
<p>Consider a large table with millions of rows with no index on the column you are matching, however you are only looking for a single row.</p>
<p>SELECT TOP 1 will mean the table scan stops as soon as the one item is found.</p>
<p>Without the TOP 1, the table scan will continu... |
AOP for third-party classes <p>I have used AOP within spring with no real problems, mainly for transaction management, for which it works a charm. </p>
<p>My question is this... the only examples I've seen for AOP so far is to pointcut a class that you have created yourself. Is it possible to pointcut a class within a... | <p>I think this will work:</p>
<ol>
<li>Let Spring be responsible for initializing your DataSource</li>
<li>Apply an aspect against the getConnection() method on your DataSource</li>
<li>In your advice, wrap the returned Connection in a new class ("LoggingConnection") which implements Connection and delegates all meth... |
MSDN C# ProcessController Sample <p>I've found this MSDN article that explains how to monitor processes and services with C#:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa645519(VS.71).aspx" rel="nofollow">ProcessController Sample: Demonstrates Processes and Services Monitoring</a></p>
<p>However, I can'... | <p>The information you are looking for is here:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/z9hsy596(VS.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/z9hsy596(VS.80).aspx</a></p>
<p>You need to install the Microsoft .NET Framework SDK v2.0 which comes with the QuickStart samples.</p>
<... |
Help with custom getline() function <p>Can anyone explain to me why this isn't working?</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
char *getline(int lim)
{
char c;
int i;
char *line;
line = malloc(sizeof(char) * lim);
i = 0;
while((c = getchar()) != '\n' && c !... | <p>Because you are only allocating enough space for a single character in this line:</p>
<pre><code>line = malloc(sizeof(char));
</code></pre>
<p>And that is getting filled with the <code>\0</code> before your <code>printf</code> statement.</p>
<p>I'm guessing you want to change this line to:</p>
<pre><code>/* Allo... |
Minimal hosted bug tracking <p>We are a small businesses with limited time to do this ourselves.<br>
Can anyone recommend a good (cheap, preferably) hosted solution for simple bug tracking?<br>
Right now we have three products that needs bugtracking.</p>
<p>All we need is</p>
<ul>
<li>Allow customers to submit bugs</... | <p>Hosted FogBugz will do all of that. It's free for one or two developers, $25/developer/month for more than that.</p>
|
C# - Get Field Types <p>In a C# 2.0 I have a list of fields and a list of values (stored as strings), a table name, and an ODBC Connection. </p>
<p>I need to get the data types of the fields that are on that table, so I know how to generate my sql.</p>
<p>What's the best way to get that information from what I've go... | <p>Try this</p>
<pre><code>select * from sys.columns where object_id = object_id('MyTable')
</code></pre>
<p>Hope this helps.</p>
|
C++ virtual function from constructor <p><strong>Why the following example prints "0" and what must change for it to print "1" as I expected ?</strong></p>
<pre><code>#include <iostream>
struct base {
virtual const int value() const {
return 0;
}
base() {
std::cout << value() << ... | <p>Because <code>base</code> is constructed first and hasn't "matured" into a <code>derived</code> yet. It can't call methods on an object when it can't guarantee that the object is already properly initialized.</p>
|
Paging & Sorting grids with ASP.Net MVC <p>I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the method... | <p>nowadays MVC 3 now has a webGrid out of the box. I know this question is from a while ago, but I ended up on it when looking for something about webGrid. So I thought it should have an answer mentioning the new webGrid.</p>
<p>Here are a few good posts on how to use it:</p>
<p><a href="http://www.dotnetcurry.com/S... |
Where to put using statements in a C# .cs file <p><strong>DUPE: <a href="http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace">http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace</a></strong></p>
<p>If I add a new class using Visual Studio to... | <p>See <a href="http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace">http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace</a></p>
|
is there an alternative to the Internet Developer Toolbar for IE7? <p>Does anyone know of an alternative to the <strong><a href="http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en" rel="nofollow">Internet Developer Toolbar</a></strong> for IE7 that I can use... | <p><a href="http://www.debugbar.com/" rel="nofollow">Debug Bar</a> is pretty nice, and is free for personal use. You have to pay for it if using commercially though.</p>
<p><strong>Update:</strong> I should add that it did crash once or twice when there was some fairly advanced javascript. Didn't kill the entire brows... |
Refresh NSTableView After Click - Not Refreshing <p>I have an app with a UITableView, using both icons and disclosure buttons. I want to update the icon on a row with a "selected" icon, and update the previously-selected row with an "unselected" icon. I have the code in place, but when I click on the rows, it sets bo... | <p>Have you tried <code>[tableView reloadData]</code>?</p>
|
Where to find novice SAP BAPI coding guides? <p>I've been working with applications interfacing with SAP via a web service for a little while now and I want to get into programming the BAPI's behind the web services as well. My company has been using a SAP consultant for the BAPI programming and I'd like to move into f... | <p>I'm not sure about online resources, but there are a couple of quite good books to learn ABAP programming, you'd be looking for ABAP basics and/or ABAP objects (the latter one sounds better and more "advanced" but is typically just a more modern version of the language). One suggestion I've used in the past that is ... |
ActionScript 2, list of nested movieclips <p>has anyone ever tried to get the list of all the movieclips (even the nested ones) that are on Stage at a specified stopped (and current) frame in Flash 8, AS 2?</p>
<p>I did the following:</p>
<pre><code>for(i in _root){
if(typeof(_root[i])=="movieclip"){
trace(_root[i]);... | <p>exactly as suggested by inkedmn</p>
<p>printStuff first checks to see if the value it finds is a mc then if it is, traces and then checks inside it for more mcs.</p>
<pre><code>printStuff = function(object){
for(var x in object){
if(typeof(object[x])=="movieclip"){
trace(object[x]);
... |
Should you request timeouts on locks in .NET? <p>In <a href="http://www.pragprog.com/titles/mnee">Release It!</a>, Michael Nygard reasons that many catastrophic system failures are often caused by a chain of things going wrong. For example, two threads deadlock. There's now two less threads in the thread pool, so load ... | <p>I normally do use timeouts. The biggest issue here is that if the timeout is reached, the requesting operation is going to be aborted. This is obviously preferrable to deadlocking. There's a bigger problem there though: if the operation is critical and you start aborting because something else is deadlocked, if your... |
Inserting Dates into HTML Table Cells <p>I am wanting to have a series of dates (mainly Month, Day, Year) displayed within a vertical arrangement of table cells on a web page. The first date needs to be the current date minus one day, with the next date in the sequence be the current date, The remaining dates need to ... | <p>Try this:</p>
<p>HTML</p>
<pre><code><table id="myTable"></table>
</code></pre>
<p>JavaScript</p>
<pre><code>var table = document.getElementById('myTable')
var myDate = new Date();
myDate.setDate(myDate.getDate() - 1)
for(var i = 0; i < 16; i++)
{
var row = document.createElement('TR');
va... |
How can I test if IIRF works? <p><a href="http://www.codeplex.com/IIRF/Thread/List.aspx" rel="nofollow">http://www.codeplex.com/IIRF/Thread/List.aspx</a></p>
<p>My webhost installed IIRF for me and I am convinced that they did not do it correctly. I've tried numerous examples including one that I know works with apach... | <p>The new version of <a href="http://iirf.codeplex.com">IIRF</a>, v1.2.16 R3, includes a StatusUrl directive that will give you a status page if you do an HTTP GET on it. It looks like this:
<img src="http://i38.tinypic.com/23kaz3d.png" alt="IIRF Status page" /></p>
<p>If you get that page, then IIRF is running.</... |
Advice needed on REST URL to be given to 3rd parties to access my site <p><strong>Important: This question isn't actually really an ASP.NET question.</strong> Anyone who knows anything about URLS can answer it. I just happen to be using ASP.NET routing so included that detail.</p>
<p>In a nutshell my question is : </p... | <p>This URL:</p>
<pre><code>"campaign/{destination}/{partnerid}/{campaignid}/{custom}",
</code></pre>
<p>...doesn't look like a resource to me, it looks like a remote method call. There is a lot of business logic here which is likely to change in the future. Also, it's complicated. My gut instinct when designing URLs... |
Gridlines in excel through interop <p>Any idea where the setting is hiding for turning gridlines off while using excel 2003 from interop? </p>
| <p>DisplayGridlines is a method on an Excel Window object.
For example:</p>
<pre><code>ActiveWindow.DisplayGridlines = true
</code></pre>
|
What is the most effective way to present and communicate a performance improvement (e.g. percentages, raw data, graphics)? <p>Is it better to describe improvements using percentages or just the differences in the numbers? For example if you improved the performance of a critical ETL SQL Query from 4000 msecs to 312 m... | <p>In currency. Money is the most effective medium for communicating value, which is what you're trying to use the performance review to demonstrate.</p>
<p>Person hours saved, (very roughly) estimated value of $NEW_THING_THE_COMPANY_CAN_DO_AS_RESULT, future hardware upgrades averted, etc.</p>
<p>You get the nice bon... |
Data mapper pattern and automated updates of other objects <p>I'm building a PHP application using the data mapper pattern to separate my DB from the domain objects. I have a mapper class that returns Site objects based on data from the DB and accepts existing Site objects to be saved back to the DB.</p>
<p>My problem... | <p>Sounds like a job for a database trigger.</p>
<pre><code>DELIMITER $$
CREATE TRIGGER test_trigger AFTER INSERT ON table
FOR EACH ROW BEGIN
IF NEW.isPrimary = 1 THEN
UPDATE table
SET isPrimary = 0
WHERE id <> NEW.id;
END IF;
END$$
DELIMITER ;
</code></pre>
|
Mathematical formula for calculating call duration <p>I was working for a telecom company some years ago and I had to generate a formula which calculates duration of a call according to the following algorithm:</p>
<ul>
<li>t1 is the first period </li>
<li>t2 is the recurring period</li>
<li>RCT is the actual call ti... | <p>Assuming int columns:</p>
<pre><code>SELECT t1
,t2
,RCT
CASE
WHEN RCT < t1
THEN t1
ELSE
t1 + t2 * ((RCT - t1) / t2 + SIGN((RCT - t1) % t2))
END AS CD
</code></pre>
<p>But I guess there is still one CASE, let me see if I can get rid of it.</p>
<p>With only integer arithm... |
Logging causing XML Parsing to break? <p>I'm seeing something very very strange happening in a Flex app I'm maintaining.</p>
<p>I've been going through it removing all calls to trace() and replacing it with calls into the logging framework (using the built in mx.logging stuff). After doing so some XML parsing code su... | <p>That's a tough one. I never used the logging classes, so I'm unsure of that part of the question, but converting an XMLList to XML like you do:</p>
<pre><code>var cityXML:XML = new XML(xml..city);
</code></pre>
<p>works only if the XMLList contains a single item, otherwise you get the warning you quoted. Try the f... |
What's wrong with my javascript? Fading images <p>I'm trying to make Javascript change the style of certain DIV IDs by changing their background every few seconds. Basically, a fading header...here's my code, and it just doesn't change the background, at all.</p>
<p>How do you call a function?</p>
<p><a href="http://... | <p>Your javascript is in functions and isn't being called from anywhere. Try calling one of the functions from window.onload, or $(document).ready(function(){ }); if you're using jQuery</p>
|
Safely override C++ virtual functions <p>I have a base class with a virtual function and I want to override that function in a derived class. Is there some way to make the compiler check if the function I declared in the derived class actually overrides a function in the base class? I would like to add some macro or so... | <p>Since g++ 4.7 it does understand the new C++11 <code>override</code> keyword:</p>
<pre><code>class child : public parent {
public:
// force handle_event to override a existing function in parent
// error out if the function with the correct signature does not exist
virtual void handle_event(in... |
What's a simple way to undelete a file in subversion? <p>These instructions are a little intimidating and confusing: <a href="http://svnbook.red-bean.com/en/1.0/ch04s04.html#svn-ch-4-sect-4.3">http://svnbook.red-bean.com/en/1.0/ch04s04.html#svn-ch-4-sect-4.3</a> .
And also they don't seem to mention that it's much simp... | <p>If you just did</p>
<pre><code>svn rm foo.txt
</code></pre>
<p>then you can undo that with simply</p>
<pre><code>svn revert foo.txt
</code></pre>
<p>If you already checked in after doing the "<code>svn rm</code>" then you can look at the log (<code>svn log</code>), find the last revision where the file existed, ... |
How can I simulate key presses to any currently focused window? <p>I am trying to change the keys my keyboard sends to applications. I've already created a global hook and can prevent the keys I want, but I want to now send a new key in place. Here's my hook proc:</p>
<pre><code>LRESULT __declspec (dllexport) HookProc... | <p>Calling keybd_event is correct. If all you're doing is a key up, maybe the window processes the key down message instead. You really need to send a key down followed by a key up:</p>
<pre><code>keybd_event(VK_UP, 75, 0, NULL);
keybd_event(VK_UP, 75, KEYEVENTF_KEYUP, NULL);
</code></pre>
<p>Or, better yet, send t... |
Are you using Virtual Machine as your primary development enviroment? <p>Recently I have purchased a notebook that cames with Windows Home Basic (that don't have with ASP.Net/IIS. I thought in upgrade the Windows version to one with ASP.Net/IIS, but I thought in another possibility:</p>
<p>I have an Hard Disk Case wit... | <p>I use VMWare and Microsoft VPC-based VMs quite a lot, hosted in a Quad 6600-based XP Pro box.</p>
<p>My use of VMs was initially to test in different environments, and for debugging I've had to install SQL Server and VS2008 in one or two of them.</p>
<p>For those purposes, VMs are very convenient.</p>
<p>But base... |
What's the use of yield break? <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/231893/what-does-yield-break-do-in-c">What does âyield break;â do in C#?</a> </p>
</blockquote>
<p>Can anyone see a use for the "yield break" statement that could not have been... | <p>To give a code example, say you want to write an iterator that returns nothing if the source is null or empty.</p>
<pre><code>public IEnumerable<T> EnumerateThroughNull<T>(IEnumerable<T> source)
{
if (source == null)
yield break;
foreach (T item in source)
yield return ite... |
How can I make Tomcat pre-compile JSPs on startup? <p>We're using both Apache Tomcat 6.0 and Jetty 6 where I work. We mostly use Jetty for testing (it's great for running embedded in JUnit tests) and Tomcat for production.</p>
<p>By default, Tomcat compiles JSPs on-the-fly as users request them. But this results in ... | <p><a href="http://www.devshed.com/c/a/BrainDump/Tomcat-Capacity-Planning/" rel="nofollow">http://www.devshed.com/c/a/BrainDump/Tomcat-Capacity-Planning/</a></p>
<p><hr /></p>
<pre><code> project name="pre-compile-jsps" default="compile-jsp-servlets">
<!-- Private properties. -- >
<property name="... |
How to execute ANT tasks on only files that have been modified <p>I have a build script that does a number of things (minimize javascript, upload to amazon s3 etc). The minimize ANT task only operates on the javascript that I have modified and ignores the rest (I didn't write this script). I would like to do something ... | <p>You can select a fileset with a modified date tag. The modified tag is insanely powerful, so check it out: <a href="http://ant.apache.org/manual/Types/selectors.html#modified">Ant Selectors - Modified</a>.</p>
<p>In order for it to tell what has changed, it can keep a cache in a property file, which updates after e... |
Learning Clojure without Java Knowledge <p>Ok, so I'm psyched about another list. I got myself a copy of the beta Clojure programming book...</p>
<p>And the one thing I'm noticing most is that it's assumed I know... like all the major java classes.</p>
<p>Except, generally, I don't really care about Java. I just wa... | <p>Umm, actually, though Clojure was developed with Java developers considered, it was not written <em>for</em> Java programmers. </p>
<blockquote>
<p>Clojure is designed to interoperate well in the Java environment.</p>
</blockquote>
<p>Although it does, this is not <em>what</em> it was designed for (at least not ... |
Fact check: how vulnerable are .NET apps to decompilation? <p>I came across <a href="http://msmobiles.com/news.php/7973.html" rel="nofollow">this post</a> on the MSMobiles.com blog that says the following, among other things:</p>
<blockquote>
<p>.Net is great in so many ways but for
commercial apps? No way! Anybod... | <p>I would argue it is largely non-sense for the simple reason that if your competitive advantage and business success is dependent on some algorithm in your code then you are screwed already. Successful apps are about so much more than just the code, it is one of many pieces.</p>
<p>If this is something you really fe... |
Converting a repository from git to subversion <p>Reasons for doing this aside, is there a reasonable way to <strong>convert an entire git repository to subversion</strong>?</p>
<p>I can find only tons on information on migrating <em>from</em> subversion <em>to</em> git, and exchanging changesets between the two, but ... | <p>The general problem with doing conversions this direction is that Git repositories can contain more than just a linear history of revisions, as Subversion would expect. Multiple ancestries with divergent histories and frequent merge commits are all possible, which can't be easily represented in a Subversion reposito... |
How to best clean up resources for .NET application? <p>What are the best way or method of best practise to ensure that a Winforms .NET application releases all the resources it consumed in the lifecycle of its execution?</p>
<p>In particular, the release of file handles and images.</p>
<p>Thanks.</p>
| <p>If your implementation is whiteboxed then calling Close on file stream should close it's memory stream.</p>
<p>If class implements IDisposable just use the using block if in C# so the resource will be disposed:</p>
<pre><code>using (var foo = new Foo())
{
// Do some stuff to foo
}
</code></pre>
<p>If you are ... |
Programmatically create shortcut keys combo for desktop "shortcut" <p>Is there a way through code, or through the creation of a setup project (via VS), to create a desktop shortcut <strong>with a keyboard shortcut pre-defined</strong>?</p>
<p><img src="http://img89.imageshack.us/img89/8066/shortcutce8.jpg" alt="alt te... | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/bb774950(VS.85).aspx" rel="nofollow">IShellLink interface</a>, HotKey method to define a hotkey.</p>
|
Pass arguments into C program from command line <p>So I'm in Linux and I want to have a program accept arguments when you execute it from the command line.</p>
<p>For example, </p>
<p><code>./myprogram 42 -b -s</code></p>
<p>So then the program would store that number 42 as an int and execute certain parts of code d... | <p>You could use <a href="http://www.gnu.org/software/libtool/manual/libc/Getopt.html">getopt</a>.</p>
<pre><code> #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main (int argc, char **argv)
{
int bflag = 0;
int sflag = 0;
int index;
int c;
... |
Need help in login validation using javascript <p>Please could somebody point me out what is the error here? Using javascript i am validating the user input. When i click the login button without checking the javascript function, it goes to the welcome page. Here is my code:</p>
<pre><code><script type="text/javasc... | <p>I see that you're using ASP .NET (the Page_Load event on your posted code).</p>
<p>I think that will be easier to handle validation through <a href="http://www.w3schools.com/aspnet/aspnet_refvalidationcontrols.asp" rel="nofollow">ASP .NET Validation Controls</a>, i.e. <a href="http://www.w3schools.com/ASPNET/contro... |
An object reference is required for the nonstatic field, method, or property on a Windows form <pre><code>namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click... | <p>It looks like you are calling a non static property from a static method. You will need to either make the property static, or create an instance of Form1.</p>
<pre><code>static void SetTextboxTextSafe(int result)
{
label1.Text = result.ToString();
}
</code></pre>
<p>OR</p>
<pre><code>private static void Sum... |
create service on windows <p>I am having trouble starting my service on my pc. My code is based on this article <a href="http://www.gamedev.net/reference/articles/article1899.asp" rel="nofollow">http://www.gamedev.net/reference/articles/article1899.asp</a></p>
<p>When i call installService from my int main(int argc, c... | <p>Maybe you can use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow">Process Monitor</a> to find out what's wrong. </p>
<p>Start it, and look for <code>NAME NOT FOUND</code> results that occur in connection with the service start.</p>
|
Web services and interface compatibility <p>Adding a service reference to a web service (this is all WCF) in Visual Studio produces some generated code including a client-side restatement of the interface being exposed.</p>
<p>I understand why this interface is generated: you might be consuming a 3rd party service and... | <p>If you already have the contract dll at the client, you don't even need a service reference (unless you are using it to write the setup code for you) - you can simply subclass ClientBase and expose the Channel, and use that directly - something like (no IDE handy...):</p>
<pre><code>public class WcfClient<T> ... |
Open a new tab in firefox and keep ff in the background <p>Is the a way to programmatically open a URL in a new tab in firefox without firefox gaining focus?<br><br>
What I found out so far:<br></p>
<ul><li><code>firefox -new-window <URL></code> lets ff stay in the background, but opens a new window instead of a... | <p>If you set browser.tabs.loadDivertedInBackground to true in about:config then -new-tab will open tabs in the background and not focus the window. This does more than you (or I) want but perhaps it is a suitable work-around for you?</p>
|
iPhone Development - Keyboard does not automatically adjust when taking input using TextField placed in a TableView <p>I just downloaded 2.2.1 and i've seen that my input view does not adjust itself when an input field (NSTextField) is selected. Earlier the view was adjusting itself w.r.t keyboard.</p>
<p>I was using ... | <p>This was a bug, which has been fixed by Apple.</p>
|
Is Django a good choice for a security critical application? <p>Is Django a good choice for a security critical application?</p>
<p>I am asking this because most of the online banking software is built using Java. Is there any real reason for this?</p>
| <p>Actually, the security in Java and Python is the same. Digest-only password handling, cookies that timeout rapidly, careful deletion of sessions, multi-factor authentication. None of this is unique to a Java framework or a Python framework like Django.</p>
<p>Django, indeed, has a security backend architecture th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.