input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Is there a function in Delphi to get the current executing thread? <p>I want a function like GetCurrentThread which returns a TThread object of the current executing thread. I know there is a Win32 API call GetCurrentThread, but it returns the thread Id. If there is a possibility to get TThread object from that ID that... | <p>The latest version of Delphi, Delphi 2009, has a CurrentThread class property on the TThread class.</p>
<p>This will return the proper Delphi thread object if it's a native thread. If the thread is an "alien" thread, i.e. created using some other mechanism or on a callback from a third party thread, then it will cr... |
How do I specify the exit code of a console application in .NET? <p>I have a trivial console application in .NET. It's just a test part of a larger application. I'd like to specify the "exit code" of my console application. How do I do this?</p>
| <p>You can return it from <code>Main</code> if you declare your <code>Main</code> method to return <code>int</code>, or call <a href="https://msdn.microsoft.com/en-us/library/system.environment.exit.aspx"><code>Environment.Exit(code)</code></a>.</p>
|
Invert 4x4 matrix - Numerical most stable solution needed <p>I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact).</p>
<p>With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me ... | <p>Meta-answer: Is it really a general 4x4 matrix? If your matrix has a special form, then there are direct formulas for inverting that would be fast and keep your operation count down.</p>
<p>For example, if it's a standard homogenous coordinate transform from graphics, like:</p>
<pre><code>[ux vx wx tx]
[uy vy wy... |
Remote print module in Java <p>I am working on an application that will sport a web-based point of sale interface.</p>
<p>The point of sale PC (I am not sure as of now whether it will run on Linux or Windows) must have a fiscal printer attached to it, but like any web app, it is the server which processes all stuff. B... | <p>I did something similar to this a couple of yrs. ago. But in my case the server and the PC where in the same lan. Is your PoS within the lan? If so, I'll explain it to you.</p>
<p>In the mean time, if you have the "little app" covered you can take a look at the following:</p>
<p><a href="http://java.sun.com/j2se/1... |
Safehandle in C# <p>What is SafeHandle? how does it differ from IntPtr? When should I use one? What are its advantages?</p>
| <p>I think <a href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.safehandle.aspx">MSDN</a> is pretty clear in definition:</p>
<blockquote>
<p>The SafeHandle class provides critical
finalization of handle resources,
preventing handles from being
reclaimed prematurely by garbage
colle... |
How do I configure visual studio to use the code view as the default view for Webservices? <p>When you double click on a class (in 'solution explorer')... if that class happens to be an .asmx.cs webservice... then you get this...</p>
<blockquote>
<p>To add components to your class, drag
them from the Toolbox and u... | <p>You can set the default editor for any given file type (.cs, .xml, .xsd, etc). To change the default editor for a given type:</p>
<ol>
<li>Right-click a file of that type in
your project, and select "Open
With..."</li>
<li>Select your preferred editor. You
may want "CSharp Editor".</li>
<li>Click "Set as Default".... |
How do I declare an impicitly typed variable in VB inline in an ASP.Net page? <p>I want to do the following but in VB: </p>
<p><%=var t = ViewData.Model%></p>
| <pre><code><% Dim t = ViewData.Model %>
</code></pre>
<p>VB doesn't use a special keyword for implicitly typed variables... just Dim.</p>
|
PHP Session data not being saved <p>I have one of those "I swear I didn't touch the server" situations. I honestly didn't touch any of the php scripts. The problem I am having is that php data is not being saved across different pages or page refreshes. I know a new session is being created correctly because I can set ... | <p>Thanks for all the helpful info. It turns out that my host changed servers and started using a different session save path other than /var/php_sessions which didn't exist anymore. A solution would have been to declare <code>ini_set(' session.save_path','SOME WRITABLE PATH');</code> in all my script files but that wo... |
Launch web page from my application in Linux <p>I have an application that launches a webpage in the "current" browser when the user selects it. This part of my app works fine in the Windows version but I can't figure out how to do this in Linux build.</p>
<p>Right now the Linux version is hardcoded for Firefox in a s... | <p>If you're writing this for modern distros, you can use <code>xdg-open</code>:</p>
<pre><code>$ xdg-open http://google.com/
</code></pre>
<p>If you're on an older version you'll have to use a desktop-specific command like <code>gnome-open</code> or <code>exo-open</code>.</p>
|
Source code management strategies - branching, tagging, forking, etc. - for web apps <p>This posting here (<a href="http://stackoverflow.com/questions/156044/how-do-you-manage-database-revisions-on-a-medium-sized-project-with-branches">http://stackoverflow.com/questions/156044/how-do-you-manage-database-revisions-on-a-... | <p>Branching is handy if you expect the work to NOT be completed on time, and you do not have a sufficient body of tests to make continuous integration work. I tend to see branch-crazy development in shops where the programming tasks are far too big to complete predictably and so management wants to wait until just be... |
Python Dependency Injection Framework <p>Is there a framework equivalent to Guice (<a href="http://code.google.com/p/google-guice">http://code.google.com/p/google-guice</a>) for Python?</p>
| <p><a href="http://springpython.webfactional.com">Spring Python</a> is an offshoot of the Java-based Spring Framework and Spring Security, targeted for Python. This project currently contains the following features:</p>
<ul>
<li><a href="http://martinfowler.com/articles/injection.html">Inversion Of Control (dependency... |
Using Mercurial, is there an easy way to diff my working copy with the tip file in the default remote repository <p>When using mercurial, I'd like to be able to diff the working copy of a file with the tip file in my default remote repository. Is there an easy way to do this?</p>
<p>I know I can do an "hg incoming -p... | <p>After some digging, I came across the "http://www.selenic.com/mercurial/wiki/index.cgi/RdiffExtension'>rdiff" extension that does most of what I want it to.</p>
<p>It doesn't come with mercurial, but it can be installed by cloning the repository:</p>
<pre><code>hg clone http://hg.kublai.com/mercurial/extensions/rd... |
Get timer ticks in Python <p>I'm just trying to time a piece of code. The pseudocode looks like:</p>
<pre><code>start = get_ticks()
do_long_code()
print "It took " + (get_ticks() - start) + " seconds."
</code></pre>
<p>How does this look in Python?</p>
<p>More specifically, how do I get the number of ticks since mid... | <p>In the <code>time</code> module, there are two timing functions: <code>time</code> and <code>clock</code>. <code>time</code> gives you "wall" time, if this is what you care about.</p>
<p>However, the python <a href="http://docs.python.org/lib/module-time.html">docs</a> say that <code>clock</code> should be used for... |
Get all items from thread Queue <p>I have one thread that writes results into a Queue.</p>
<p>In another thread (GUI), I periodically (in the IDLE event) check if there are results in the queue, like this:</p>
<pre><code>def queue_get_all(q):
items = []
while 1:
try:
items.append(q.get_now... | <p>If you're always pulling all available items off the queue, is there any real point in using a queue, rather than just a list with a lock? ie:</p>
<pre><code>from __future__ import with_statement
import threading
class ItemStore(object):
def __init__(self):
self.lock = threading.Lock()
self.it... |
Regexp recognition of email address hard? <p>I recently read somewhere that writing a regexp to match an email address, taking into account all the variations and possibilities of the standard is extremely hard and is significantly more complicated than what one would initially assume.</p>
<p>Can anyone provide some i... | <p>For the <em>formal</em> e-mail spec, yes, it is technically impossible via Regex due to the recursion of things like comments (especially if you don't remove comments to whitespace first), and the various different formats (an e-mail address isn't always someone@somewhere.tld). You can get close (with some massive a... |
How to write an Excel workbook to a MemoryStream in .NET? <p>How do I write an Excel workbook to a <code>MemoryStream</code> without first saving it to the file system?</p>
<p>All options within the <code>Microsoft.Office.Interop.Excel.WorkBook</code> save options take a filename.</p>
| <p>I have done extensive work with the PIA and with storing Excel files in a document repository and streaming it out to the browser, and I have not been able to find a solution to using the PIA without first writing the contents to the file system first.</p>
<p>I think that you are going to have to swallow the bullet... |
Increase Stack Size on Windows (GCC) <p>Is there a way to increase the stack size of a Windows application at compile/link time with GCC?</p>
| <p>IIRC, In GCC you can provide the --stack,[bytes] parameter to ld.</p>
<p>E.g.</p>
<pre><code>gcc -Wl,--stack,16777216 -o file.exe file.c
</code></pre>
<p>To have a stack of 16MiB, I think that the default size is 8MiB.</p>
|
What is the best way to handle English and Chinese in a Flex application? <p>I have a requirement to be able to provide a flex component in English and several asian languages. I have looked at the flex documentation and it seems that I have to build several swf's, which feels wrong. </p>
<p>Does anyone know of a st... | <p>I guess you know the basics of how to localize a Flex application, but if you would like to know more there's a good and thorough description here: <a href="http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:_Runtime_Localization" rel="nofollow">Runtime Localization</a>.</p>
<p>In Flex 3 you have thr... |
Does the last element in a loop deserve a separate treatment? <p>When reviewing, I sometimes encounter this kind of loop:</p>
<pre><code>i = begin
while ( i != end ) {
// ... do stuff
if ( i == end-1 (the one-but-last element) ) {
... do other stuff
}
increment i
}
</code></pre>
<p>Then I ask th... | <p>I don't think this question should be answered by a principle (e.g. "in a loop, treat every element equally"). Instead, you can look at two factors to evaluate if an implementation is good or bad:</p>
<ol>
<li>Runtime effectivity - does the compiled code run fast, or would it be faster doing it differently?</li>
<l... |
What do you like/dislike about development user groups? <p>I run a non profit based .net user group called DevEvening (<a href="http://www.devevening.co.uk" rel="nofollow">http://www.devevening.co.uk</a>) and am always looking to improve it. </p>
<p>I wondered what people liked and disliked about user groups and what ... | <p>I don't much like developer user groups, as I find that the quality of feedback you get in a site such as this is so much better than you get in a limited geographical area. The principal reason i'd attend is to meet someone I already knew from the web and maybe have a few beers. That said, Microsoft are really ma... |
Hooking up Reporting Services 2005SP2 to SQL Server 2008 <p>I am trying to configure Reporting Services 2005SP2 on a machine with SQL 2008 on another hosting the ReportServer DB.</p>
<p>When I create the ReportServerDB the DB is created as version C.0.9.45:</p>
<p>When, afterwards, I try to initialise Reporting Servi... | <p>I got a reply from microsoft support saying that it is impossible on the same box.</p>
<p><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4153333&SiteID=1" rel="nofollow">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4153333&SiteID=1</a></p>
|
Is there any website which showcase nice / comprehensive build.xml? <p>What i mean exactly is that build.xml that actually included those plugins like findbugs etc. Or nicely done build.xml </p>
| <p>A great resource for sample Ant build files is Google code search. <a href="http://code.google.com/search/#q=build.xml" rel="nofollow">Search Google Code for build.xml</a>. Once you search, narrow it down to "Project Hosting" to get the real meat. You will find dozens of examples of real, working, usable build.xml f... |
Silverlight display problem <p>I have created a nice silverlight control doing exactly what I want it to do, and it looks great :) When I host it in the test projects ASPX sample file or the HTML sample file it shows up nicely.</p>
<p>I now have to use the control in my existing ASP.NET 2.0 project, which has a fancy ... | <p>Found the cause myself...</p>
<p>It turns out Silverlight has a display problem when the control is placed in a html table. <a href="http://silverlight.net/forums/p/20863/72280.aspx" rel="nofollow">Found information about this on the silverlight forum</a>. It was about the beta 2, but I have upgraded to the release... |
Download files to local drive when sshed <p>What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like... | <p>I'm also running Ubuntu 8.04.1, and if I type</p>
<pre><code>$ scp me@myserver.mydomain.com:.bashr<TAB>
</code></pre>
<p>I do indeed get tab completion (i.e. bash is sshing to my server and getting completion results from the filesystem there). Then</p>
<pre><code>$ scp me@myserver.mydomain.com:.bashrc .
<... |
database synchronization - SFTP / RMAN / By codes? <p>Which method you all will recommend and why?</p>
| <p>Since you mention RMAN, may I assume that you are talking in particular about an Oracle database? Or are you talking about a more generic problem?</p>
<p>What is the business purpose of synchronizing the databases? That is going to strongly influence the choice of technology. In the Oracle world, you would have ... |
How to communicate between CE 6.0 device (as server) and PC (as client) <p>We're in the process of developing a measurement device that will be running
CE 6.0 with CF 3.5 on x86 embedded hardware, a PC is used to control the
device and is connected with it using ethernet.</p>
<p>We would like to communicate using in... | <p>If you're using CE 6 and .NET Compact Framework 3.5, have you considered using the Windows Communication Foundation (WCF)? You'd have to write your own transport, but when that is done, you will be able to consume your service interfaces with relative ease. </p>
|
Controlling the WCF XmlSerializer <p>I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements.</p>
<p>The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possible to h... | <p><em>"I know it is possible to hook XmlSerializer.UnknownElement and throw an exception from this handler, but because this is in WCF I have no control over serialization"</em></p>
<p>Its actually possible to do this...</p>
<p>In a WCF project that I worked on, we did something similar using the IDispatchMessageFor... |
Classic ASP Intranet and New ASP.NET Applications <p>We have an existing classic ASP intranet consisting of hundreds of pages. Its directory structure looks like this...</p>
<pre><code>/root
app_1
app_2
...
img
js
style
</code></pre>
<p>Obviously app_1 and so on have better names in the actual... | <p>One solution would be to use IIS Manager to configure the website (created for your ASP.NET app by Visual Studio) and add a virtual directory for each of the common folders so that (by the 'virtual' nature of the virtual directory) they will 'appear' to be in the same root folder as your ASP.NET app.</p>
<pre><code... |
Is the web hosting location important these days? <p>I was recently looking at some web hosting solutions and some of the providers offered various hosting locations e.g. US or UK based servers.</p>
<p>My question is: does it really make a difference from the performance point of view?
Lets say that I am expecting mo... | <p>Yes, distance = latency = slower. That's why Google, Amazon, and the other big sites have multiple datacenters in different regions and even continents.</p>
|
iSeries SQL Procedure - Check if already exists <p>I have an script that falls over if any of the procedures it is trying to create already exists. How can I check/drop if this procedure is already created?</p>
| <p>I would guess something along the lines of:</p>
<pre><code>IF EXISTS
(
SELECT *
FROM SYSPROCS
WHERE SPECIFIC_SCHEMA = ???
AND SPECIFIC_NAME = ???
AND ROUTINE_SCHEMA = ???
AND ROUTINE_NAME = ???
)
DROP PROCEDURE ???
</code></pre>
<p>I don't know if you actually need the SPECIFIC_* ... |
In javaDoc, what's the best way of representing attributes in XML? <p>When you're adding javaDoc comments to your code and you're outlining the structure of an XML document that you're passing back, what's the best way to represent attributes? Is there a best practice for this?</p>
<p>My general structure for my javaD... | <p>Not sure I clearly understand your question.</p>
<p>My preferred solution would be to embed the schema XSD or DTC in the description of the return parameter. Your solution seems to lead to personal idioms on how to represent things like multiple elements or others. Using a standard like XSD or DTD allows you to ha... |
What's the best way to loop through a set of elements in JavaScript? <p>In the past and with most my current projects I tend to use a for loop like this:</p>
<pre><code>var elements = document.getElementsByTagName('div');
for (var i=0; i<elements.length; i++) {
doSomething(elements[i]);
}
</code></pre>
<p>I've... | <p>Here's a nice form of a loop I often use. You create the iterated variable from the for statement and you don't need to check the length property, which can be expensive specially when iterating through a NodeList. However, <strong>you must be careful</strong>, you <strong>can't use it if any of the values in array ... |
Dynamically instantiate a Ruby class similar to Java <p>How can this line in Java be translated to Ruby:<br />
String className = "java.util.Vector";<br />
...<br />
Object o = Class.forName(className).newInstance(); </p>
<p>Thanks!</p>
| <pre><code>Object::const_get('String').new()
</code></pre>
|
Singular/plural searches and stemming <p>I'm discovering a simple solution for singular-plural keywords searches. I heard about stemming but I don't want to use all its features, only plural/singular transformation. The language is Dutch. Have looked at <a href="http://www.snowball.tartarus.org" rel="nofollow">http://w... | <p>Use a dictionary, a list of stopwords (those you don't want to singularize) plus the rules for the language. If you don't know Dutch then I cannot help you, but show you how it'd be done in Spanish, for instance:</p>
<ul>
<li>Plurals end with s, if it doesn't then it's done
<ul>
<li>If it ends with s,
<ul>
<li>che... |
Data generators for SQL server? <p>I would like to receive suggestions on the data generators that are available, for SQL server. If posting a response, please provide any features that you think are important. </p>
<p>I have never used a application like this, so I am looking to be educated on the topic. Thank you.</... | <p>I have used the <a href="http://www.generatedata.com/#generator">data generator</a> in the past. May be worth a look.</p>
|
Table Column Formatting <p>I'm trying to format a column in a <code><table/></code> using a <code><col/></code> element. I can set <code>background-color</code>, <code>width</code>, etc., but can't set the <code>font-weight</code>. Why doesn't it work?</p>
<pre><code><table>
<col style="font-w... | <p>As far as I know, you can only format the following using CSS on the <code><col></code> element: </p>
<ul>
<li>background-color</li>
<li>border</li>
<li>width</li>
<li>visibility</li>
</ul>
<p>This <a href="http://www.quirksmode.org/css/columns.html">page</a> has more info.</p>
<p>Herb is right - it's bette... |
CSS Layout, Vis Studio 2005, and AJAX Tab Container <p>In a C# Web app, VS 2005 (I am avoiding 2008 because I find the IDE to be hard to deal with), I am getting into a layout stew.</p>
<p>I am moving from absolute positioning toward CSS relative positioning.</p>
<p>I'd like to divide the screen into four blocks: top... | <p>So far as I know, there's nothing specific to ASP.NET, and you are right (at least in 2008) about it not using referenced stylesheets.</p>
<p>These may be of use to you, however:</p>
<p><a href="http://www.positioniseverything.net/" rel="nofollow">http://www.positioniseverything.net/</a> - Position is Everything, ... |
How to position one element relative to another with jQuery? <p>I have a hidden DIV which contains a toolbar-like menu.</p>
<p>I have a number of DIVs which are enabled to show the menu DIV when the mouse hovers over them.</p>
<p>Is there a built-in function which will move the menu DIV to the top right of the active... | <p><strong>tl;dr:</strong> (try it <a href="http://jsfiddle.net/wjbuys/QrrpB/">here</a>)</p>
<p>If you have the following HTML:</p>
<pre><code><div id="menu" style="display: none;">
<!-- menu stuff in here -->
<ul><li>Menu item</li></ul>
</div>
<div class="parent"&g... |
Math.IEEERemainder returns negative results. Why? <p>The .net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces.</p>
<p>Example:</p>
<pre><code>Math.IEEERemainder(0, 2) = 0
Math.IEEERema... | <p>If you read the example given at <a href="http://msdn.microsoft.com/en-us/library/system.math.ieeeremainder.aspx" rel="nofollow">System.Math.IEEERemainder's MSDN page</a>, you'll notice that two positive numbers can have a negative remainder.</p>
<blockquote>
<p><strong>Return Value</strong></p>
<p>A number ... |
Upgrading SVN 1.4 to 1.5.3 and CC.Net from 1.3 to 1.4 <p>I think this is a multi-part question, so bear with me.</p>
<p>Currently all of our developers use the version of Tortise built for SVN 1.4 and our SVN server is running 1.4. Our build server is running CC.Net and is using SVN 1.4.</p>
<p>We want to upgrade. </... | <p>Hard to answer as it seems you're asking for a plan for your environment, which I'm not in.</p>
<p>However, here's what I'd do:</p>
<ul>
<li>Upgrade cc.net (you have a known good starting point, and this is the most likely breaking step. do it without any other variables so it is easier to roll back)</li>
<li>Tes... |
How do I set up a mock queue using mockrunner to test an xml filter? <p>I'm using the mockrunner package from <a href="http://mockrunner.sourceforge.net/" rel="nofollow">http://mockrunner.sourceforge.net/</a> to set up a mock queue for JUnit testing an XML filter which operates like this:</p>
<ol>
<li>sets recognized ... | <p>I'd recommend having a look at using <a href="http://activemq.apache.org/camel/" rel="nofollow">Apache Camel</a> to create your test case. Then its really easy to switch your test case from any of the <a href="http://activemq.apache.org/camel/components.html" rel="nofollow">available components</a> and most importan... |
Tool for translation of Oracle PL/SQL into Postgresql PL/pgSQL <p>Is there a tool (preferably free) which will translate Oracle's PL/SQL stored procedure language into Postgresql's PL/pgSQL stored procedure language?</p>
| <p>There is a tool available at <a href="http://ora2pg.darold.net/" rel="nofollow">http://ora2pg.darold.net/</a> which can be used to transalate Oracle Schemas to Postgres schemas, but I'm not sure if it will also translate the stored procedures.
But it might provide a place to start.</p>
|
http/AJAX (GWT) vs Eclipse gui for thin client deployment <p>I am starting a project for which we will have a thin client, sending requests and getting responses from a server.</p>
<p>We are still in the planning stages, so we have a choice to settle on either an Eclipse based GUI (Eclipse plugin) or using GWT as a fr... | <p>Coming from someone who has just as much experience as you do (haven't developed any Eclipse based plugins or anything with GWT), this is purely an opinion from another set of eyes on your problem.</p>
<p>Purely from the standpoint of this application being served from a thin client, I would think GWT would fit the... |
Performance Testing MSMQ Server <p>Has anyone done any sort of performance tests against MSMQ?</p>
<p>We have a solution in prod environment where errors are added to a MSMQ for distribution to databases or event monitors.</p>
<p>We need to test the capacity of this system but not sure how to start.</p>
<p>Anyone kn... | <p>try overloading it with a test program and see where it balks/fails</p>
<p>[analgous to "destructive testing" in materials engineering]</p>
|
What is the best way to separate UI (designer/editor) logic from the Package framework (like Visual Studio Package) <p>I want to separate concerns here. Create and embed all the UI logic for the Custom XML designer, object model, validations etc in to a separate assembly. Then the Package framework should only register... | <p>I've created a VSPackage that loads an editor. The Editor sits in a separate assembly and implements an interface that I defined. The VSPackage works with the interface, so any changes I make to the editor (and its assembly) does not affect the VSPackage as long as I don't change the interface.</p>
|
Search file in directory using complex pattern <p>I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant:</p>
<ul>
<li><code>dir1/dir2/**/SVN/*</code> --> Matches all files in SVN directories that are located anywhere in the directory tree under d... | <p>Coding it yourself wouldnt be that hard.</p>
<p>Just use a correctly formulated regular expression with System.IO methods to build the full path</p>
|
In PowerShell, how can I determine the root of a drive (supposing it's a networked drive) <p>In PowerShell, even if it's possible to know if a drive is a network drive: see <a href="http://stackoverflow.com/questions/158359/in-powershell-how-can-i-determine-if-the-current-drive-is-a-networked-drive-or">http://stackover... | <p>The trick is that the attribute name is different than expected.
Try:</p>
<p><code>(Get-PSDrive h).DisplayRoot</code></p>
|
How do you find the largest font size that won't break a given text? <p>I'm trying to use CSS (<strong>under <code>@media print</code></strong>) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known... | <p>The CSS font-size property accepts <a href="http://htmlhelp.com/reference/css/units.html#length" rel="nofollow">length units</a> that include absolute measurements in inches or centimeters: </p>
<blockquote>
<p>Absolute length units are highly dependent on the output medium, and
so are less useful than relativ... |
Can you combine multiple images into a single one using JavaScript? <p>I am wondering if there is a way to combine multiple images into a single image using only JavaScript. Is this something that Canvas will be able to do. The effect can be done with positing, but can you combine them into a single image for downloa... | <p>I know this is an old question and the OP found a workaround solution, but this will work if the images and canvas are already part of the HTML page.</p>
<pre><code><img id="img1" src="imgfile1.png">
<img id="img2" src="imgfile2.png">
<canvas id="canvas"></canvas>
<script type="text/java... |
Using Linq with WCF <p>I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. </p>
<p>I am wondering how things like deffered execution works over WCF (if it works... | <p>There isn't any LINQ provider that I'm aware of for generic WCF-based queries. <a href="http://blogs.msdn.com/astoriateam/archive/2007/12/11/linq-to-ado-net-data-services.aspx" rel="nofollow">LINQ to ADO.NET Data Services</a>, however, lets you query an Entity model over WCF/REST.</p>
<p>From <a href="http://blogs.... |
Update fonts recursively on a Delphi form <p>I'm trying to iterate all the controls on a form and enable ClearType font smoothing. Something like this:</p>
<pre><code>procedure TForm4.UpdateControls(AParent: TWinControl);
var
I: Integer;
ACtrl: TControl;
tagLOGFONT: TLogFont;
begin
for I := 0 to AParent.Contro... | <p>You use TypInfo unit, more specifically methods IsPublishedProp and GetOrdProp.</p>
<p>In your case, it would be something like:</p>
<pre><code>if IsPublishedProp(ACtrl, 'Font') then
ModifyFont(TFont(GetOrdProp(ACtrl, 'Font')))
</code></pre>
<p>A fragment from one of my libraries that should put you on the righ... |
Get the NTLM credentials from the Response on an APSX page <p>I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally be allowed ac... | <p>You can certainly obtain the login name of the caller, but not the password. NTLM uses a challenge/response mechanism, so the password is never transmitted. Your server must have access to a password-equivalent (a hash) in order to form the challenge and check the response, but even if you can get hold of it that ... |
Easiest way to migrate Word 2003 custom macro toolbars into Word 2007? <p>I have a series of macros and toolbars that I developed for Word 2003. Now that my office is upgrading to Word 2007, I need to migrate them. The macros themselves migrate with zero effort, but the toolbars are a different issue. A random subse... | <p>The macros and toolbars that I developed for Word 2003 are in a number of .dot files. I simply put these .dot files into my Startup folder. I restarted Word'07 an wallah, these Macro toolbars appeared in the Add-Ins ribbon.</p>
<p>Good Luck</p>
|
Resetting Buffers in Vim <p>Is it possible to reset the alternate buffer in a vim session to what it was previously?</p>
<p>By alternate buffer, I mean the one that is referred to by #, i.e. the one that is displayed when you enter cntl-^.</p>
<p>Say I've got two files open main.c and other.c and :ls gives me:</p>
<... | <p>In this case, "alternate" just means "previous". So, yes, :b2 (or 2 ctrl-6) is probably the easiest way to change which two buffers will be toggled by ctrl-6.</p>
<p>Also, take a look at the :keepalt command.</p>
|
Eclipse RCP Toolbar buttons with the Eclipse Look <p>In Eclipse, its easy to specify buttons for your toolbar using the ActionSets extension point. However, when I need to specify some items programmatically, I can't get the same look. I don't believe that the framework is using native buttons for these, but so far, ... | <p>It's difficult to tell from your question, but it sounds like you may be attempting to add a ControlContribution to the toolbar and returning a Button. This would make the button on the toolbar appear like a native button like you seem to be describing. This would look something like this:</p>
<pre><code>IToolBarMa... |
RAII vs. exceptions <p>The more we use RAII in C++, the more we find ourselves with destructors that do non-trivial deallocation. Now, deallocation (finalization, however you want to call it) can fail, in which case exceptions are really the only way to let anybody upstairs know of our deallocation problem. But then ag... | <p>You <b>MUST NOT</b> throw an exception out of a destructor.<br>
If an exception is already propagating then the application will terminate.<br></p>
<p>By terminate I mean stop immediately. Stack unwinding stops. No more destructors are called. All bad stuff. See the discussion here.</p>
<p><a href="http://stackove... |
Do OCUnit and OCMock work on the iPhone SDK? <p>I simply could not make it work, and I am wondering if I am wasting my time, or if I am simply stupid!</p>
<p>Sorry I don't have the exact error I have right now. But I just want to know if it work or not!</p>
| <p>I don't know whether OCUnit works with iPhone, but there is an <a href="http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting">iPhoneUnitTesting</a> framework available from Google Code.</p>
|
What tasks do you use JavaScript for the most? <p>What types of JavaScript scripts do find most useful in your work? What tasks do you use JavaScript for the most? Are there scripts that you wished were out there but just haven't been able to find? I'm trying to create a library of MooTools plugins and so I'm always lo... | <p>I use JavaScript the most for:</p>
<ul>
<li>Form validation</li>
<li>DOM manipulation</li>
<li>AJAX</li>
</ul>
|
Reset Expander to default collapse behavior <p>I'm using an expander inside a <a href="http://kentb.blogspot.com/2007/04/resizer-wpf-control.html" rel="nofollow">Resizer</a> (a ContentControl with a resize gripper), and it expands/collapses properly when the control initially comes up. Once I resize it, the Expander w... | <p>I resolved the problem by moving the Resizer inside the Expander, but I've run into the Expander issue elsewhere, so would still like an answer if someone has it.</p>
<p>thanks</p>
|
Way to go from recursion to iteration <p>I've used recursion quite a lot on my many years of programming to solve simple problems, but I'm fully aware that sometimes you need iteration due to memory/speed problems.</p>
<p>So, sometime in the very far past I went to try and find if there existed any "pattern" or text-b... | <p>Usually, I replace a recursive algorithm by an iterative algorithm by pushing the parameters that would normally be passed to the recursive function onto a stack. In fact, you are replacing the program stack by one of your own.</p>
<pre><code>Stack<Object> stack;
stack.push(first_object);
while( !stack.isEmpt... |
What is the best client side browser library to upload multiple files over http? <p>What is the best client side http library to upload multiple files? If it can handle directories that's a huge bonus. I'm looking for something that is open source or free. I'm looking for something like FTP, but that works over http, t... | <p><a href="http://www.uploadify.com/" rel="nofollow">Uploadify</a> is also another great multiple file uploader. It was built off of SWFUpload and they added new features to it. </p>
<p>Some of the features that I have found most helpful are: </p>
<blockquote>
<p>The user can upload all the files at once using ct... |
What is the naming convention in Python for variable and function names? <p>Coming from a C# background the naming convention for variables and method names are usually either CamelCase or Pascal Case:</p>
<pre><code>// C# example
string thisIsMyVariable = "a"
public void ThisIsMyMethod()
</code></pre>
<p>In Python, ... | <p>See Python <a href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a>.</p>
<blockquote>
<p>Function names should be lowercase,
with words separated by underscores as
necessary to improve readability.</p>
<p>mixedCase is allowed only in contexts
where that's already the prevailing
style</p>
</blockq... |
Determine if a program is running on a Remote Desktop <p>Is there a way my program can determine when it's running on a Remote Desktop (Terminal Services)?</p>
<p>I'd like to enable an "inactivity timeout" on the program when it's running on a Remote Desktop session. Since users are notorious for leaving Remote Deskt... | <p>GetSystemMetrics(SM_REMOTESESSION) (as described in <a href="http://msdn.microsoft.com/en-us/library/aa380798.aspx">http://msdn.microsoft.com/en-us/library/aa380798.aspx</a>)</p>
|
Changing short date format in Ubuntu <p>How do I change the system-wide short date format in Ubuntu? For example, Thunderbird is showing dates in the DD/MM/YY format, and I would like to change it to MM/DD/YY or YYYY-MM-DD.</p>
<p>The best information I can find so far is in this thread:</p>
<p><a href="http://ubunt... | <p>I've written a <a href="http://ccollins.wordpress.com/2009/01/06/how-to-change-date-formats-on-ubuntu/" rel="nofollow">mini Howto</a> on this. It's not as easy as I had expected, but shouldn't pose too many problems.</p>
|
What is the difference between Ruby and Python versions of"self"? <p>I've done some Python but have just now starting to use Ruby<br />
I could use a good explanation of the difference between "self" in these two languages. </p>
<p><strong>Obvious on first glance:</strong><br />
Self is not a keyword in Python, but t... | <p>Python is designed to support more than just object-oriented programming. Preserving the same interface between methods and functions lets the two styles interoperate more cleanly.</p>
<p>Ruby was built from the ground up to be object-oriented. Even the literals are objects (evaluate 1.class and you get Fixnum). Th... |
How to put breakpoint in every function of .cpp file? <p>Is there a macro that does it? Which DTE objects to use?</p>
| <p>(This is not quite what you're asking for, but almost:)</p>
<p>You can put a breakpoint on <strong>every member function of a class</strong> in Visual Studio by bringing up the <em>New Breakpoint</em> dialog and entering:</p>
<pre><code>CMyClass::*
</code></pre>
<p>See <a href="http://blogs.msdn.com/b/habibh/arch... |
Finding the time taken to send messages with WCF net.tcp <p>Iâm writing a prototype WCF enabled distributed app, to try and find out any issues Iâll have upgrading my existing âsending xml over tcp to communicateâ apps Iâve got. Iâm using Callback Contracts to register clients with a server (Singleton in S... | <p>Hmmm... that's a difficult one. The problem here is you can't even make sure both the client and the server timers are in sync.</p>
<p>If what you want to do is send some out-of-band data, so that you don't need to modify your methods, you can use the method suggested <a href="http://microsoft.apress.com/asptodayar... |
Flex: Modify an embedded icon and use it in a button? <p>Just that, if you embed an icon:</p>
<pre><code>[Embed(source='icons/checkmark.png')]
private static var CheckMark:Class;
</code></pre>
<p>You end up with a dynamic class. You can pretty easily assign the icon to a button at runtime by calling the setStyle meth... | <p>This is the only answer I could find that seemed close: <a href="http://blog.xsive.co.nz/archives/234" rel="nofollow">Dynamic Icons</a> <a href="http://blog.xsive.co.nz/flex_source/button_icon_drawing/ButtonTest.html" rel="nofollow">(example with View Source)</a></p>
<p>His solution involves a custom "DynamicIcon" ... |
should I free pointer returned by getpwuid() in Linux? <p>After I call getpwuid(uid), I have a reference to a pointer. Should I free that when I don't use it anymore? Reading the man pages, it says that it makes reference to some static area, that may be overwritten by subsequent calls to the same functions, so I'm sur... | <p>No. You do not need to free the result. You can only call free(3) on pointers allocated on the heap with malloc(3), calloc(3) or realloc(3).</p>
<p>Static data is part of a program's data or bss segments and will persist until the process exits (or is overwritten by exec(2)).</p>
|
What svn command would list all the files modified on a branch? <p>In svn, I have a branch which was created, say at revision 22334. Commits were then made on the branch.</p>
<p>How do I get a list of all files that were changed on the branch compared to what's on the trunk? I do not want to see files that were change... | <p>This will do it I think:</p>
<pre><code>svn diff -r 22334:HEAD --summarize <url of the branch>
</code></pre>
|
ZIP Code (US Postal Code) validation <p>I thought people would be working on little code projects together, but I don't see them, so here's an easy one:</p>
<p>Code that validates a valid US Zip Code. I know there are ZIP code databases out there, but there are still uses, like web pages, quick validation, and also th... | <p><strong>Javascript Regex Literal</strong>:</p>
<p>US Zip Codes: <code>/(^\d{5}$)|(^\d{5}-\d{4}$)/</code></p>
<pre><code>var isValidZip = /(^\d{5}$)|(^\d{5}-\d{4}$)/.test("90210");
</code></pre>
<p>Some countries use <a href="http://en.wikipedia.org/wiki/Postal_code">Postal Codes</a>, which would fail this patter... |
Run custom Javascript whenever a client-side ASP.NET validator is triggered? <p>Is there a way to run some custom Javascript whenever a client-side ASP.NET validator (RequiredFieldValidator, RangeValidator, etc) is triggered? </p>
<p>Basically, I have a complicated layout that requires I run a custom script whenever a... | <p>See <a href="http://stackoverflow.com/questions/124682/can-you-have-custom-client-side-javascript-validation-for-standard-aspnet-web-f#125158">this comment</a> for how I managed to extend the ASP.Net client side validation. <a href="http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=362" rel="nofollow">Oth... |
Run Sparc binaries without Sparc hardware <p>I've been curious in the past few months in trying my hand at doing some assembly for the SPARC processor (either V8 or V9). My question is this, I have no access to a SPARC machine, is there a way I can run SPARC binaries on my x86 machine? I've looked at QEMU but I am not ... | <p><A HREF="https://www.simics.net/" rel="nofollow">SimICS</A> emulates a Sparc platform. Academic and personal licenses are free.</p>
<p><B>Edit:</B> I didn't do SimICS justice in my initial response, it is a very useful tool for Sparc-based development. You can instrument, profile, and explore the behavior or code i... |
Generating random numbers in Objective-C <p>I'm a Java head mainly, and I want a way to generate a pseudo-random number between 0 and 74. In Java I would use the method:</p>
<pre><code>Random.nextInt(74)
</code></pre>
<p>I'm not interested in a discussion about seeds or true randomness, just how you accomplish the sa... | <p>You should use the arc4random_uniform() function. It uses a superior algorithm to rand. You don't even need to set a seed.</p>
<pre><code>#include <stdlib.h>
// ...
// ...
int r = arc4random_uniform(74);
</code></pre>
<p>The arc4random man page:</p>
<blockquote>
<pre><code>NAME
arc4random, arc4random_s... |
How do I check if an integer is even or odd? <p>How can I check if a given number is even or odd in C?</p>
| <p>Use the modulo (%) operator to check if there's a remainder when dividing by 2:</p>
<pre><code>if (x % 2) { /* x is odd */ }
</code></pre>
<p>A few people have criticized my answer above stating that using x & 1 is "faster" or "more efficient". I do not believe this to be the case. </p>
<p>Out of curiosity, I... |
Error: initializer element is not computable at load time <p>I have in a function that takes a struct, and I'm trying to store its variables in an array, but I get this when I run gcc -Wall -ansi -pedantic-errors -Werror</p>
<pre><code>int detect_prm(Param prm) {
int prm_arr[] = {prm.field1, prm.field2, prm.field3};... | <p>Mike's answer is absolutely right.</p>
<p>However, if you're able to use the GNU C extensions, or to use the newer and better C99 standard instead (use the <code>--std=c99</code> option), then initializers such as this are perfectly legal. The C99 standard has been out for, well, 9 years, and most C compilers supp... |
How do I invoke a Java method when given the method name as a string? <p>If I have two variables:</p>
<pre><code>Object obj;
String methodName = "getName";
</code></pre>
<p>Without knowing the class of <code>obj</code>, how can I call the method identified by <code>methodName</code> on it?</p>
<p>The method being ca... | <p>Coding from the hip, it would be something like:</p>
<pre><code>java.lang.reflect.Method method;
try {
method = obj.getClass().getMethod(methodName, param1.class, param2.class, ..);
} catch (SecurityException e) { ... }
catch (NoSuchMethodException e) { ... }
</code></pre>
<p>The parameters identify the very s... |
In .NET is there a way to enable Assembly.Load tracing? <p>In .NET is there a way to enable Assembly.Load tracing? I know while running under the debugger it gives you a nice message like "Loaded 'assembly X'" but I want to get a log of the assembly loads of my running application outside the debugger, preferably inter... | <p>Get the AppDomain for your application and attach to the AssemblyLoad event.</p>
<p>Example (C#): </p>
<pre><code>AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(OnAssemblyLoad);
</code></pre>
|
How do I force a tomcat web application reload the trust store after I update it <p>I have the following problem.
My tomcat 5.5 based web application is using a trust store to verify SSL connections.
The application allows the user to add or remove CA certificates to be used in the verification process.
However, adding... | <p>how about writing a Custom Classloader that loads in the trust store ONLY for this webapp. You could unload the classloader when you need to refresh the contents and reload it ?</p>
|
How do I determine the file and line # of a C# method from a symbols (.pdb) file? <p>pdb files contain symbol information for .NET assemblies. I'd like to read a pdb file in order to correlate methods with their file location. The data is contained within it but I can't seem to find a good description of how to get it ... | <p>You should look:</p>
<ul>
<li><a href="http://www.mono-project.com/Cecil" rel="nofollow">Mono.Cecil</a> and especially the Mono.Cecil.Pdb module. It should do what you want and more.</li>
</ul>
|
FTP File Upload with HTTP Proxy <p>Is there a way to upload a file to a FTP server when behind an HTTP proxy ?</p>
<p>It seems that uploading a file is not supported behind an HTTP Proxy using .Net Webclient. (<a href="http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.proxy.aspx">http://msdn.microsoft.c... | <p>In active FTP mode, the server initiates a data connection to the client. If the client is behind an HTTP proxy, this obviously won't work. In passive FTP mode it is the client who initiates both the initial and the data connections. Since HTTP proxies can tunnel arbitrary outgoing TCP connections (using the CONNECT... |
Access to remote computer's MSMQ gives "Remote computer is not available" <p>We have a windows application that runs on a server and accesses 4 other servers (all of them are members in the domain) to get the messages in each of their private queues. We've just installed a new server, and for some reason when the appli... | <p>Probably way too late for this thread, but I found the answer to this here: <a href="http://blogs.msdn.com/johnbreakwell/archive/2008/07/10/getting-msmq-messages-out-of-windows-server-2008.aspx" rel="nofollow">http://blogs.msdn.com/johnbreakwell/archive/2008/07/10/getting-msmq-messages-out-of-windows-server-2008.asp... |
Unit Testing: Maven or Eclipse? <p>I am not really familiar with Maven program but I've been using Eclipse for quite a while for Unit testing, code coverage, javadoc generation, code style checking, etc. Probably, the only main thing that I didn't really like about Eclipse is the "compilation errors" that it generates ... | <p>The company I currently work for has a lot of JUnit tests which are run using Maven (1.x). We've never really had any problem and any tests that fail in maven can be debugged using the remote debugger or in Eclipse on their own.</p>
<p>The most important thing is that you take the time and effort to set up the envi... |
Referenced structure not 'sticking' <p>I am currently porting a lot of code from an MFC-based application to a DLL for client branding purposes.</p>
<p>I've come across an unusual problem. This bit of code is the same in both systems:</p>
<pre><code>// ...
CCommsProperties props;
pController->GetPropertie... | <p>It is difficult to see what is wrong from the given code alone. Some general pointers:</p>
<ol>
<li><p>The object is initialized and processed in different binary modules with incompatible linking (such as C-run times)</p></li>
<li><p>If the class/structure is shared it is not exported/imported correctly.</p></li>
... |
'pass parameter by reference' in Ruby? <p>In Ruby, is it possible to pass by reference a parameter with value-type semantics (e.g. a Fixnum)?
I'm looking for something similar to C#'s '<strong>ref</strong>' keyword.</p>
<p>Example:</p>
<pre><code>def func(x)
x += 1
end
a = 5
func(a) #this should be something l... | <p>You can accomplish this by explicitly passing in the current binding:</p>
<pre><code>def func(x, bdg)
eval "#{x} += 1", bdg
end
a = 5
func(:a, binding)
puts a # => 6
</code></pre>
|
Where is GDB documentation specific to the Cell Linux environment? <p>Where can documentation be found for the features of GDB, and the debugging process, specific to debugging of Cell Linux programs mixing PPU and SPU code?</p>
| <p>Documents at the IBM developerWorks site for Cell can be found here:
<a href="http://www.ibm.com/developerworks/power/cell/documents.html?S_TACT=105AGX16&S_CMP=LP" rel="nofollow">Cell @developerWorks</a></p>
<p>You sound like you'd want the <a href="http://www.ibm.com/chips/techlib/techlib.nsf/techdocs/1DAAA0A3... |
How do I launch a standalone SWF from within an Adobe AIR application? <p>I'm completely new to AIR but what I'm trying to do feels like it should be quite easy.</p>
<p>I want my AIR app to execute (launch) an SWF in the standalone Flash Player (just like if I were to double click it). </p>
<p>Please note that I don'... | <p>Using Adobe AIR, you could launch / load the SWF into a separate native window. It would run in the same process as the AIR app loading / launching it, but the experience would be the similar if not the same for the end user.</p>
<p>mike chambers</p>
<p>mesh@adobe.com</p>
|
initialize a const array in a class initializer in C++ <p>I have the following class in C++:</p>
<pre><code>class a {
const int b[2];
// other stuff follows
// and here's the constructor
a(void);
}
</code></pre>
<p>The question is, how do I initialize b in the initialization list, given that I can't ... | <p>With C++11 the answer to this question has now changed and you can in fact do:</p>
<pre><code>struct a {
const int b[2];
// other bits follow
// and here's the constructor
a();
};
a::a() :
b{2,3}
{
// other constructor work
}
int main() {
a a;
}
</code></pre>
|
How do you track the time of replicated rows for Subscribers in SQL Server 2005? <p>The basic problem is like this:<br />
A subscriber has successfully replicated a row from the publisher, using transactional replication. Now, how do we keep track the time of this row being last successfully replicated? </p>
<p>A fri... | <p>I had this exact problem a few weeks ago trying to find records that have changed recently.</p>
<p>Create a new column and set the data type to TIMESTAMP. SS2005 automatically updates this type when the row is updated. The only problem is that this 'timestamp' has nothing at all to do with a date or time, it is jus... |
If I stop a long running query, does it rollback? <p>A query that is used to loop through <b>17 millions records to remove duplicates</b> has been running now for about <b>16 hours</b> and I wanted to know if the query is stopped right now if it will finalize the delete statements or if it has been deleting while runn... | <p>no, sql server will not roll back the deletes it has already performed if you stop query execution. oracle requires an explicit committal of action queries or the data gets rolled back, but not mssql.</p>
<p>with sql server it will not roll back unless you are specifically running in the context of a transaction an... |
Fire Async method on page load with AJAX <p>I am using ASP.NET 2.0 with AJAX Extensions (1.0?) and am wondering if it is possible to call a method asynchronously and have the results populate on the page after it has been loaded.</p>
<p>I have a gridview that is populated by a fairly long-running SQL query. I would pr... | <p>You can use an asp:UpdatePanel and insert the gridview in there. They just call the AJAX call during load. You use the Sys.Application.load event. Check it out here for more information: <a href="http://www.asp.net/ajax/documentation/live/overview/AJAXClientEvents.aspx" rel="nofollow">http://www.asp.net/ajax/docu... |
What is the role of Spring in Struts + Spring + Hibernate? <p>What role is Spring taking in Struts + Spring + Hibernate?</p>
| <p>Spring provides many different "modules" and different programmers will use different parts of Spring.</p>
<p>However, commonly in this sort of stack, you will see Spring being used as a provider of</p>
<ul>
<li>An inversion of control container for dependency injection</li>
<li>An abstraction to Hibernate called ... |
const int vs. int const as function parameter in C++ and C <p>Quick question: </p>
<pre><code>int testfunc1 (const int a)
{
return a;
}
int testfunc2 (int const a)
{
return a;
}
</code></pre>
<p>Are these two functions the same in every aspect or is there a difference? I'm interested in an answer for the C-langu... | <p>The trick is to read the declaration backwards (right-to-left):</p>
<pre><code>const int a = 1; // read as "a is an integer which is constant"
int const a = 1; // read as "a is a constant integer"
</code></pre>
<p>Both are the same thing. Therefore:</p>
<pre><code>a = 2; // Can't do because a is constant
</code><... |
Is there a way to script diagrams in SQL 2000 (or save them another way)? <p>It's possible to create digrams in SQL Server 2000 that can be useful to show the relationships between tables. The problem we run into is that when somebody refreshes our development database, the diagrams get lost. We can load tables, stor... | <p>It can be done for SQL Server 2005 - see <a href="http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx" rel="nofollow">here</a>.</p>
<p>And info. on SQL Server 2000 - <a href="http://bytes.com/forum/thread81534.html" rel="nofollow">here</a>.</p>
|
How do I detect "Easter Egg" mode in my Palm OS application? <p>Since the early days, Palm OS has had a special "easter egg" mode that's enabled by making the right gesture in one of the Preference panels. On current Palm Treo and Centro devices, this is turned on by doing a clockwise swirl above the "Tips" button in ... | <p>The standard system preference for this is prefAllowEasterEggs (see Preference.h). This setting can be accessed using the PrefGetPreference API:</p>
<pre><code>UInt32 enableEasterEggs = PrefGetPreference(prefAllowEasterEggs);
</code></pre>
<p>The value will be non-zero when the user has requested that Easter eggs ... |
The value of hobby game development <p>Does attempting to develop some sort of game, even just as a hobby during leisure time provide useful (professional) experience or is it a childish waste of time?</p>
<p>I have pursued small personal game projects on and off throughout my programming career. I've found the (often... | <p>You can learn a lot from game development. Game development requires a discipline that you can't find in other programming projects.</p>
<p>Here are just a small set of things game development has taught me:</p>
<ul>
<li>Optimization for speed</li>
<li>Sacrificing computational depth for speed</li>
<li>Developing ... |
Rendered pIxel width data for each character in a browser's font <p>I have a table column that needs to be limited to a certain width - say 100 pixels. At times the text in that column is wider than this and contains no spaces. For example:</p>
<pre><code>a_really_long_string_of_text_like_this_with_no_line_breaks_mak... | <p>How about overflow: scroll?</p>
|
How do you log the machine name via log4net? <p>I am using Log4Net with the AdoNetAppender to log messages from a simple systray application into a SQL Server 2005 database.</p>
<p>I want to log the machine name along with the log message because this application will be running on multiple machines and I need to know... | <p>You can use the pre-populated property <code>log4net:HostName</code>, for example:</p>
<pre><code><conversionPattern value="%property{log4net:HostName}" />
</code></pre>
<p>This way you don't need to populate the MDC.</p>
|
Would it be possible to use web services from a Cobol program? <p>We have some COBOL programs in our financial applications which need to interact with some of our backend systems. One of the available interfaces is through a web service. Can a program written in Cobol make requests to a web service?</p>
| <p><a href="http://www.microfocus.com/" rel="nofollow">Microfocus</a> provide a tool called Enterprise Server which allows COBOL to interact with web services.</p>
<p>If you have a COBOL program A and another COBOL program B and A calls B via the interface section, the tool allows you to expose B's interface section a... |
Is there a source-control system that allows tracking of file name changes? <p>So, I've been living with my cvs repositories for some time. Though there is a thing I miss - if i rename a file that is already in repository, I need to delete the one with old name from there and add the new one. Hence, I loose all my chan... | <p>Subversion can do this, but you have to do it with </p>
<pre><code>svn move <oldfile> <newfile>
</code></pre>
<p>Edit: And in this decade, we do <code>git mv <oldfile> <newfile></code>, or just use <code>mv</code> and git usually figures it out on its own.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.