input
stringlengths
51
42.3k
output
stringlengths
18
55k
How can I change the animation style of a modal UIViewController? <p>I'm currently displaying a UIViewController like this:</p> <pre><code>[[self navigationController] presentModalViewController:modalViewController animated:YES]; </code></pre> <p>and hiding it like this:</p> <pre><code>[self.navigationController dis...
<p>For iPhone 3.0+, a basic crossfade is easiest to do like this:</p> <pre><code>modalViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [[self navigationController] presentModalViewController:modalViewController animated:YES]; </code></pre>
How to solve Var out of scope within setTimeout call <p>I am trying to call a setTimeout from within a setInterval callback:</p> <pre><code>function callback() { //assign myVar var myVar = document.getElementById("givenID"); //... //now wait 2 secs then call some code that uses myVAr setTimeout("myVar.i...
<p>This is a perfect candidate for closures:</p> <pre><code>setInterval( function () { var myVar = document.getElementById("givenID"); setTimeout( function() { // myVar is available because the inner closure // gets the outer closures scope ...
Does "std::size_t" make sense in C++? <p>In some code I've inherited, I see frequent use of <code>size_t</code> with the <code>std</code> namespace qualifier. For example:</p> <pre><code>std::size_t n = sizeof( long ); </code></pre> <p>It compiles and runs fine, of course. But it seems like bad practice to me (perh...
<p>There seems to be confusion among the stackoverflow crowd concerning this</p> <p><code>::size_t</code> is defined in the backward compatibility header <code>stddef.h</code> . It's been part of <code>ANSI/ISO C</code> and <code>ISO C++</code> since their very beginning. Every C++ implementation has to ship with <cod...
Redirect to controller (but with a different master) using a catchall wildcard <p>I have a problem whereby I want to display a view differently (a different master page), depending on where it came from, but don't know where to start...</p> <p>I have several routes which catch various different types of urls that cont...
<p>In your partners controller why don't you set a cookie that indicates which partner you want to show, and then redirects to the wildcard section of the route. That way you can show the same partner layout for all subsequent page views.</p> <p>I don't know if this is what you're looking for, but it might be an opti...
Full-text search relevance is measured in? <p>I am making a quiz system, and when quizmakers insert questions into the Question Bank, I am to check the DB for duplicate / very highly similar questions.</p> <p>Testing MySQL's <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html#function_match">MATCH() ....
<p>The basic data structure for a text retrieval system is an <a href="http://en.wikipedia.org/wiki/Inverted_index" rel="nofollow">Inverted Index</a>. This is essentially a list of words found in the document collection with a list of the documents they occur in. It can also have metadata about the occurrence for eac...
How do I do inline assembly on the IPhone? <p>How is it done? What steps do I need to take and what pitfalls and gotchas are there to consider?</p>
<p>I've gotten this to work, thanks to some inside help over at the <a href="https://devforums.apple.com/">Apple Devforums</a>, you should sign up if you're a dedicated IPhone developer.</p> <p>First thing's first, it's <em>__asm__()</em>, not plain <em>asm()</em>.</p> <p>Secondly, by default, XCode generates a compi...
Using SQL Server 2008 Geography types with nHibernate's CreateSQLQuery <p>I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:</p> <pre><code>sqlstring = string.Format("set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};", mlat, mlong, userid); _session....
<p>I'm pretty sure I can tell you what is happening, but I don't know if there is a fix for it.</p> <p>I think the problem is that the ':' character is used by NHibernate to create a named parameter. Your expression is getting changed to:</p> <pre><code>set nocount on;update myusers set geo=geography@p0({0}, {1}, 43...
Anonymous Types in a signature <p>I am trying to get the signature on the method below to work. As this is an Anonymous Type I have some trouble, any help would be great.</p> <p>When I looked at sortedGameList.ToList() in a QuickWatch window I get the signature </p> <pre><code>System.Collections.Generic.List&lt;&lt;...
<p><strike> select new { Date = s.Key, Games = s.ToList() }; </strike></p> <p>Edit: thats wrong! I think this will do.</p> <pre><code>public List&lt;IGrouping&lt;DateTime, Game&gt;&gt; getGamesList(int leagueID) { var sortedGameList = from g in Games group g by g.Date; return sortedGameLis...
How to calculate the bounding box for a given lat/lng location? <p>I have given a location defined by latitude and longitude. Now i want to calculate a bounding box within e.g. 10 kilometers of that point.</p> <p>The bounding box should be defined as latmin, lngmin and latmax, lngmax.</p> <p>I need this stuff in orde...
<p>I suggest to approximate locally the Earth surface as a sphere with radius given by the WGS84 ellipsoid at the given latitude. I suspect that the exact computation of latMin and latMax would require elliptic functions and would not yield an appreciable increase in accuracy (WGS84 is itself an approximation).</p> <p...
Algorithm/pattern for selecting sub-collections using LINQ and C# <p>I have a C# collection of strings. Each string is a sentence that can appear on a page. I also have a collection of page breaks which is a collection of int's. representing the index where the collection of strings are split to a new page.</p> <p>Exa...
<p>Not sure what the list of page breaks is for. I would think of it this way. A collection of strings, a page number, and the size of the page. Then you could do something like:</p> <pre><code>List&lt;string&gt; strings = ... int pageNum = ... int pageSze = ... if (pageNum &lt; 1) pageNum = 1; if (pageSize &lt; 1...
Updating referenced columns in Postgres <p>When there are one of more columns that reference another, I'm struggling for the best way to update that column while maintaining referential integrity. For example, if I have a table of labels and descriptions and two entries:</p> <pre><code>Label | Description ------------...
<p>If you have many rows referencing READ, you could alter the foreign key to be on cascade update, update that table set Label = 'read' where Label = 'READ' and everything will get automagically fixed. After that you can alter the constraint again to be as it was before.</p> <p>To find all the tables referencing the ...
How do I pass multiple objects to ViewPage in ASP.NET MVC? <p>I think I know the answer, but I would like to bounce around some ideas.</p> <p>I would like to pass several (in this instance 2) somewhat different pieces of data to a View. My initial thought is simply to wrap-up the various objects into a containing obj...
<p>I find it useful to create additional classes dedicated that are to be presented to the Views. I keep them in a separate namespace called 'Core.Presentation' to keep things organized. Here is an example:</p> <pre><code>namespace Core.Presentation { public class SearchPresentation { public IList&lt...
ASP.NET MVC Beta 1: DefaultModelBinder wrongly persists parameter and validation state between unrelated requests <p>When I use the default model binding to bind form parameters to a complex object which is a parameter to an action, the framework remembers the values passed to the first request, meaning that any subseq...
<p>It turns out that the problem was that my controllers were being reused between calls. One of the details I chose to omit from my original post is that I am using the Castle.Windsor container to create my controllers. I had failed to mark my controller with the Transient lifestyle, so I was getting the same instance...
StackOverflowException caused by a linq query <p><strong>edit #2:</strong> Question solved halfways. Look below</p> <p>As a follow-up question, does anyone know of a non-intrusive way to solve what i'm trying to do below (namely, linking objects to each other without triggering infinite loops)?</p> <p><hr /></p> <p>...
<p>Hai! I think your models are recursively calling a method unintentionally, which results in the stack overflow. Like, for instance, your Subregion object is trying to get Country objects, which in turn have to get Subregions. </p> <p>Anyhow, it always helps to check the stack in a StackOverflow exception. If yo...
How can I support wildcards in user-defined search strings in Python? <p>Is there a simple way to support wildcards ("*") when searching strings - without using RegEx?</p> <p>Users are supposed to enter search terms using wildcards, but should not have to deal with the complexity of RegEx:</p> <pre><code>"foo*" =&g...
<p>You could try the <a href="http://www.python.org/doc/2.5.2/lib/module-fnmatch.html"><code>fnmatch</code></a> module, it's got a shell-like wildcard syntax.</p>
How do I associate a nib (.xib) file with a UIView? <p>I have a subclass "s" of UIView. I want to put some buttons and labels on s. How do I associate my UIView subclass with a nib file?</p>
<ol> <li>In Interface Builder, create a new xib with the View template. </li> <li>Click on the view in the list of objects in the xib (you should also see "File's Owner and "First Responder").</li> <li>Push Cmd-4 to open the Identity pane of the inspector.</li> <li>Type your class's name into the "Class Name" field and...
VB.NET How Do I skin a vb.net app <p>I want to skin a vb.net app I made ive googled some stuff and I've seen skinned vb.net apps. </p> <p>However it seems like any time i try to find someone explaining it its a link to a pay for product.</p> <p>Does anyone have anything useful on this?</p> <hr> <p>I have seen some...
<p>I remember making a "skinnable" vb.net winforms app (a media player) when I was still a student (maybe 6 years ago).</p> <p>It was ugly, but the way I did it was as follows:</p> <ol> <li><p>Select a transparency color. Wherever you use this color the app will be transparent (I used Fuchsia (#FF00FF), which I reca...
Difference of two 'uint' <p>When you attempt to declare an unsigned variable in C#.NET with a value outside its value range it is flagged as a compiler error, but if you produce a negative value at runtime and assign it to that variable at runtime the value wraps.</p> <pre><code>uint z = -1; // Will not compile uint ...
<p>Declaring an unassigned variable in C# isn't flagged with an error - trying to assign an invalid value to a variable is. For instance, here's a variable which isn't definitely assigned (assuming it's local) after declaration:</p> <pre><code>uint z; </code></pre> <p>-1 isn't a valid value for a uint any more than 0...
What design pattern to use for User Authentication in Java <p>There are certain common components that are used across projects:</p> <ol> <li>User Authentication and Authorization</li> <li>Exception Handling</li> <li>Logging</li> <li>E-mail</li> <li>DataBase Access</li> <li>Caching etc</li> </ol> <p>Is there a consis...
<p>Perhaps not a pattern per se, but I've always thought that the spring annotations approach was quite clever. Essentially you annotate the methods that need to be secured. Providing that you have a nice tiered architecture then this should make things pretty straightforward! It does all of the hard work for you. <a h...
Visio & UML - Showing pointers in attributes and return values <p>I have the requirement of generating UML Diagrams for one of my C++ assignments. I'm using Visio 2007 and I'm having trouble representing C++ pointers. I've found a way to add a suffix to Datatypes however it's rather time consuming to do this for every ...
<p>You can have Visio save its data files to an XML format. You could then write a script to make the * tweaks wherever you want them. Depending on how big your model is, this may be faster than the tedious manual way that you're using now, especially if you already have some experience in a language like Perl.</p>
Problem with updating a MySQL field with PHP <p>I have a query:</p> <p>UPDATE choices SET votes = votes + 1 WHERE choice_id = '$user_choice'</p> <p>But when I execute it in my script, the votes field is updated twice, so the votes will go from 4 to 6 instead to 5. It doesn't seem that it is getting called twice becau...
<p>One other option is, if you are using firefox at all and have firbug installed you need to disable your cache. For some reason firbug results in two calls to the dB. Took weeks to figure this out where I work as QA was getting all kinds of strange results when testing. he was the only one with firebug.</p>
Best Way to Replace a Visual Component in Delphi <p>In a Delphi Form, I would like to replace one visual component with another. Example: I want to replace a Panel component with an ElPanel from a 3rd party package. </p> <p>I would like all identical properties and events of the first component to be transferred to th...
<p>I do it as following:</p> <ol> <li>Right click on the form and choose (View as Text).</li> <li>Press Ctrl + F to search for the Component class name like TPanel and replace it with TElPanel</li> <li>Switch back to back to the form (View as form)</li> <li>In the interface section replace the TPanel with TElPanel.</l...
How do I calculate the elapsed time of an event in java? <p>What's a simple/easy way to access the system clock using Java, so that I can calculate the elapsed time of an event?</p>
<p>I would avoid using System.currentTimeMillis() for measuring elapsed time. currentTimeMillis() returns the 'wall-clock' time, which may change (eg: daylight savings, admin user changing the clock) and skew your interval measurements. </p> <p>System.nanoTime(), on the other hand, returns the number of nanoseconds si...
How to change the name of an iOS app? <p>I began an iPhone project the other day with a silly development code name, and now I want to change the name of the project since it's nearly finished. </p> <p>But I'm not sure how to do this with Xcode, trying the obvious of changing the application's name in the info.plist f...
<ol> <li>Go to <code>Targets</code> in <code>Xcode</code></li> <li>"<code>Get Info</code>" on your project's target (your current silly development name)</li> <li>Search for "<code>Product Name</code>" under "<code>Packaging</code>". Change the value of what you want the <code>new program name</code> to be.</li> </ol>
How can I call a DLL from a scripting language? <p>I have a third-party product, a terminal emulator, which provides a DLL that can be linked to a C program to basically automate the driving of this product (send keystrokes, detect what's on the screen and so forth).</p> <p>I want to drive it from a scripting language...
<p>One way to call C libraries from Python is to use <a href="https://docs.python.org/library/ctypes.html" rel="nofollow">ctypes</a>:</p> <pre><code>&gt;&gt;&gt; from ctypes import * &gt;&gt;&gt; windll.user32.MessageBoxA(None, "Hello world", "ctypes", 0); </code></pre>
Sync Framework Resources <p>I am looking for resources on Microsoft Sync Framework. Although MSDN and Google Search gave me the brief overview, I want some demos and presentations.</p> <p>Also, is Live Mesh based on Sync Framework?</p>
<p>Maybe those links will be helpful:</p> <ul> <li><a href="http://code.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=615">Sync101 - Getting Started with Sync</a></li> <li><a href="http://code.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=949">Tutorial - Microsoft Sync Framework Basic...
Setting a thread priority in a service has no effect <p>Is there some additional configuration needed before I can set thread priorities in a Windows service? </p> <p>In my service, I have a few threads that each call the <code>CreateProcess()</code> function to launch an external application. I would like to adjust t...
<p>Maybe you don't have the correct access rights? <a href="http://msdn.microsoft.com/en-us/library/ms686277(VS.85).aspx" rel="nofollow">MSDN on SetThreadPriority</a> says:</p> <blockquote> <p>hThread [in] A handle to the thread whose priority value is to be set.</p> <p>The handle must have the THREAD_SET_I...
Which is the best alternative for Java Serialization? <p>I'm currently working on a project which needs to persist any kind of object (of which implementation we don't have any control) so these objects could be recovered afterwards. </p> <p>We can't implement an ORM because we can't restrict the users of our library ...
<p>It's 2011, and in a commercial grade REST web services project we use the following serializers to offer clients a variety of media types:</p> <ul> <li><a href="http://x-stream.github.io/" rel="nofollow">XStream</a> (for XML but not for JSON)</li> <li><a href="https://github.com/FasterXML/jackson" rel="nofollow">Ja...
Convert html to pdf with linked documents inline <p>I need to convert a bundle of static HTML documents into a single PDF file programmatically on the server side on a Java/J2EE platform using a batch process preferably. The pdf files would be distributed to site users for offline browsing of the web pages. </p> <p>Th...
<p>Try <a href="http://xmlgraphics.apache.org/fop/" rel="nofollow">Apache FOP</a>. I just used it to <a href="http://stackoverflow.com/questions/212577/how-do-you-create-a-pdf-from-xml-in-java">convert XML to PDF</a> and I think you can do the same with HTML/DOM. The website has <a href="http://xmlgraphics.apache.org/f...
Interesting Master's degree programs? <p>I'm applying for a masters in fall of next year and was wondering if anyone had suggestions for interesting/challenging master's degrees in CS. I think that even though picking the right university is important, it is even more important to pick a master's degree where you'll fi...
<blockquote> <p>background: never taken AI, discrete math, compilers, operating systems, data structures, cryptography or anything involving c/c++ courses</p> </blockquote> <p>Hmmm ... It would have been OK had you not taken cryptogrophy or AI, but if you dont have an idea of Data Structures, Operating Systems, Comp...
Automatically remove Subversion unversioned files <p>Does anybody know a way to recursively remove all files in a working copy that are not under version control? (I need this to get more reliable results in my automatic build VMware.)</p>
<p>this works for me in bash:</p> <pre><code> svn status | egrep '^\?' | cut -c8- | xargs rm </code></pre> <p><a href="http://stackoverflow.com/users/50225/seth-reno">Seth Reno</a>'s is better:</p> <pre><code>svn status | grep ^\? | cut -c9- | xargs -d \\n rm -r </code></pre> <p>It handles unversioned folders and ...
Very odd bug when using a System.Timers.Timer <p>For some odd reason the Elapsed event is firing twice, where it should definitely be firing once. And immediately after, the timer ceases to work... The code structure is somewhat like this: A certain object is defined to fire a certain event when a value it contains, wh...
<p>From <a href="http://msdn.microsoft.com/en-us/library/system.timers.timer(VS.80).aspx" rel="nofollow">MSDN</a>:</p> <blockquote> <p>The Elapsed event is raised on a ThreadPool thread. If processing of the Elapsed event lasts longer than Interval, the event might be raised again on another ThreadPool threa...
Can I compare two ms-access files? <p>I want to compare two ms-access .mdb files to check that the data they contain is same in both.</p> <p>How can I do this?</p>
<p>I've done this kind of thing in code many, many times, mostly in cases where a local MDB needed to have updates applied to it drawn from data entered on a website. In one case the website was driven by an MDB, in others, it was a MySQL database. For the MDB, we just downloaded it, for MySQL, we ran scripts on the we...
When should I use primitives instead of wrapping objects? <p>Actually <a href="http://stackoverflow.com/questions/564/what-is-the-difference-between-an-int-and-an-integer-in-javac">here</a> is a similar topic with little practical value. As far as I understand, primitives perform better and should be used everywhere ex...
<p>Do not forget that, since creating a new wrapper for every boxing occurrence is quite expensive, especially considering it usually being used at a single scope of a method, <a href="http://chaoticjava.com/posts/autoboxing-tips/">Autoboxing</a> uses a pool of common wrappers.</p> <p>This is in fact an implementation...
What tools to use for developing flash/flex based touch screen user interface for embedded system <p>We are looking at developing a device with a touch screen and an embedded PC like computer for the user interface.</p> <p>What are the benefits and disadvantages of using flash/flex for this user interface development?...
<p>Regarding Flash</p> <p>Pros:</p> <ul> <li>Readily available</li> <li>Powerful editing tools</li> <li>Lots of people know how to use it</li> </ul> <p>Cons:</p> <ul> <li>(Very) bad performance in contrast to what it does</li> <li>Open source implementations still lagging</li> <li>Use of Adobe's flash component is ...
SQL CE 3.5 deployment problem, concerning interop between C# and C++ <p>We have a situation where a C# application is working with SQL CE 3.5 . To allow for a legacy program to use some of its features we have produced a C++ dll which uses interop to extract the info that it needs from the C# program. For this to work,...
<p>add the following files to your application folder:</p> <ul> <li>sqlceca35.dll</li> <li>sqlcecompact35.dll</li> <li>sqlceer35E.dll</li> <li>sqlceme35.dll</li> <li>sqlceoledb35.dll</li> <li>sqlceqp35.dll</li> <li>sqlcese35.dll</li> <li>System.Data.SqlServerCe.dll</li> </ul> <p>then it will work.</p> <p>that is nec...
Question about MSDN and commercial use <p>I work for a small digital marketing company as a programmer, and we are not a Microsoft partner or any sort (Gold/Silver/Bronze). However, we use .NET.</p> <p>What I am confused about is that the developer before me has left, and he gets subscription DVDs of latest Microsoft ...
<p>For the definitive answer read through the <a href="http://msdn.microsoft.com/en-us/subscriptions/aa948864.aspx">MSDN subscription FAQ</a> which includes the license terms.</p> <p>My understanding is that you can use the software to support development work for your company, but not run production servers. Ie. you...
Securing .NET application with keys <p>I am at the point where I need to add keys to my app. What are some of the possible solutions you guys used? I've looked at an earlier <a href="http://stackoverflow.com/questions/118031/best-activation-key-software-for-net-application">post</a> so far, anything else before I decid...
<p>If you are talking about software protection, take a minute to reconsider it.</p> <p>Protection schemes are mostly a waste of time. If .NET is similar in this regard to Java, decompiling the code and removing any kind of protection is trivial. The only more or less robust solutions are network based- and these can ...
Web Application Time Zone Issue <p>We have a ASP.Net 2.0 web application up and running with the server in the Midwest (Eastern Standard Time). At this moment all of our customers are in the same time zone as the server. We are bringing another server online in Arizona (Mountain Standard Time).</p> <p>We are storing a...
<p>I had the same issue. We sold our application to a user that was in a different time zone than the web server. We did not store any time information in UTC, but it was actually working correctly. Time displayed in the server's time zone was displaying exactly 3 hours behind. All we had to do was add a time zone drop...
How can I wrap a method so that I can kill its execution if it exceeds a specified timeout? <p>I have a method that I would like to call. However, I'm looking for a clean, simple way to kill it or force it to return if it is taking too long to execute.</p> <p>I'm using Java.</p> <p>to illustrate:</p> <pre><code>log...
<p>You should take a look at these classes : <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/FutureTask.html">FutureTask</a>, <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Callable.html">Callable</a>, <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Ex...
MYSQL: Create Table If Not Exists <p>If I do a <strong>Create Table If Not Exists</strong>, and a table with the same name exists with fewer rows (or columns), what would happen?</p>
<p>The table will not be created if a table with the same name already exists regardless of table layout.</p>
Transfer variables between PHP pages <p>I want to get user input in one page, store that in a php variable and use it in another php page. I have tried using 'sessions' but it doesn't seem to be working. Is there another safe alternative? This information is likely to be usernames and passwords.</p>
<p>Try changing your session code as this is the best way to do this.</p> <p>For example:</p> <h2>index.php</h2> <pre><code>&lt;?php session_start(); if (isset($_POST['username'], $_POST['password']) { $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; echo '&lt;a hr...
Convert a string to GregorianCalendar <p>I have a string from an email header, like <code>Date: Mon, 27 Oct 2008 08:33:29 -0700</code>. What I need is an instance of GregorianCalendar, that will represent the same moment. As easy as that -- how do I do it?</p> <p>And for the fastest ones -- this is <strong>not</strong...
<p>I'd recommend looking into the Joda Time library, if that's an option. I'm normally against using a third-party library when the core platform provides similar functionality, but I made this an exception because the author of Joda Time is also behind JSR310, and Joda Time is basically going to be rolled into Java 7 ...
In PHP, how do you change the key of an array element? <p>I have an associative array in the form <code>key =&gt; value</code> where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a func...
<pre><code>$arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]); </code></pre>
How to Programatically read the Documentation section of a WSDL in C# <p>i am using a WSDL file to create a the proxy class file, this service has a big Enumeration. the description for each enum value is in documentation section, how can i programatically read that section?</p>
<p>A WSDL file is always an XML file, so you can open it and read the elements data. For example, given the <a href="http://developer.ebay.com/webservices/latest/eBaySvc.wsdl" rel="nofollow">eBay Services WSDL file</a>, you can query the documentation of the value <code>COD</code> of the enumeration <code>BuyerPaymentM...
Asp.net Usercontrol LoadControl Issue <p>I am having an issue when using <code>LoadControl( type, Params )</code>. Let me explain...</p> <p>I have a super simple user control (ascx)</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewS...
<p>I have tried the following code as well - which yields the same result (i.e. both lblTitle and lblDescription are null)</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (_ErrorMessage != null) { lblTitle.Text = _ErrorMessage.Message; lblDescription.Text = _ErrorMessag...
Cross-site scripting from an Image <p>I have a rich-text editor on my site that I'm trying to protect against XSS attacks. I think I have pretty much everything handled, but I'm still unsure about what to do with images. Right now I'm using the following regex to validate image URLs, which I'm assuming will block inlin...
<p>Another thing to worry about is that you can easily embed PHP code inside an image and upload that most of the time. The only thing an attack would then have to be able to do is find a way to include the image. (Only the PHP code will get executed, the rest is just echoed). Check the MIME-type won't help you with th...
How Important is a Team Having Shared Vision? <p>Just watching <a href="http://www.infoq.com/interviews/11-Commitments-Jim-McCarthy" rel="nofollow">Jim McCarthy's talk</a> about 11 commitments for shared vision over at InfoQ and it got me thinking.</p> <p>Specifically, how important is having a shared vision to a team...
<p>Shared vision is fine, if you're talking about the ultimate goal of the project. A lot of times, this is extended into the minutiae of actually building the system.</p> <p>On a project I've worked on, the group had A Way to do things, and the majority held onto The Way even in cases when it didn't make sense, or wa...
How to use SQL_ASCII encoding in a rails application? <p>I have to connect to a legacy postgre database wich has <strong>ENCODING = 'SQL_ASCII';</strong>. How do I set this encoding in my rails app?</p>
<p>You can set this in your database.yml:</p> <pre><code>development: adapter: postgresql encoding: sql_ascii database: appname_development username: root password: host: localhost </code></pre>
How to manually drop down a DataGridViewComboBoxColumn? <p>I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let's say after a button is clicked.</p> <p>The reason I need this is I have set SelectionMode to FullRow...
<p>I know this can't be the ideal solution but it does create a single click combo box that works within the cell.</p> <pre><code> Private Sub cell_Click(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick DataGridView1.BeginEdit(True) If DataGridView1...
jQuery UI: Filter selectable dates on datepicker <p>I want to filter the selectable dates on a datepicker. I basically need to filter by work days - i.e. make holidays and weekends not selectable.</p> <p>I know you can specify dates using a function in the beforeShowDate: and you can also use $.datepicker.noWeekends.<...
<p>$.datepicker.noWeekends is a pretty simple bit of code:</p> <pre><code>function (date) { var day = date.getDay(); return [day &gt; 0 &amp;&amp; day &lt; 6, ""]; } </code></pre> <p>Since you're going to have to write up the function for holidays, you can just include this logic in that function too.</p>
Vista, Office Interop not working <p>Does anyone know how to get the MS Office 2007 .NET C# Interop libraries to work with Vista? </p> <p>I have a .NET C# application that I have setup to run as a Windows service. This program will open up a Word or Excel template depending on the situation and modify its contents ...
<p>On Vista and Windows Server 2008, services run in something called Session0. Before Vista, regular programs would run in Session0 alongside services.</p> <p>This means that Session0 has become a desktop-less wasteland where your services can't even access explorer.exe. I'm pretty sure the problem is that Office a...
Setting up a backup DB server in ASP.NET web.config file <p>I currently have an asp.net website hosted on two web servers that sit behind a Cisco load balancer. The two web servers reference a single MSSQL database server.</p> <p>Since this database server is a single point of failure, I'm adding an additional MSSQL ...
<p>What you want is called "failover", where if one database fails your queries are automatically redirected to the other. This is acheived at the database level, not the application. There are a lot of walkthroughs etc for setting up failover clusters: here's one for <a href="http://www.microsoft.com/technet/prodtec...
Single Table Inheritance in Django <p>Is there explicit support for Single Table Inheritance in Django? Last I heard, the feature was still under development and debate. </p> <p>Are there libraries/hacks I can use in the meantime to capture the basic behavior? I have a hierarchy that mixes different objects. The canon...
<p>There are currently two forms of inheritance in Django - MTI (model table inheritance) and ABC (abstract base classes).</p> <p>I wrote a <a href="http://web.archive.org/web/20090227074910/http://thisweekindjango.com/articles/2008/jun/17/abstract-base-classes-vs-model-tab/" rel="nofollow">tutorial</a> on what's goin...
What is the meaning of CHECKDB=FALSE in MSI? <p>When running an MSI through the command line what does passing the arguement "CHECKDB=FALSE" really do?</p> <p>The MSI of course can be anything from Microsoft, to Compuware DevPartner, to a programmer compiled MSI from .NET.</p>
<p>Running an MSI with that parameter would set the public property named CHECKDB equal to a false value. I have not seen that particular property before and I don't see any reference to it online. I suspect that it is specific to the MSI that you are using.</p>
"Join" of time series <p>I am designing a simple internal framework for handling time series data. Given that LINQ is my current toy hammer, I want to hit everything with it.</p> <p>I want to implement methods in class TimeSeries (Select(), Where() and so on) so that I can use LINQ syntax to handle time series data</p...
<p><code>Union</code> sounds like the right way to go - no query expression support, but I think it expresses what you mean.</p> <p>You might be interested in looking at the Range-based classes in <a href="http://pobox.com/~skeet/csharp/miscutil" rel="nofollow">MiscUtil</a> which can be nicely used for times. Combined...
How to use an Open Source License <p>I'm a little unsure how the open source licensing stuff works. If I were to choose a particular open source license, what do you actually have to do to make it applicable to your software? I would imagine it would be a little more involved than just 'stating' that you're releasing...
<p>It's as simple as deciding to license your software under a particular license. This is not technically contract law, but copyright law. As the owner/licenser of your intellectual property (the source and binaries) you may license its distribution anyway you see fit. Providing a clear disclaimer as to the recipie...
jQuery & ASP.Net Resources & Gotchas <p>What are some good jQuery Resources along with some gotchas when using it with ASP.Net?</p>
<p>ASP.Net's autogenerated id's make using jQuery's selector syntax somewhat difficult.</p> <p>Two easy ways around this problem:</p> <ul> <li>Search for objects using css class instead of id</li> <li>You can weed out the uniqueid garbage with: <code>$('[id$=myid]')</code></li> </ul>
Auto start print html page using javascript <p>Is there anyway to automatically run <code>javascript:window.print()</code> when the page finishes loading? </p>
<p><code>&lt;body onload="window.print()"&gt;</code> or <code>window.onload = function() { window.print(); }</code></p>
Indexing vs. no indexing when inserting records <p>I have a few questions about whether or not it would be best to not use indexing.</p> <p>BACKGROUND: My records have a timestamp attribute, and the records will be inserted in order of their timestamps (i.e., inserted chronologically).</p> <p>QUESTIONS:</p> <ol> <li...
<p>In my experience, yes, the database will insert stuff in the chronological order, especially if you never delete anything. However, it is not guaranteed, and it's a really bad idea to try to rely on behaviour that is not guaranteed.</p> <p>Also, the query planner isn't going to know this fact, so any query you do ...
Best way to access user/site settings <p>There have been a couple of questions that sort of dealt with this but not covering my exact question so here we go.</p> <p>For site settings, if these are stored in a database do you:</p> <ol> <li>retrieve them from the db every time someone makes a request</li> <li>store the...
<p>I suggest creating a module for retrieving preferences that could be implemented either way, and then for your first implementation hit the database every time since that's easier. If you have performance problems, add caching to the module to reduce the database traffic.</p>
What's a good way to profile the connection speed of Web users? <p>I have a client whose desired Web UI is graphically intense; we would like to gather statistics on the average bandwidth of those connecting to the site. Is there an easy way to do that? The "simplest thing that could possibly work" would seem to be a F...
<p>I would look at Google Analytics. It's a simple javascript that you include on your page, and it uses Google's massive analytics databases to track who's accessing your site over what sort of connections, which is all in a database that they maintain.</p> <p>You could certainly write a Flash or Silverlight (or jav...
What is the quickest way to get the String contents of a URL using Cocoa/iPhoneSDK? <p>Say I want to get the HTML of</p> <pre>http://www.google.com</pre> <p>as a String using some built-in classes of the Cocoa Touch framework.</p> <p>What is the least amount of code I need to write?</p> <p>I've gotten this far, but...
<p>The <i>quickest</i> way is to use NSString's <code>+stringWithContentsOfURL:</code> method. However, this is a modal call, and your application will be non-responsive while it runs. You can either move it to a background thread, or use the NSURLConnection class to make a proper, asynchronous request.</p>
Groovlet in Grails apps <p>How do I drop a Groovlet into a Grails app? Say, for example, in web-app/groovlet.groovy</p> <pre> import java.util.Date if (session == null) { session = request.getSession(true); } if (session.counter == null) { session.counter = 1 } println """ &lt;html> &lt;head> &lt;t...
<ol> <li><code>grails install-templates</code></li> <li>Edit <code>src/templates/web/web.xml</code> to include your groovlet</li> <li><code>grails war</code></li> <li>deploy</li> </ol> <p>I've not personally done this to incorporate a groovlet, but this is the documented way to modify the deployed Grails <code>web.xml...
Get MultiView like behavior with ASP.NET MVC <p>I am trying to build a generic form submission system using ASP.NET MVC. I'd like to make it as easy as possible to create forms with a form view and a "success" view. Using the WebForms method, this was easy and could be accomplished with templates or multiviews. With MV...
<p>You could it with the Controller</p> <pre><code>[AcceptVerbs("GET")] public ActionResult Signup( ) { // somecode that builds an html string ViewData["form"] = htmlStringYouBuilt; } [AcceptVerbs("POST")] public ActionResult Login( string username, string password ) { // etc } then in the view &lt;...
How is profiling different from logging? <p>How is profiling different from logging?</p> <p>Is it just that profiling is used for performance measurements to see how long each function takes? Or am I off?</p> <p>Typically, how are profiling libraries used?</p> <p>What types of stats are obtained by profiling?</p>
<p>Logging tells you <em>what</em> happened. It's great for forensics and debugging.</p> <p>Profiling quantifies that: it tells you how much time your code spent in each area, or how many times a body of code was executed. It helps you improve your code's performance.</p> <p>Profiling typically operates at the lev...
Multi Column Listbox <p>Is there a way to bind a Generic List to a multicolumn listbox, yes listbox...I know but this is what I am stuck with and can't add a grid or listview.</p> <p>Thanks</p>
<p>You could bind a list to a listbox like this:</p> <pre><code>List&lt;int&gt; list = new List&lt;int&gt; { 1, 2, 4, 8, 16 }; listBox1.DataSource = list; </code></pre> <p>As for multicolumn listbox documentation says <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.multicolumn.aspx" rel=...
What features make a site "social"? <p>If you are trying to position your web application as "social" (or Web 2.0), what are the top features you should implement?</p> <p>A decent starting point is <a href="http://www.marketingeric.com/12/10-features-every-social-website-should-have/" rel="nofollow">this page</a>, but...
<p>This strikes me as putting the cart before the horse. Work out what features will be useful to users, and implement those. If people deem the result to be "social" then so be it. If they don't, but it's still useful and popular, what's the problem?</p>
What are the ways to obtain HDD serial number without WMI? <p>I can get the HDD serial number using <code>ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")</code>, and for each <code>ManagementObject</code> from the result set I can read the serial number.</p> <p>I am interested in another way of obtaining...
<p><a href="http://www.winsim.com/diskid32/" rel="nofollow">http://www.winsim.com/diskid32/</a></p>
Copying content from a hidden or clipped window in XP? <p>I need to copy the content of a window (BitBlt) which is hidden, to another window. The problem is that once I hide the source window, the device context I got isn't painted anymore.</p>
<p>What you need is the <a href="http://msdn.microsoft.com/en-us/library/ms535695.aspx">PrintWindow</a> function that's available in Win32 API since Windows XP. If you need it to work with older versions of Windows, you can try <a href="http://msdn.microsoft.com/en-us/library/ms534856(VS.85).aspx">WM_PRINT</a>, althoug...
Algorithm: Voyage planning <p>I need to plan a voyage connecting n locations in the sea with a specified origin and specified destination with following constraints.<br /> The voyage has to touch all locations.<br /> If there is a reservation from A to B then a has to be touched before B <br /> The time spend at each l...
<p>See <a href="http://en.wikipedia.org/wiki/Travelling_salesman_problem" rel="nofollow">Traveling salesman problem</a></p>
Display Ajax Loader while page rendering <p>This is probably a simple question but how can I best use an AJAX loader in ASP.NET to provide a loading dialog whilst the page is being built?</p> <p>I currently have an UpdatePanel with an associated UpdateProgressPanel which contains the loading message and gif in a Progr...
<p>You can do it in HTML outside of .Net. In your ASPX page you have code like:</p> <pre> &lt;div id="loading"&gt;<br /> &lt;!-- Animated GIF or other indication that stuff is happening --&gt;<br /> &lt;/div&gt; </pre> <p>At the very bottom of your page, right before the you can have a code snippet that looks like ...
How can I change the size of scroll box(thumb) of a CScrollBar? <p>I can't find any method to change it. Any help will be appreciated!</p>
<p>The size of the scroll box is controlled by the range and page size of the scroll bar. You can use the <a href="http://msdn.microsoft.com/en-us/library/092c3690.aspx" rel="nofollow"><code>CScrollBar::SetScrollInfo</code></a> function to control these settings, specifically the <code>nMin</code>, <code>nMax</code>, a...
Rails meta plugin install script? <p>I wanna see if there is an approach to pack a few plugins together as a meta plugin that install everything together automatically, works like a project template.</p> <p>Why not a script? Because I want to put it in github so I don't have to worry about it when I am not with my own...
<p>My solution (ruby script):</p> <pre><code>plugins = %w{ http://url_to_plugin_1 http://url_to_plugin_2 http://url_to_plugin_3 http://url_to_plugin_4 http://url_to_plugin_5 } plugins.each do | p | `ruby script/plugin install -x #{p}` end </code></pre> <p>run from project root directory</p>
Is mutation testing useful in practice? <p>Do you have any examples of real life applications of mutation testing? Does it work better than simple test coverage tools? Or is it useless?</p> <p>What are the advantages/disadvantages of mutation testing in the real world?</p>
<p>The usefulness of unit tests is no longer discussed. They are essential in conception of a quality application. But, how can we assess their relevance? A code coverage indicator up to 100% doesn’t mean the code is 100% tested. This is just a view of executed code during unit tests execution. Mutation testing will ...
Downsides to using Int64 universally instead of int (C#) <p>We use a base entity with properties such as version (datetime needed for NHibernate) and guid (as key).</p> <p>It also has an Id (int) field with two functions. Firstly to relate to legacy application key if there is one. Secondly as a shorthand code: for ...
<p>If your app is running on a 64 bit CPU then probably not much difference at all.</p> <p>On a 32 bit CPU, a 64 bit integer will be more processor intensive to perfom calculations with.</p> <p>There is also the obvious memory use.</p>
How to set the PYTHONPATH in Emacs? <p>Emacs does not recognize my correct python path. I think it is a general problem with emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed.</p> <p>I have set the PYTHONPATH in my ~/.bashrc. ...
<p><code>.bashrc</code> only gets read when a shell starts; it won't affect Carbon Emacs. Instead, use <code>setenv</code> in your <code>.emacs</code>:</p> <pre><code>(setenv "PYTHONPATH" "PATH_STRING_HERE") </code></pre> <p>You can set <code>PYTHONPATH</code> for the entire Mac OS session, by adding it to <code>~/.M...
ASP.NET Session State Server - Saving Unserialized Data <p>As you know, in ASP.NET, you can store session data in one of following three modes:</p> <ul> <li>InProc</li> <li>Session State </li> <li>SQL Server</li> </ul> <p>For InProc mode, you can store any kind of data objects even it's not serializable. However, in ...
<p>AFAIK, the simple answer is no. If you don't mind changing your code, you could inject a wrapper object between the actual object and yours, and make your wrapper deal with serializing the wrapped object (essentially as a serialization surrogate) - but by then it would almost be easier to simply re-write the code......
Can I find out which control events will fire on an ASP postback? <p>Is it possible to get a list of control events that are going to fire before they happen, say inside the <code>Page_Load</code> handler?</p> <p>For example if a button was clicked can I figure this out before the <code>button_click</code> event handl...
<p>Unfortunately, interrogating the __EVENTTARGET value won't do the trick. Often, that value will be empty. The postback processing makes some decisions about what events to raise based on more than just the event target value (if any) testing control state values against the values posted by the form (such as for ...
Passing input to a state machine (c#) <p>I'll try to explain my scenario as best i can;</p> <p>At each application <em>tick</em> I query the current state of the keyboard and mouse and wrap them in individual classes and data structures. For the keyboard it's an array of my <em>Keys</em> enum (one item for each of the...
<p>Why are you querying the state of the keyboard and mouse with each tick? A much better and traditional solution would be to capture events fired from the keyboard and mouse. That way you only need to update the state when you HAVE to.</p>
What are some useful PHP Idioms? <p>I'm looking to improve my PHP coding and am wondering what PHP-specific techniques other programmers use to improve productivity or workaround PHP limitations.</p> <p>Some examples:</p> <ol> <li><p>Class naming convention to handle namespaces: <code>Part1_Part2_ClassName</code> map...
<p>Ultimately, you'll get the most out of PHP first by learning generally good programming practices, before focusing on anything PHP-specific. Having said that...</p> <hr> <h2>Apply liberally for fun and profit:</h2> <ol> <li><p>Iterators in foreach loops. There's almost never a wrong time.</p></li> <li><p>Design...
Oracle PL/SQL Query Order By issue with Distinct <p>Does anyone know what is wrong with this query?</p> <pre><code> SELECT DISTINCT c.CN as ClaimNumber, a.ItemDate as BillReceivedDate, c.DTN as DocTrackNumber FROM ItemData a, ItemDataPage b, KeyGroupData c WHERE a.ItemTyp...
<p>You will need to modify the query as such:</p> <pre><code>SELECT DISTINCT c.CN as ClaimNumber, a.ItemDate as BillReceivedDate, c.DTN as DocTrackNumber, a.DateStored FROM ItemData a, ItemDataPage b, KeyGroupData c WHERE a.ItemTypeNum in (112, 113, 116, 172, 189) ...
adodb and access changing ® to ® <p>i connecting to a access database with php and adodb. Strings with characters like ® are saved in the database as ® . What can i do to store it correctly?</p>
<p>Looks like you're passing in a UTF8 string but you're not storing it as UTF8. Change it one way or the other so they match up (preferably change your database to UTF8).</p>
How to fake a validation error in a MonoRail controller unit-test? <p>I am running on Castle's trunk, and trying to unit-test a controller-action where validation of my DTO is set up. The controller inherits from SmartDispatcherController. The action and DTO look like:</p> <pre><code> [AccessibleThrough(Verb.Post)] ...
<p><a href="http://www.candland.net/blog/2008/07/09/WhatsNeededForCastleValidationToWork.aspx" rel="nofollow">http://www.candland.net/blog/2008/07/09/WhatsNeededForCastleValidationToWork.aspx</a> would appear to contain an answer.</p>
How can I automate running commands remotely over SSH? <p>I've searched around a bit for similar questions, but other than running one command or perhaps a few command with items such as:</p> <pre><code>ssh user@host -t sudo su - </code></pre> <p>However, what if I essentially need to run a script on (let's say) 15 s...
<p>You can run a local script as shown by che and Yang, and/or you can use a Here document:</p> <pre><code>ssh root@server /bin/sh &lt;&lt;\EOF wget http://server/warfile # Could use NFS here cp app.war /location command 1 command 2 /etc/init.d/httpd restart EOF </code></pre>
Assign auto-incrementing value to new column in Oracle <p>I have this table in an Oracle DB which has a primary key defined on 3 of the data columns. I want to drop the primary key constraint to allow rows with duplicate data for those columns, and create a new column, 'id', to contain an auto-incrementing integer ID f...
<p>Once you have created the sequence:</p> <pre><code>update mytable set id = mysequence.nextval; </code></pre>
Why are hidden form elements still read by JAWS? <p><strong>The Situation</strong></p> <p>I have an area of the screen that can be shown and hidden via JavaScript (something like "show/hide advanced search options"). Inside this area there are form elements (select, checkbox, etc). For users using assistive technology...
<p>This definitely looks like a bug in JAWS as the spec definitively states that display:none should cause an element and its children not to be displayed in any media.</p> <p>However, playing with the speak: aural property might be useful? I don't know as I don't have JAWS available.</p> <p><a href="http://www.w3.or...
VB.NET Importing Classes <p>I've seen some code where a <em>Class</em> is imported, instead of a namespace, making all the static members/methods of that class available. Is this a feature of VB? Or do other languages do this as well?</p> <p>TestClass.vb</p> <pre><code>public class TestClass public shared funct...
<p>One of the reasons this feature is in place is to emulate Visual Basic 6.0's GlobalMultiUse Option for Instancing. Visual Basic 6.0 doesn't have the ability to make modules public across a DLL boundary. Instead you set the instancing property to <code>GlobalMultiUse</code>. It is used mainly for utility classes like...
Apache Abdera Client - Posting/Putting <p>Looking for help using the Apache Abdera Atom Client. I am trying to post and put files to a feed but I am getting a 400 error saying that the content type must be <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code></p>
<p>You need to check where you are posting too. Abdera is used to post ATOM-XML format. It looks like you try to post to the same URL your web form is posting to, which would be a HTML submission a.k.a. <code>x-www-form-urlencoded</code>. Check with the blog server software if and where they support the ATOM publishing...
Strange error when creating Excel files with Spreadsheet_Excel_Writer <p>Here's the code. Not much to it. </p> <pre><code>&lt;?php include("Spreadsheet/Excel/Writer.php"); $xls = new Spreadsheet_Excel_Writer(); $sheet = $xls-&gt;addWorksheet('At a Glance'); $colNames = array('Foo', 'Bar'); $sheet-&gt;writeRow(0, ...
<p>The code in the question has a bug which causes the error.</p> <p>This line writes a bunch of column names to row 0</p> <pre><code>$sheet-&gt;writeRow(0, 0, $colNames, $colHeadingFormat); </code></pre> <p>Then we have the loop which is supposed to write out the value rows.</p> <pre><code>for($i=1; $i&lt;=10; $i+...
Does silverlight code need protection? <p>I don't quite understand how Silverlight code works within the browser. Are the assemblies downloaded to the client machine? Is there any chance of the code getting decompiled using Reflector or some similar tool? If so, what options does one have to protect the code? Do .net o...
<p>Whenever you are in a web browser, all client side code is downloaded to the machine and can be examined by the user. This goes for Javascript, Flash, and Silverlight.</p> <p>If you have proprietary code that absolutely must be hidden then you need to put it on the server and expose an API that the clients can cal...
Creating a System.Web.Caching.Cache object in a unit test <p>I'm trying to implement a unit test for a function in a project that doesn't have unit tests and this function requires a System.Web.Caching.Cache object as a parameter. I've been trying to create this object by using code such as...</p> <pre><code>System.We...
<p>When I've been faced with this sort of problem (where the class in question doesn't implement an interface), I often end up writing a wrapper with associated interface around the class in question. Then I use my wrapper in my code. For unit tests, I hand mock the wrapper and insert my own mock object into it.</p> ...
wxPython wxDC object from win32gui.GetDC <p>I am getting a DC for a window handle of an object in another program using win32gui.GetDC which returns an int/long. I need to blit this DC into a memory DC in python. The only thing I can't figure out how to do is get a wxDC derived object from the int/long that win32gui ...
<p>I downloaded the wxWidgets source and dug around, and I think this will work.</p> <p>You need the handle (HWND) for the external window, not the DC.</p> <pre><code>window = wx.Frame(None, -1, '') window.AssociateHandle(hwnd) dc = wx.WindowDC(window) </code></pre>
Farpoint spreadsheet - disable cell right click menu <p>I'm using Farpoint Spreadsheet for WinForms with C#. How can I disable the "context menu" displayed when right-clicking over a cell that is being edited?</p>
<p>set AutoClipboard property of fpspread component to false</p>
Query antivirus definitions date? <p>Is it possible at all to query (WMI?) the virus defnintions date of definitions installed on remote computers? I'd like to start specificially with Symantec Endpoint Protection, and then branch out to other antivirus products.</p> <p>This is a WinForms, .NET project.</p>
<p><strong>Symantec Endpoint Protection</strong></p> <p>There is no common library in use on operating systems to tell which definitions are in use. However, for each anti virus application you could find out if there's an API to call. Symantec Endpoint Protection goes without, but it stores activities in a Syslog com...
What is the proper syntax for a cross-table SQL query? <p>Right now, I have </p> <pre><code>SELECT gp_id FROM gp.keywords WHERE keyword_id = 15 AND (SELECT practice_link FROM gp.practices WHERE practice_link IS NOT NULL AND id = gp_id) </code></pre> <p>This does not provide a syntax error, however for v...
<p>I'm not even sure that is valid SQL, so I'm surprised it is working at all:</p> <pre><code>SELECT gp_id FROM gp.keywords WHERE keyword_id = 15 AND (SELECT practice_link FROM gp.practices WHERE practice_link IS NOT NULL AND id = gp_id) </code></pre> <p>How about this instead:</p> <pre><code>SELECT kw.gp_id, p....
app GUI similar to Control Panel in Vista <p>I was playing a bit with Windows Vista (still using XP) and I liked how the standard Control Panel worked. Do you think this design is good also for normal applications?</p> <p>I like the idea of showing main topics with large fonts + icons. Details within each main topic a...
<p>I'm on the fence on this. The old Windows XP layout got cluttered quickly with programs adding their own control panel applets, while the new Windows Vista layout can be annoying to process visually at first. The search feature really helps (though not <a href="http://toastytech.com/guis/osx14control.png" rel="nof...
Duplicate spring configurations being loaded? <p>I'm looking at the output from spring being loaded up by tomcat and there's something very strange...Everything is duplicated. What would cause this? Whatever it is, it's causing my application to run in odd ways.</p> <p><strong>Additional Info:</strong></p> <p>The a...
<p>Are you sure that something in the logging configuration isn't adding each category/logger to the appender more than once?</p> <p>That's something that's possible with log4j, not sure about JCL or whatever the latest version of Tomcat uses under the cover.</p>
C# refreshing textbox from BindingSource <p>I am having difficulty refreshing windows forms controls that are using a BindingSource object. We have a CAB/MVP/SCSF client that I (actually “we” since it is a team effort) are developing that will interact with WCF services running on a remote server. (This is our fir...
<p>I was having a similar issue today and found this works.</p> <pre><code>private void btnCancel_Click(object sender, EventArgs e) { this.MyTable.RejectChanges(); this.txtMyBoundTextBox.DataBindings[0].ReadValue(); this.EditState = EditStates.NotEditting; } </code></pre>
What do parentheses in a C variable declaration mean? <p>Can someone explain what this means?</p> <pre><code>int (*data[2])[2]; </code></pre>
<p><strong>What are the parentheses for?</strong></p> <p>In C brackets [] have a higher precedence than the asterisk *</p> <p><strong>Good explanation from Wikipedia:</strong></p> <blockquote> <p>To declare a variable as being a pointer to an array, we must make use of parentheses. This is because in C brack...