input
stringlengths
51
42.3k
output
stringlengths
18
55k
Quick way to return a list of custom objects from a page method w/o a separate BLL <p>I am using jQuery to retrieve a JSON object from a page method. I have a DAL which uses SubSonic and if I return objects created from SubSonic-generated classes I will clog up the pipes. :) You know, all public properties get serializ...
<p>The biggest recommendation might be to make it a "Collection" rather than a List, but with a simple webservice return, it isn't as big of a deal, as that recommendation is most typically in environments where the object still lives in a .NET assembly.</p> <p>I think it is easy to read as well.</p>
Passing variables to a view using Asp.net mvc and jQuery load() <p>I'm currently loading a view(ascx) into a div using jQuery load(). I want to pass some variables to the view when loading it though so i'm using $.load(view, data); This does not seem to cause any problems but i have no idea how to access the Json objec...
<p>In this case jQuery issues a POST request:</p> <pre><code>POST /controller/view HTTP/1.1 ... Id=1 </code></pre> <p>So, you can access the Id parameter as <code>Request.Form["Id"]</code>, or just as an action parameter:</p> <pre><code>public class Controller... { public ActionResult Index(string Id) { ... } }...
Trigger to update data on another sql server <p>I'm using two SQL Server, one is SQL Server 2000 and the other one is SQL Server 2005.</p> <p>When the table1 in SQL Server 2000 gets updated/inserted/deleted, I have to update another table in SQL Server 2005. Is it possible to achieve that in a trigger? If not, what wo...
<p>If you're wanting to replicate the data, not just set something differently, you should look at SQL Replication as it'll manage things a lot better. eg it will do the updates asynchronously.</p> <p>If you have to do them synchronously, or you just decide it's simpler or you need the whole operation wrapped as a sin...
Finding the farthest point in one set from another set <p>My goal is a more efficient implementation of the algorithm posed <a href="http://stackoverflow.com/questions/589145/what-does-this-mysterious-color-method-do-what-does-it-return">in this question</a>.</p> <p>Consider two sets of points (in N-space. 3-space fo...
<p>First you need to find every element's nearest neighbor in the other set.</p> <p>To do this efficiently you need a <a href="http://en.wikipedia.org/wiki/Nearest%5Fneighbor%5Fsearch">nearest neighbor</a> algorithm. Personally I would implement a <a href="http://en.wikipedia.org/wiki/Kd%5Ftree">kd-tree</a> just becau...
How do I import an Excel Spreadsheet into a blog..? <p>We are interested in trying to import an Excel spreadsheet into our Blog.</p> <p>A sample of the Excel spreadsheet that we generate each day and want to export into our Blog is located at:</p> <p><a href="http://www.wallstreetsignals.com/WhatsWorking.html" rel="n...
<p>Well, outside of creating a program (which is possible, using PHP, Perl, Java, etc and either an excel input module or converting to CSV or XML and processing that)...</p> <p>Have you considered using Google Documents or another online spreadsheet software? It's easy to import an excel spreadsheet, and then embed ...
What successful conversion/rewrite of software have you done? <p>What successful conversion/rewrite have you done of software you were involved with? What where the languages and framework involved in the process? How large was the software in question? Finally what is the top one or two thing you learned from being in...
<p>I'm going for "most abstruse" here:</p> <ul> <li>Ported an 8080 simulator written in FORTRAN 77 from a DECSystem-10 running TOPS-10 to an IBM 4381 mainframe running VM/CMS.</li> </ul>
Javascript: Error 'Object Required'. I can't decipher it. Can you? <p>I am using a javascript called 'Facelift 1.2' in one of my websites and while the script works in Safari 3, 4b and Opera, OmniWeb and Firefox it does not in any IE version. But even in the working browser i get the following error I cannot decipher.<...
<p>I agree with tvanfosson - the reason you're getting that error is quite likely because you're calling <code>init()</code> before the page is done loading, so <code>document.body</code> is not yet defined. </p> <p>In the page you linked, you should move the following code to the bottom of the page (just before the ...
How do I interpret this JVM fault? <p>I have a Java app that makes use of some native code, and it's faulting. I want to find out <em>where</em> it's faulting, but I'm not sure how to read the hs_err_pid dump file:</p> <pre><code>Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libj...
<p>For a general guide have a look at these two links <a href="http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/felog.html">Fatal Error Log Troubleshooting</a> and <a href="http://weblogs.java.net/blog/kohsuke/archive/2009/02/crash%5Fcourse%5Fon.html">Crash Course on JVM Crash Analysis</a></p>
How do I grow a database file? <p>I am trying to grow a database using the following the code below. However I get the following error. How do I check for size (3600MB) and grow it if necessary?</p> <pre><code>USING MyDatabase ALTER DATABASE MyDatabase MODIFY FILE (NAME = MyDatabase_data, SIZE = 3600MB) </code></pr...
<p>The size of the DB will be shown by</p> <pre><code>USE MyDatabase EXEC sp_spaceused </code></pre> <p>looking at the code for sp_spaceused (I happen to be looking at a SQL 2000 server, but same/similar would be true for SQL2005 / SQL2008)</p> <pre><code>USE master EXEC sp_helptext 'sp_spaceused' </code></pre> <p>...
Sharing single application across a 2 subdomains in IIS7 <p>I have an application that is currently deployed (ex. www.example.com ). However, now we have a "secure" subdomain, which will take all of the requests that need to be encrypted (ex. secure.example.com). The site that is at www.example.com is currently mappe...
<p>I think what you really meant to do was just right click on the web site for example.com and edit the bindings. In there you can add host names to that site.</p> <p>Make sure you add them for port 443 which is SSL.</p>
Check if a program exists from a Bash script <p>How would I validate that a program exists?</p> <p>Which would then either return an error and exit or continue with the script?</p> <p>It seems like it should be easy, but it's been stumping me.</p>
<p>Yes; avoid <code>which</code>. Not only is it an external process you're launching for doing very little (meaning builtins like <code>hash</code>, <code>type</code> or <code>command</code> are way cheaper), you can also rely on the builtins to actually do what you want, while the effects of external commands can ea...
MATLAB: determine dependencies from 'command line' excluding built in dependencies <p>Is there a way to determine all the dependencies of an .m file and any of the dependencies of the files it calls using a command in a script (command-line)?</p> <p>There was a question like this before and it was really good because ...
<p>Here are a couple of links I found helpful when I wrote up a simple function to create a <a href="http://www.mathworks.com/matlabcentral/fileexchange/20164" rel="nofollow">table of contents for an m-file</a>:</p> <ul> <li>A thread discussing the undocumented function <a href="http://www.mathworks.co.uk/matlabcentra...
Directory to store cached files in Rails? <p>I am generating some large files in my Rails application. Fortunately, they only need to be generated once. I would like to save these files to disk so that I don't have to generate them again.</p> <p>Which directory in my Rails application is the most appropriate place t...
<p>If security of the files is not an issue you can put them in a subdirectory of <code>public</code> (for example, <code>public/assets</code>) which in your deploy script is symlinked to a directory in <code>shared/public</code> so that when you redeploy the files are retained.</p> <p>If security is an issue, the sol...
Overriding int on a bit enum <p>I saw some .NET 2.0 code which looked like this:</p> <pre><code> public enum abc : int { value1 = 1, value2 = 2, value3 = 4 } </code></pre> <p>etc...</p> <p>Now I know the flags enum can be used for bit values (like above, right?) so you can do | "or" &amp;, etc, but what is t...
<p>It's not "overriding" <code>int</code>, it's indicating what type the enumeration is based on. The default is <code>int</code> so this actually isn't achieving anything, but in some cases you might want to base an enum on <code>long</code> to store more flags, or <code>byte</code> to save space if there will be very...
Wtf IE7 - AJAX calls using setTimeout <p>I have tested this on Firefox, Opera and Seamonkey. It works fine. When it comes to Internet Explorer 7. It works but upto a certain point. I am making an AJAX call to a PHP script every few seconds. In IE7 it makes the first AJAX call and it retrieves the data but it doesn't do...
<p>Are you requesting the ajax call via HTTP GET as opposed to HTTP POST? IE tends to use cached results of ajax calls unless you use POST instead of GET.</p> <p>EDIT: Since you've updated your question, I can see that you are indeed using the GET verb. Change it to POST and I bet your issue will be resolved.</p>
Client Certs on IIS - not sure I get it - experiences please? <p>Looking for some advice about the use of client certs to retro-fit access control to an existing app.</p> <p>Our company has an existing intranet app (classic ASP/IIS) which we licence to others. Up till now it's been hosted within each organisation that...
<p>I've done something similar...</p> <p>Generate the certificates internally from your org's domain controller. Export them both as PFX format for distribution, and CER format for you to import in IIS.</p> <p>Distribute the PFX format exports along with the CA certificate for your DC, so your customers machines will...
Parsing an HTML file with selectorgadget.com <p>How can I use beautiful soup and <a href="http://selectorgadget.com" rel="nofollow">selectorgadget</a> to scrape a website. For example I have a website - <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16819115017" rel="nofollow">(a newegg product)</a> and I...
<p>Inspecting the page, I can see that the specifications are placed in a div with the ID pcraSpecs:</p> <pre><code>&lt;div id="pcraSpecs"&gt; &lt;script type="text/javascript"&gt;...&lt;/script&gt; &lt;TABLE cellpadding="0" cellspacing="0" class="specification"&gt; &lt;TR&gt; &lt;TD colspan="2" class="t...
Tricks to debugging UITextField <p>I'm debugging some code and finding it difficult to see &amp; track the values being entered by the iPhone's keyboard into a UITextField (and from the UIDatePicker.)</p> <p>I would expect Arguments>self>textField>_text to reflect the value that was entered into the textField but it i...
<p>What you are asking is essentially;</p> <blockquote> <p>How can I view private class data in the debugger and have it reflect what I expect?</p> </blockquote> <p>The answers is basically that you can't. The _text field may be updated at a later date, or not used at all. </p> <p>If you do want a way to debug wha...
Is a "master preferences" class a good idea? <p>I have a class that manages user preferences for a large software project. Any class in the project that may need to set or retrieve a user preference from a persistent store is to call the static methods on this class. This centralized management allows the preferences...
<p>IMHO, I think that the answer to your first question is "yes" and "no".</p> <p>Preferences are commonly handled as a centralized class, in the sense that the class is a "sink" for many classes in the project. Trying to do it closer to the calling code means that if the same preference is later useful elsewhere, you...
@“Data Source=(local)\ SIRSYSTEM \ HEY;” – can’t connect if a string includes SIRSYSTEM <p>The name of my MS Sql server instance is HEY, but when trying to log on to Sql server via Microsoft Sql management studio, the login window displays as the name of a server "SIRSYSTEM\HEY". </p> <p>What is SIRSYSTEM? A...
<p>SIRSYSTEM is the server or workstation name hosting the instance; to connect to, it the datasource would be either .\HEY, or SIRSYSTEM\HEY, get rid of the (local)\</p>
Regular expressions for non-strings <p>I was wondering if there is such a thing as regular expressions for sequential data that isn't a string.</p> <p>I know that regular expressions essentially boil down to DFAs, but I'm more interested in higher-level languages for specifying these DFAs.</p>
<p>You can argue that a grammar is a form of regular expression for things that are more complex than just strings. In principle, you can devise regular expressions on other tokens than just characters. As one option, you could argue that a regex for Unicode is such a creature - it certainly isn't matching simple by...
Why can’t I use a SqlConnection instance until the SqlDataReader is closed? <p>From MSDN:</p> <blockquote> <p>While the SqlDataReader is being used, the associated SqlConnection is busy serving the SqlDataReader, and no other operations can be performed on the SqlConnection other than closing it. This is the case ...
<p>a) When <code>ExecuteReader</code> returns, the data has not all been retrieved and populated in the reader, it may still be streaming back from the database. That's the whole point of the <code>SqlDataReader</code> because it's more efficient to do this than to load it all up front.</p> <p>b) You can't retrieve ou...
TableAdapter - updating without a key <p>I'm a total newbie at the .net c# business and dove in this last week creating a form application to shuffle data around for SSIS configurations. The geniuses at MS decided not to apply a key to the table I'm working with - and generating a composite key of the two candidate fi...
<p>From your code i assume you are using a typed Dataset with the designer.</p> <p>Not having a primary key is one of the many reasons the designer will not generate Insert, Update or Delete commands. This is a limitation of the CommandBuilder.</p> <p>You could use the properties window to add an Update Command to th...
When is it best to use a new class rather than add to an existing class <p>I have a class called Player in the business layer of my web application.</p> <p>Player class has fields PlayerID, CategoryID and CountryID</p> <p>A function in Player Class calls a function in PlayerDB Class in the Data Access Layer which in ...
<p>Create a new class. If it makes sense as a separate logical entity then it should be it's own class.</p>
Struggling with currency in Cocoa <p>I'm trying to do something I'd think would be fairly simple: Let a user input a dollar amount, store that amount in an NSNumber (NSDecimalNumber?), then display that amount formatted as currency again at some later time. </p> <p>My trouble is not so much with the setNumberStyle:NSN...
<p>My solution:</p> <p><pre><code> - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { // Clear all characters that are not numbers // (like currency symbols or dividers) NSString *cleanCentString = [[textField.text component...
Why can some arrays be published but not others? <pre><code>type TStaticArray = array[1..10] of integer; TDynamicArray = array of integer; TMyClass = class(TObject) private FStaticArray: TStaticArray; FDynamicArray: TDynamicArray; published property staticArray: TStaticArray read FStat...
<p>Published declaration tells the compiler to store information in the virtual method table. Only certain kinds of information can be stored.<br /> The type of a published property cannot be a pointer, record, or array. If it is a set type, it must be small enough to be stored in an integer.<br /> (O'REILLY, DELPHİ I...
Can someone explain why MySQL returns both values when name = 'test': "test" and "test " <p>I have the following table and data:</p> <pre><code>CREATE TABLE `test` ( `id` int(11) NOT NULL auto_increment, `name` varchar(8) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INS...
<p>From the mysql manual:</p> <blockquote> <p>Note that all MySQL collations are of type PADSPACE. This means that all CHAR and VARCHAR values in MySQL are compared without regard to any trailing spaces.</p> </blockquote> <p>Take note that MySQL does <strong>not</strong> remove the trailing spaces in a version 5.0....
IIS - Different processing of default document in Integrated Pipeline mode? <p>I have an HTTP Module to handle authentication from Facebook, which works fine in classic pipeline mode. </p> <p>In integrated pipeline mode, however, I'm seeing an additional request pass through for the default document, which is causing...
<p>Did you find a solution? Mine was to add the following code at the end of Application_BeginRequest:</p> <pre><code>if (Request.RawUrl.TrimEnd('/') == HostingEnvironment.ApplicationVirtualPath.TrimEnd('/')) Server.Transfer(Request.RawUrl+"Default.aspx", true); </code></pre>
What is the best way to store configuration variables in PHP? <p>I need to store a bunch of configuration information in PHP.</p> <p>I have considered the following....</p> <pre><code>// Doesn't seem right. $mysqlPass = 'password'; // Seems slightly better. $config = array( 'mysql_pass' =&gt; 'password' ); //...
<p>I've always gone with option #2 and just ensure that no one but the owner has ANY sort of access to it. It's the most popular method among PHP applications like Joomla, vBulletin, Gallery, and numerous others.</p> <p>First method is too messy to me (readability) and the third is WAY too dangerous to do. I've never ...
Netfiler hook not getting called <p>I am writing a kernel module which registers a hook with netfilter. The handler is not being called if I ssh/telnet into the machine where the module is loaded. </p> <pre><code>struct nf_hook_ops my_hook_ops; my_hook_ops.hook = hook_handler; my_hook_ops.pf = PF_INET; my_hook_ops.hoo...
<p>The protocol used here is different from the IP protocol number as assigned by IANA, for which 8 is for EGP and EGP has been outdated.</p> <p>The protocol field for sk_buff is defined in , for which 8 is for ETH_P_IP. As your data is allways IP traffic,the first conditional check is always true. So the second part ...
Cocoa - Modal Window With Animating NSOpenGLView behind it <p>I have an NSWindow subclass (GameWindow) containing an NSOpenGLView subclass (GameView).</p> <p>The app is windowed (does not go fullscreen).</p> <p>An OpenGL animation in GameView is fired ~30 times a second by a timer.</p> <p>For presentation reasons, t...
<p>Have you tried the regular sheet/dialog techniques? They should work fine for this situation. Timers are scheduled as part of the run loop, which doesn't stop when you have a modal sheet or window, so it should be able to continue on rendering in the background while events are blocked.</p> <pre><code>[NSApp beginS...
C#: Comparing with null <p>Are these equivalent:</p> <pre><code>if (null==myobject) { //do something } </code></pre> <p>and</p> <pre><code>if (myobject==null) { //do something } </code></pre> <p>or will they produce different code?</p>
<p>In the 99% case this code is equivalent. </p> <p>The one exception is when the type of the object in question overrides the == operator. It's possible for a bug to be introduced in == which causes problems when one parameter is null. </p> <p>A particular example I've seen before is the following</p> <pre><code...
Does n tier architecture break OO concept of encapsulation <p>I have an n tier application with presentation layer, business layer, DAL and business objects layer. Separating the objects and the operation written on the objects break the object oriented concept of encapsulation.</p>
<p>No. Consider what "encapsulation" means: the implementation details of a class are concealed behind the interface (messages, or methods) of the class.</p> <p>In fact, you can derive the n-tier architecture directly from OO principles and Parnas's Law: a module should encapsulate what's likely to change. The prese...
Recognize Missing Space <p>How can I recognize when a user has missed a space when entering a search term? For example, if the user enters "usbcable", I want to search for "usb cable". I'm doing a REGEX search in MySQL to match full words.</p> <p>I have a table with every term used in a search, so I know that "usb" a...
<p><a href="http://en.wikipedia.org/wiki/Text%5Fsegmentation" rel="nofollow">Text Segmentation</a> is a part of <a href="http://en.wikipedia.org/wiki/Natural%5Flanguage%5Fprocessing" rel="nofollow">Natural Language Processing</a>, and is what you're looking for in this specific example. It's used in search engines and...
Why does "int[] is uint[] == true" in C# <p>Can somebody clarify the C# <code>is</code> keyword please. In particular these 2 questions:</p> <p>Q1) line 5; Why does this return true?</p> <p>Q2) line 7; Why no cast exception?</p> <pre><code>public void Test() { object intArray = new int[] { -100, -200 }; ...
<p>C# and the CLR have somewhat different conversion rules.</p> <p>You can't <em>directly</em> cast between <code>int[]</code> and <code>uint[]</code> in C# because the <em>language</em> doesn't believe any conversion is available. However, if you go via <code>object</code> the result is up to the CLI. From the CLI sp...
Is there any way of throttling CPU/Memory of a process? <p>Problem: I have a developers machine (read: fast, lots of memory), but the user has a users machine (read: slow, not very much memory).</p> <p>I can simulate a slow network using Fiddler (<a href="http://www.fiddler2.com/fiddler2/">http://www.fiddler2.com/fidd...
<p>The platform SDK used to come with stress tools for doing just this back in the good old days (<code>STRESS.EXE</code>, <code>CPUSTRESS.EXE</code> in the SDK), but they might still be there (check your platform SDK and/or Visual Studio installation for these two files -- unfortunately I have niether the PSDK nor VS ...
Can humor cut down on perceived response time? <p>After reading a StackoOverflow question <a href="http://stackoverflow.com/questions/182112/funny-loading-statements-to-keep-users-amused">http://stackoverflow.com/questions/182112/funny-loading-statements-to-keep-users-amused</a>, I was really intrigued to ponder upon...
<p>After the 42nd time the widgetObject takes 40 seconds to load, the humor becomes annoying.</p> <p>When you are waiting for something to happen, it gives you a chance to see the flaw in the joke.</p> <p>Why didn't the #@#$ spend more time writing better code than writing jokes?</p>
Masked TextBox, how to include the promptchar to value? <p>How to include the prompt char on masked textbox's Text? I also want to save the prompt char</p> <p>Example i specify mask: &amp;&amp;&amp;&amp;/&amp;&amp;</p> <p>And prompt char of _</p> <p>Then I enter 12 4/5. the program should save it as 12_4/5. Any...
<p>You could create a derived class from the MaskedTextBox and then override the Text property. On setting you would find/replace the prompt char with a space and when getting replace the space with the prompt char.</p>
Fixing the auth_permission table after renaming a model in Django <p>Every now and then, you have the need to rename a model in Django (or, in one recent case I encountered, split one model into two, with new/different names). Yes, proper planning helps to avoid this situation, but sometimes reality intervenes. </p> <...
<p>Here's <a href="http://www.djangosnippets.org/snippets/698/" rel="nofollow">a snippet</a> that fills in missing contenttypes and permissions. I wonder if it could be extended to at least do some of the donkey work for cleaning up auth_permissions.</p>
Display BMP in JLabel <p>Java can display png, jpg a some other picture formats, but i have to display a bmp file in a JLable by getting the file path.</p> <pre><code>ImageIcon imageIcon = new ImageIcon(imageFile.getAbsolutePath()); </code></pre> <p>ImageIcon support the typical <code>png,gif,jpg</code> images.</p> ...
<p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageIO.html">javax.imageio.ImageIO</a> supports the BMP format:</p> <pre><code>Image image = ImageIO.read(imageFile); ImageIcon icon = new ImageIcon(image); JLabel label = new JLabel(icon); </code></pre> <p>ImageIO can also be used to convert between...
user guide and read me question <p>What is the difference between an application User Guide and a Read Me file?</p>
<p>I think the <code>README</code> file you see nowadays in the installation directory of an application is related with:</p> <ul> <li>installation pre-requisite</li> <li>post-installation steps</li> <li>first run precautions/caveat</li> <li>quick release notes</li> <li>current known limitations and support phone numb...
Verify signature Facebook Connect <p>I have followed the instructions in this great <a href="http://stackoverflow.com/questions/323019/facebook-connect-and-asp-net">Stackoverflow question</a> but i am not sure about this verify signature thing. Is this provided in some way in the Facebook Toolkit or do i have to do som...
<p>At the moment, you have to do it yourself. I've provided a simple method you can call to see if the signature is valid or not.</p> <pre><code>private bool IsValidFacebookSignature() { //keys must remain in alphabetical order string[] keyArray = { "expires", "session_key", "ss", "user" }; ...
hierarchical grid <p>Can anyone help me how to create a hierarchical Ultrawebgrid in ASP.net using C#... I'm very new to this... So i need some basics and sample codes .. Can u help me ?</p>
<p>One way to make an UltraWebGrid "Hierarchical" is to establish a data relation in a dataset and bind the dataset to the UltraWebGrid.</p> <p>As an example, let's say we have a Blog and we want to show the Blog Articles as the parent and then any comments made to each article as children in a Hierarchical UltraWebGr...
Which C# design pattern would suit writing custom workflow in asp.net <p>Trying to find some examples on the intertubes. I am thinking of state or strategy pattern but if anyone has any war stories, examples or resources that they could point me to it would be appreciated.</p> <p>I don't/can't use windows workflow.</p...
<p>How about the <a href="http://www.sloppycode.net/articles/csharp-design-patterns.aspx#state" rel="nofollow">State</a> pattern (<a href="http://en.wikipedia.org/wiki/State_pattern" rel="nofollow">wikipedia link</a>)?</p> <pre><code>public abstract class State { /// &lt;summary&gt; /// Holds the current state...
Is the 'synchronized' keyword in a classic enterprise application suspicious? <p>I am talking about classic enterprise applications. Typically hosted in some kind of application-server or container. Nothing fancy, just entities, services, Presentation/UI and relational storage.</p> <p>Whenever I see the <code>synchron...
<p>I agree with you for business logic code, but in an enterprise application you also have technical code and sometimes you need some synchronization for shared 'technical' state. The synchronized keyword may be used for this. (You also may relay on atomic variable, or use something outside your application like a DB ...
Wait for two threads to finish <p>If you have one main thread that starts two other threads. what is the cleanest way to make the primary thread wait for the two other threads?</p> <p>I could use bgndworker and sleep spinner that checks for both the bgnd workers's IsBusy, but I would think there's a better way.</p> <...
<p>Quick example using Thread.Join();</p> <pre><code> Thread t1 = new Thread(new ThreadStart(delegate() { System.Threading.Thread.Sleep(2000); })); Thread t2 = new Thread(new ThreadStart(delegate() { System.Threading.Thread.Sleep(4000); })); ...
Setup of TFS 2008 for automated testing <p>I'm confused.</p> <p>I have TFS installed on my development server, which also doubles as the build machine. The builds work fine when I check-in code, but when the build attempts to run the tests I get an error:</p> <p>MSBUILD : warning MSB6004: The specified task executabl...
<p>Yes - you need either the Developer or the Test edition of VSTS 2008 (Or the Team Suite Edition installed). This is so that the version of MSTest.exe that is able to publish the unit test results back into TFS is installed on the build server.</p> <p>So long as the people who check in stuff have a license to the a...
Is it worth learning SharePoint 2007? <p>Is it worth learning MOSS (Microsoft Office SharePoint Server) 2007? What could be the future of it?</p>
<p>SharePoint is <strong>the</strong> fastest growing product in Microsoft history.</p> <p>Even MS can't get enough experienced MOSS developers for support.</p> <p>Learn MOSS and you should be pretty sure to stay in business, crises and all.</p> <p>Also it's <strong>fun</strong>. I am aware that it has a rugged repu...
Constraints on SMTP Message-Id? <p>Are there constraints on the length and/or format of SMTP message-id's? I.e.: How long may they be, and are only certain characters allowed? (I plan to use only ASCII, but I fear that there may even be ASCII characters which aren't allowed.)</p> <p>RFC822 defines this, but are there ...
<p>The updated RFC is RFC2822.</p> <p>As of characters allowed, it basically ::alpha::|::digit::|[!#$%&amp;'<em>+-/=?^</em>`{}|~.] (It's also possible to quote literals).</p> <p>It has to contain @ separating "local part" and "domain part". It <strong>MUST</strong> be <strong>globally</strong> unique.</p>
C# How do I do I replace EventLogEntryType with a value from a comboBox? <p>In the code below I want to replace EventLogEntryType.Warning with a value selected from a combo box, the combobox values are EventLogEntryType.Warning, EventLogEntryType.Information, EventLogEntryType.Error. The combo box would just show "Warn...
<p>Assuming that EventLogEntryType is an enum and that you don't need to localize, you can do this very easy.</p> <p>In Form_Load</p> <pre><code> combobox1.Items.Add(EventLogEntryType.Warning); combobox1.Items.Add(EventLogEntryType.Information); ... </code></pre> <p>and later</p> <pre><code> myLog.WriteEnt...
Cross OS virtual drive functionality <p>Looking for online resources to implement a virtual drive functionality similar to ones implemented in products listed <img src="http://stackoverflow.com/questions/593971/what-online-file-storage-system-do-use-use/593999#593999" alt="here" /></p> <p>The solution should be cross ...
<p>A simple solution is to use the native SMB client for each of your target platforms, then use that to mount a custom Samba filesystem implemented using Samba's VFS API. Custom NFS servers have been used to implement cross platform Unix virtual file systems, but SMB is a much better choice to support Windows and Linu...
Am I missing something with my ListView selection event handling <p>...or are c# listviews really such a nightmare to manage?</p> <p>Okay the problem I'm working on is very simple. Or at least it appears to be so:</p> <p>I have a text file which contains information about customer orders on separate lines. The data i...
<p>Without knowing the code that's "starting to get quite long" I would suggest the following:</p> <p>Make sure Listview1.MultiSelect is false. Use a field (or property) on your Form to track the SelectedItem. In the event, check if the new ListView1.Selecteditems[0] != this.SelectedItem</p> <p>Part 2: Take a look a...
Possible bug in ASP.NET MVC with form values being replaced <p>I appear to be having a problem with ASP.NET MVC in that, if I have more than one form on a page which uses the same name in each one, but as different types (radio/hidden/etc), then, when the first form posts (I choose the 'Date' radio button for instance)...
<p>Yes, this behavior is currently by design. Even though you're explicitly setting values, if you post back to the same URL, we look in model state and use the value there. In general, this allows us to display the value you submitted on postback, rather than the original value.</p> <p>There are two possible solution...
INotifyPropertyChanged not working on ObservableCollection property <p>I have a class called <code>IssuesView</code> which implements <code>INotifyPropertyChanged</code>. This class holds an <code>ObservableCollection&lt;Issue&gt;</code> and exposes it as a <code>DependencyProperty</code> called Issues for consumptio...
<p>First: there's no reason to implement <code>INotifyProperty</code> changed for DependencyProperties. DependencyProperties know when they change.</p> <p>Second: I don't see an <code>ObservableCollection</code> in your code.</p> <p>Third: it's not entirely clear to me (from the code you posted) where the issues you ...
What's the "right" way to isolate control dependencies <p>I've made it a personal rule to inherit every UI control before using it. In a previous life I'd always considered this one of the less useful things you could do because the justification always seemed to be "I might want to change the font on all the buttons ...
<p>If both 1 &amp; 2 are inheriting, then they are functionally identical, no? Should one of them be <em>encapsulating</em> a control? In which case you have a lot of pass-thru members to add. I wouldn't recommend it.</p> <p>Peronally, I simply wouldn't add extra inheritance without a very good reason... for example, ...
C# binary literals <p>Is there a way to write binary literals in C#, like prefixing hexadecimal with 0x? 0b doesn't work.</p> <p>If not, what is an easy way to do it? Some kind of string conversion?</p>
<p>Since the topic seems to have turned to declaring bit-based flag values in enums, I thought it would be worth pointing out a handy trick for this sort of thing. The left-shift operator (<code>&lt;&lt;</code>) will allow you to push a bit to a specific binary position. Combine that with the ability to declare enum va...
Overriding static variables when subclassing <p>I have a class, lets call it A, and within that class definition I have the following:</p> <pre><code>static QPainterPath *path; </code></pre> <p>Which is to say, I'm declaring a static (class-wide) pointer to a path object; all instances of this class will now have the...
<p>Use a virtual method to get a reference to the static variable.</p> <pre><code>class Base { private: static A *a; public: A* GetA() { return a; } }; class Derived: public Base { private: static B *b; public: A* GetA() { return b; } }; </code></pre> <p>Notice that B derives ...
How to Set Form Validation Rules for CodeIgniter Dynamically? <p>With the new version of CodeIgniter; you can only set rules in a static <code>form_validation.php</code> file. I need to analyze the posted info (i.e. only if they select a checkbox). Only then do I want certain fields to be validated. What's the best way...
<p>You cannot only set rules in the config/form_validation.php file. You can also set them with:</p> <pre><code> $this-&gt;form_validation-&gt;set_rules(); </code></pre> <p>More info on: <a href="http://codeigniter.com/user_guide/libraries/form_validation.html#validationrules">http://codeigniter.com/user_guide/lib...
C# Running a winform program as someone other than the logged on user <p>I need my winform program to run as another user (it will run under task scheduler) and not the logged on user. I suspect the trouble is my app is gui based and not command line based (does this make a difference) so the gui needs to load do its t...
<p>Scheduled Tasks can be 'run as' a specified user, which can be different to the logged-in user.</p> <p>You can specify this user when creating the task, or by editing the properties of an existing task.</p>
Fix for background-position in IE <p>I get this problem in IE7 when running a piece of code that uses jquery and 2 jquery plugins. The code works in FF3 and Chrome.</p> <p>The full error is:</p> <pre><code>Line: 33 Char: 6 Error: bg is null or not an object Code: 0 URL: http://localhost/index2.html </code></pre> ...
<p>A bit more digging about on the Interweb has revealed the answer: IE doesn't understand the selector <code>background-position</code>. It understands the non-standard <code>background-position-x</code> and <code>background-position-y</code>.</p> <p>Currently hacking something together to workaround it.</p> <p>Nice...
Why does this WPF button stretch across the window? <p>The button below always expands to be as wide as the TextBlock. I've tried StackPanel, DockPanel, Width="Auto", etc.</p> <p>How can I make the button expand to the <strong>size of its own text</strong> (as in HTML) and not to the size of text in its environement? ...
<p>All you need to do is set the HorizontalAlignment property on your button. It defaults to stretch therefore filling the available space.</p> <pre><code>&lt;Button x:Name="ButtonFavorite" HorizontalAlignment="Left" Content="Customers" Margin="10" Width="Auto" Click="ButtonFa...
Prefered Editor for Linux Kernel Development Newbies <p>Before you answer <strong>vi</strong>... I'm looking to set a development environment for programmers with mainly Windows/Visual Studio background. Of course Emacs and Eclipse come to mind as IDEs, but I just want to make sure I'm not missing anything with relatio...
<p>Well, if you are doing Linux Kernel work, perhaps you will be interested in Mr Torvalds <a href="http://marc.info/?l=git&amp;m=122955159617722&amp;w=2" rel="nofollow">opinion of emacs</a>...</p>
xslt hyperlink, separate the url and descption <p>I have a list in sharepoint with a hyperlink column.</p> <p>I'm putting this list into xml and applying xslt to it.</p> <p>the xml is producing output in the form of:</p> <pre><code>&lt;link&gt;http://www.foo.com, http://www.foo.com&lt;/link&gt; </code></pre> <p>how...
<p>How about:</p> <pre><code>&lt;xsl:template match="link"&gt; &lt;a href="{substring-before(.,',')}"&gt; &lt;xsl:value-of select="substring-after(.,',')"/&gt; &lt;/a&gt; &lt;/xsl:template&gt; </code></pre>
What are the pitfalls of setting enable_nestloop to OFF <p>I have a query in my application that runs very fast when there are large number of rows in my tables. But when the number of rows is a moderate size (neither large nor small) - the same query runs as much as 15 times slower. </p> <p>The explain plan shows t...
<blockquote> <p>What are the potential pitfalls of setting <code>enable_nestloop</code> to <code>off</code>?</p> </blockquote> <p>This means that you will never be able to use indexes efficiently.</p> <p>And it seems that you don't use them now.</p> <p>The query like this:</p> <pre><code>SELECT u.name, p.name FRO...
Return index value datetime.now.dayofweek but how? <p>is there any function of datetime return dayofweekindex? such as:<br> int Todaywhat_is_Index= = DateTime.Now.IndexOfDayofThisWeek;<br> if Today is friday, it must be return 5<br> ifToday is Saturday, it must be return 6<br> ifToday is Sunday, it must be return 0<br>...
<p>This little one-liner works independent of locale, with always Friday == 5</p> <pre><code>int x = (int)System.Globalization.CultureInfo .InvariantCulture.Calendar.GetDayOfWeek(DateTime.Now); </code></pre>
svn repository path changed: how to re-bind my local folder to it? <p>hello i have an repository that is visible as e:/svn/repository and it is checked out to a local folder c:/work Now repository path is changed to f:/general/svn/repository what svn command to use in order for c:/work to be bound to the new repository...
<pre><code>cd c:\work svn switch --relocate file:///E:/svn/repository file:///F:/general/svn/repository </code></pre>
Stemming - code examples or open source projects? <p>Stemming is something that's needed in tagging systems. I use delicious, and I don't have time to manage and prune my tags. I'm a bit more careful with my blog, but it isn't perfect. I write software for embedded systems that would be much more functional (helpful...
<p><a href="http://snowball.tartarus.org/" rel="nofollow">Snowball</a> stemmer (C &amp; Java) I've used it's Python binding, <a href="http://pypi.python.org/pypi/PyStemmer" rel="nofollow">PyStemmer</a></p>
Configuring IntelliJ IDEA to create main class for new projects <p>A friend is just starting to learn Java, using IntelliJ. He asks how can he set up some template so creating a new project will contain a default main class.</p> <p>Currently, when he creates a new project, it has no source files, and he has to add a R...
<p>I don't know if Settings->File Templates is what you have in mind, but I'll point it out just in case.</p> <p>You can easily create a class and add a main method by typing "psvm " and filling in the method body. You run it by right clicking on the class and selecting "Run". It's automatically be added to your Run...
.Net PropertyGrid DropDownList - return value different from show value <p>I want to be able to show in a propertygrid a dropdownlist that show some "string" value but return an "int" value.</p> <p>For example, let set I got this class :</p> <pre><code>public class MyObjectOptions : StringConverter { public overr...
<p>You can not use GetStandardValues for that. This method would be useful if you had to restrict your integer values to let's say 1, 5 and 10.</p> <p>If you want to show strings in your property value, you just need to override the ConvertTo and ConvertFrom methods of your TypeConverter. The PropertyGrid will use the...
Why am I having trouble with a deep copy in Objective C? <p>I'm assuming my understanding of how to perform a deep copy isn't just there yet. The same with some sub-optimal memory handling that I'm performing down below. This code below probably depicts a shallow copy, and I believe that's where my problem might be. I ...
<p>OK, you don't need to retain the return value from <code>createArrayWithDictionaries:</code> since you're not keeping it around. The return value is autoreleased. I'd strongly recommend reading up on how autoreleasing works. You only retain things that you intend to keep around in your object.</p> <p>Also, <code>us...
Fuzzy matching of product names <p>I need to automatically match product names (cameras, laptops, tv-s etc) that come from different sources to a canonical name in the database.</p> <p>For example <strong>"Canon PowerShot a20IS"</strong>, <strong>"NEW powershot A20 IS from Canon"</strong> and <strong>"Digital Camera C...
<p>I think this will boil down to distinguishing key words such as <strong>Lenovo</strong> from chaff such as <strong>New</strong>.</p> <p>I would run some analysis over the database of names to identify key words. You could use code similar to that used to generate a word cloud. </p> <p>Then I would hand-edit the ...
Difference between generic argument constrained to an interface and just using the interface <p>What is the difference between this:</p> <pre><code>void MyMethod(IMyInterface value) { //... } </code></pre> <p>and this:</p> <pre><code>void MyMethod&lt;T&gt;(T value) where T : IMyInterface { //... } </code></p...
<p>The main functional difference is that you can know the actual type of the object inside of the generic method. The T parameter will contain the actual type which can advantageous in certain scenarios. </p> <p>In the non-generic case you cannot guarantee access to the underlying type of the object. Most of the t...
Does PyS60 has a reliable garbage collection? <p>I have heard it many times that garbage collection in PyS60 is not up to to the mark. This imposes a lot of limits on writing cleaner code. Can I at least rely that the non cyclic references are cleaned up after a function exists.</p>
<p>PyS60 as of version 1.9.0 uses Python 2.5.1 core and has no problems with garbage collection.</p>
Jasper in Jetty 6 throws exception for JSTL tag <p>I'm trying to run an application in jetty that runs fine in Tomcat 5.5. The app uses servlet 2.4 and JSP 2.0.</p> <p>Jetty/Jasper is throwing this exception:</p> <pre><code>org.apache.jasper.JasperException: /WEB-INF/tiles/layout/main.jsp(85,55) PWC6340: According t...
<p>Jetty includes their own JSTL library and there is no need to include jakrta taglib's standard and core jars. </p> <p>If you do put jakartat taglib's jars into your web application then there is a conflict in the forTokens tag that causes this error while other tags work well. I suggest either remove the jakarta ta...
EXEC(query) AT linkedServer With Oracle DB <p>I am using Microsoft SQL server 2005. I need to sync data between SQL server and an Oracle db. First thing I need is to find out if the count of data on Oracle side with certain filters(here I use ID as a simple example).</p> <pre><code>SELECT COUNT(*) FROM oracleServer..o...
<p>Just a quick update on this. I think I got the solution. I found it in a discussion on a similar issue at <a href="http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic14841.aspx" rel="nofollow">Dev NewsGroup</a>. Based on the information, I tried this:</p> <pre><code>DECLARE @myCount in...
What are the pros and cons for different methods of checking a Collection for a null before adding to a Set? <p>This is a follow up question to "<a href="http://stackoverflow.com/questions/591115/is-there-a-basic-java-set-implementation-that-does-not-permit-nulls">Is there a basic Java Set implementation that does not ...
<p>The second approach is better. Never hide exceptions - you are relying on the assumption that c.contains(null) only throws a NullPointerException in the case that there is a null in the collection. However if the NullPointeException is thrown because of a problem with an equals method you will have a bug in your c...
Replacing body.onload in a user control <p>I am refactoring a page that uses <code>&lt;body onload="myJS();"&gt;</code> to a user control. I understand I can do it using server side script registration on load.</p> <p>If I want to do it on the client side (ascx), how would I do this?</p>
<p>Taken from <a href="http://snipplr.com/view/3116/cross-browser-add-event-listener/" rel="nofollow">http://snipplr.com/view/3116/cross-browser-add-event-listener/</a></p> <pre><code>// Cross-browser implementation of element.addEventListener() function addEvent(evnt, elem, func) { if (elem.addEventListener) // ...
Why does strcmp() return 0 when its inputs are equal? <p>When I make a call to the C string compare function like this:</p> <p><code>strcmp("time","time")</code></p> <p>It returns 0, which implies that the strings are not equal.</p> <p>Can anyone tell me why C implementations seem to do this? I would think it would ...
<p>strcmp returns a lexical difference (or should i call it "short-circuit serial byte comparator" ? :-) ) of the two strings you have given as parameters. 0 means that both strings are equal</p> <p>A positive value means that s1 would be after s2 in a dictionary.</p> <p>A negative value means that s1 would be befor...
Are there any open source cross platform NAT punch throughs? <p>Are there any open source cross platform NAT punch throughs?</p>
<p>I haven't seen one, but you'll find more information than you require here:</p> <p><a href="http://www.enchantedage.com/node/8" rel="nofollow">http://www.enchantedage.com/node/8</a></p> <p>It's not terribly hard to implement, just a bit of work.</p> <p>There is code on the page that demonstrates this that builds ...
Visual Studio adds columns to DataGridView after running program <p>I have a datagridview that is linked to a three columns in the database, and it's only displaying them (no editing). When I run the program in debug, and exit, when I return to the form in Visual Studio, it has my three columns, plus all the columns in...
<p>Is <code>AutoGenerateColumns</code> set to <code>True</code> ?</p> <p>You should set it to <code>False</code> if you want to prevent the DGV from creating columns (in addition to those you created manually) from the datasource.</p> <p>Edit: To clarify, this admittedly weird behaviour could result if the property i...
Executing a Cygwin process from .NET? <p>I'm trying to launch Cygwin version of ruby.exe from a .NET application, but I'm stuck.</p> <pre><code>c:\&gt;"c:\cygwin\bin\ruby.exe" c:\test\ruby.rb /usr/bin/ruby: no such file to load -- ubygems (LoadError) </code></pre> <p>As you see Ruby can't locate libraries because it'...
<p>Are you using perhaps mixing native Windows rubygems and Cygwin ruby? Using Cygwin rubygems seems to work fine for me. (Why is your Cygwin ruby interpreter apparently searching a path with Windows backslashes in it?).</p> <p>Alternatively, have you tried <code>run.exe</code>?</p> <pre><code>C:\cygwin\bin\run.exe -...
Loading cells via nib and referencing components in them <p>I'm loading a UITableViewCell that contains two tagged labels. The user will leave the current view, containing the following code and go to another view. A name value is set there and the user comes back to this view (code below). I assign the name they se...
<p>From the look of this code it is less likely that you are getting "a new label misaligned on top of my other labels" and more like the drawing is failing to repaint on top of things properly. To make this work, you can try calling [tableView reloadData] or using an observer, but I think there is a better way.</p> ...
Google Checkout : Best way to handle cart editing and checkout confirmation <p>I am in the process of implementing Google Checkout in an e-store. Once customers click the 'Google Checkout' button, my project requires that they are able to navigate back to the e-store to possibly edit the cart. Customers should be able ...
<p>I've done this using 2 different approaches, neither properly fulfils your requirement of handling the back button AND clearing the basket if they complete the order, but they've worked for me in practice without any complaints.</p> <p><strong>First approach</strong>: clear the basket and provide way of reconstruct...
VS2005: How to automatically generate a build number with date? <p>I have a .net 2.0 C# application in Visual Studio 2005 for which I'd like to automatically generate the correct version build number which should contain a number that allows me to guess the build date of the application.<br /> I tried to use the <a hre...
<p>You'll want to look at <a href="http://msbuildtasks.tigris.org/" rel="nofollow">msbuildtasks</a>. It is an open source set of msbuild tasks. The module has a task to increment/modify/etc a build number. It's also super easy to use and super easy to extend.</p>
Disable texturing in OpenSceneGraph <p>I need to completely disable texturing in OSG. I tried <code>glDisable(GL_TEXTURE_2D)</code> and also using an osg::stateSet, but some nodes that have textures still render their textures. Is there any way to globally turn off texturing?</p> <p>A bit of background : I need to pro...
<p>Did you make sure to set the osg::StateAttribute::OVERRIDE bit when setting the Texture2D attribute? i.e. something like</p> <pre><code>osg::Texture2D*const tex2D = new osg::Texture2D; ss-&gt;setAttributeAndModes( tex2D, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE ); </code></pre> <p>where <code>ss</c...
Do i need to close a MySqlConnection in asp.net? <p>I've read that in PHP non-persistent open links are automatically closed at the end of the script's execution. So what's up with asp.net?</p>
<p>Simple: PHP and ASP.NET aren't the same thing. They have different "rules". Don't try to write code in one environment as if it were the other.</p> <p>In .NET should almost always open a connection as late as you can and close it as early as you can, letting the built-in connection pool handle the "real" connection...
jquery: ajaxError always fires last <p>I am building a page that may receive <strong>LARGE</strong> amounts of html from an ajax call, which it than insert into the page. Sometimes, instead of the html i am expecting, i will get an http 401 error. Ideally i want to have the error handler fire first, so i can set an e...
<p>You should be using the <code>success</code> handler instead of <code>complete</code> to update the html because it will be triggered only if the server sends 200.</p>
ADO.NET Entity Framework I can't see Foreign Key Property in Model <p>I have 2 table. In first table I have a Foreign Key link to second table's primary key.</p> <p>(second)Personel and (first)Istbl are my tables.</p> <p>In personel table I have PersonelID , PersonelName, PersonelSurname.</p> <p>In Istbl table I hav...
<p>EF v1 hides foreign keys because it views them as persistence artifacts not important to the domain model. See <a href="http://www.thedatafarm.com/blog/2007/09/11/EntityDataModelAssociationsWheresMyForeignKey.aspx" rel="nofollow">here</a> for a discussion.</p> <p>EF v2, shipping with .NET 4, will include much bette...
Flash Site Architecture - one swf vs many? <p>I'm about to start building a site entirely in flash (per the client's request), using AS3, and was wondering about best practices for doing so in terms of application architecture. The site isn't too large--think homepage, persistent nav, 8 subsections or so, each with the...
<p>It depends on what you mean by "smaller."</p> <p>Don't break it into chunks that are too small or you'll kill yourself with connection overhead. Don't pack the whole site into one mammoth wad that will takes weeks to download.</p> <p>A good rule of thumb: if you find yourself trying to think up catchy or entertai...
NUnit - specifying a method to be called after every test <p>Does NUnit let me invoke a method after every test method?</p> <p>e.g.</p> <pre><code>class SomeClass { [SomeNUnitAttribute] public void CalledAfterEveryTest() { } } </code></pre> <p>I'm aware of [SetUp] and [TearDown], but that only works for ...
<p>The [TearDown] Attribute marks the cleanup method.</p> <p>If you want it for multiple classes I believe you can add the teardown method to a base class and inherit from that in every test class that needs the teardown behaviour.</p>
Sql Aggregate Results of a Stored Procedure <p>I currently have a stored procedure that returns a list of account numbers and associated details. The result set may contain multiple entries for the same account number. I also want to get some aggregate information such as how many distinct accounts are contained within...
<pre><code>DECLARE @tt TABLE (acc INTEGER) INSERT INTO @tt EXECUTE mystoredproc_sp SELECT acc, COUNT(*) FROM @tt GROUP BY acc </code></pre>
Software Testing against multiple versions of SQL Server <p>I'm currently working on a test plan and ran into a possible problem and I was wondering if anyone had any suggestions.</p> <p>The application uses SQL Server and it can connect between the different versions for compatibility (2000, 2005, 2008). Well i'm tr...
<p>Your test plan makes sense, although it's probably not something you'll have to conduct more than once. Just make sure you have some type of automated test plan set up.</p> <p>At a minimum, test XP against 2k and 2k5, and Vista/Win7 against 2k5 and 2k8.</p>
VB.NET List(of X).Contains Behavior <p>I have a custom class set up as a key that has two properties, X and Y</p> <p>I have something similar to this:</p> <pre><code>Dim test As New List(of TestClass) Dim key as New TestData key._a = A key._b = B For Each a As TestClass In SomeCollection If Not test.Contains(key)...
<p>It uses the <code>Equals</code> method to check for identity.</p> <p>By default (if not overridden) <code>Equals</code> returns <code>true</code> if two references are identical or two structures are equal memberwise.</p>
How can I tell whether an element matches a selector? <p>Let's say I've got a DOM element - how can I tell whether it matches a jQuery selector, such as <code>p</code> or <code>.myclass</code>? It's easy to use the selector to match children of the element, but I want a true/false answer to whether this particular elem...
<p>You can use the <a href="http://docs.jquery.com/Is"><code>is()</code></a> method:</p> <pre><code>if($(this).is("p")){ // ... } </code></pre>
PolicyException: Required permissions cannot be acquired — what does this error mean <p>Got this error when trying to load an aspx page:</p> <pre><code>Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception c...
<p>Do you have the web app configured as Medium Trust and the SQLite.NET assembly requires Full Trust?</p> <p>See if adding this to your web.config fixes it:</p> <pre><code>&lt;system.web&gt; &lt;securityPolicy&gt; &lt;trust level="Full" /&gt; &lt;/securityPolicy&gt; ... &lt;/system.web&gt; </code></...
Suitable environment for a 7 year old <p>My 7 year old would like to learn, how to program? (his idea not mine, and he does things in the outside world. So, I am not too worried from that point of view. He already went so far as to take a game programming book out of my office to read at bed time.) The other day we sat...
<p>There is actually a browser-based Logo interpreter in Javascript.</p> <p><a href="http://logo.twentygototen.org/">http://logo.twentygototen.org/</a></p>
wxPython toolbar help <p>I am new to Python. I am writing an application using wxPython and I currently my code that generates a toolbar looks like this:</p> <pre><code>class Window(wx.Frame) def __init__(self, parent, plot): wx.Frame.__init__(self, parent, wx.ID_ANY, "Name", size =(900, 600)) self.Centre() ...
<p>Instead of a class that sets up your toolbar, use a function. The function can be a member function of your Window that subclasses wx.Frame. That way, the toolbar will get Created from the correct window, and be attached the way you would expect.</p> <p>The class that you're writing above would work, if it knew ...
PHP mysqli unexpected parameter Question <p>I feel like a total n00b for not understanding what I'm doing wrong, but here goes.</p> <p>I'm writing a simple web form that's storing information in a MySQL database. I'm getting this error:</p> <pre><code>mysqli_stmt_init() expects parameter 1 to be mysqli, null given in...
<p>Are you 100% sure you are successfully connecting to the database?</p> <p>Add at the top of your script:</p> <pre><code>error_reporting(E_ALL); ini_set('display_errors', 1); </code></pre> <p>Also add right below your connection line:</p> <pre><code>if (mysqli_connect_errno()) { printf("Connect failed: %s", m...
Objects returned from Silverlight Async calls lose their contained aggregates <p>A call from a Silverlight 2.0 control to a WebService, returned via MyWebServiceNameEventArgs is not returning contained List&lt;> aggregates. For Example, I've got a Person class that has a List and List. When I trace the call I see tha...
<p>Dumb error, I forgot to refresh the ServiceReference in the Silverlight app.</p>
what is /dev/windrvr6 <p>What is /dev/windrvr6 Is this a generic driver? I have 2 card made by different vendors using /dev/windrvr6 and they seem to work fine. Will this be a problem in the future?</p>
<p>It could be that they both used tools from <a href="http://www.jungo.com/" rel="nofollow">Jungo</a>; they have products to help people make PCI drivers, and part of their common infrastructure is <a href="http://www.jungo.com/st/windriver%5Fusb%5Fpci%5Fdriver%5Fdevelopment%5Fsoftware.html" rel="nofollow">WinDriver</...