input
stringlengths
51
42.3k
output
stringlengths
18
55k
Query to find all the tables with date columns in it <p>Can anybody let me know the query to find all the tables that has a date columns on it.</p> <p>Thanks</p>
<p>This should do the trick, just add in additional types if you need them:</p> <pre><code>select so.name table_name ,sc.name column_name ,st.name data_type from sysobjects so inner join syscolumns sc on (so.id = sc.id) inner join systypes st on (st.type = sc.type) where so.type = 'U' and st.name IN ('DATETI...
Django FormWizard with dynamic forms <p>I want to implement a simple 2 part FormWizard. Form 1 will by dynamically generated something like this:</p> <pre><code>class BuyAppleForm(forms.Form): creditcard = forms.ChoiceField(widget = forms.RadioSelect) type = forms.ChoiceField(widget = forms.RadioSelect) def _...
<p>When I was trying to figure out FormWizard, I searched all over and found responses such as most of these that just say don't use it. FormPreview would work fine since OP is only interested in a one-level form, but the question is still valid in how to use FormWizard.</p> <p>Even though this question is so old, I ...
base64 encode in MySQL <p>I want to select a blob col from one table, base64 encode it and insert it into another tables. Is there any way to do this without round tripping the data out of the DB and through my app?</p>
<p>I was looking for the same thing and I've just seen that MySQL 5.6 has a couple of new string functions supporting this functionality: <a href="http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64">TO_BASE64</a> and <a href="http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#func...
How to Search date in SQL? <p>I am having an Event Management System in which i want,</p> <p>If an event is registered for 5 days (21 jan 2009 to 26 Jan 2009) Then if another person wants to register an event between 22 jan 2009 to 24 jan 2009 then it will not allow to register. I want to check this using SQL query, s...
<p>Just a to complete other answers, you have a good article on <strong><a href="http://www.devarticles.com/c/a/SQL-Server/Date-and-Time-Values-Using-SQL-Server-2000/" rel="nofollow">How to Search for Date and Time Values Using SQL Server 2000</a></strong> </p> <p>It reminds you about how date/time values are stored (...
How to install a windows service programmatically in C#? <p>I have 3 projects in my VS solution. 1 is a web app, the other is a windows service and the last one a setup project for my web app. </p> <p>What i want is by the end of the installation of the web app in my setup project, within my custom action to try and i...
<p>Ok, here is what REALLY worked for me, it has been tested on multiple machines with different OS ( Vista, XP, Win2k, Win2003 server )</p> <p>The code has been taken from <a href="http://www.tech-archive.net/Archive/VB/microsoft.public.vb.winapi/2006-08/msg00238.html">here</a> so full credit goes to whoever wrote th...
auto-check radio-button using struts <p>I have a jsp page with two radio tags. </p> <p>The page contains a struts2 form. When I submit the form one of two radio must be automatically checked.</p> <p>Is it possible to do that?</p>
<p>One of the features of a radio input is that an item in a radio set once selected cannot be deselected except by another member of the set being selected (unlike a checkbox "set"). i.e. if you initialise the page with a selection you can guarantee you will have a value. Does a default value exist you can do this for...
When adding new items to a database with foreign keys, should I use SQL triggers to create the related rows in other tables? <p>I am implementing a database design that has a vehicle table, vehicle engine and vehicle gear table with SQL 2005.</p> <p>Each table has an ID that is a SQL identity number, and each engine a...
<p>Whichever, there's no need to create rows in any of the tables for which you don't have data. It's fine to, for instance, have an engine row that is unmatched to a vehicle. You can add what's missing when you find it.</p> <p>I think I understand the design. Each vehicle can have one engine and one transmission. But...
JQuery Loop over JQueryObjects <p>I have a method, which will accept a parameter of a JQuery Object and will calculate totals for a section. So if you give it a JQuery Object of a div containing the section it will calculate a total for it</p> <p>so you can do this:</p> <p>var $totalcompletion = CalculateSectionCompl...
<p>You can wrap any DOM element in $(..), as you do with $(document).</p> <p>So I think you should be able to </p> <pre><code>jQuery("div.SectionContainer").each( function(i, valueOfElement){ CalculateSectionCompletion($(valueOfElement)); }); </code></pre>
Best way to make an expandable/collapsible subTable with rich:dataTable <p>I've recently ported an application from JSF 1.1 to JSF 1.2. In the process we removed tomahawk and decided to use rich instead.</p> <p>Now I need a way to make an expandable/collapsible detailViev for each row in the table. </p> <p>The only t...
<p>I've often added methods to my beans (or wrapper beans) which contain those properties as a way of working around JSF. It's not pretty but it works.</p> <p>The only other option I can think of at the moment is to use a JavaScript function to toggle the state of the details view. That wouldn't be ideal for a number ...
How do I implement Advanced combobox in CakePHP? <p>I have implemented combobox in cakephp using following statement - </p> <pre><code>echo $form-&gt;select('brand_id',array($brands),null,array(),'Choose Brand'); </code></pre> <p>for brand and input form for category - </p> <pre><code>echo $form-&gt;input('category_...
<p>Have 2 "other" fields:</p> <pre><code>echo $form-&gt;input('brand_other'); echo $form-&gt;input('category_other'); </code></pre> <p>You'll either need 2 more fields in your database table for the model of this form, or logic in your controller that adds values posted in these "other" fields to your brands and cate...
Why do I get an error using moveTo in JavaScript? <p>I am opening a new window from a button using var myWindow = window.open(...). I then want to move that window to the correct location on the screen. I use myWindow.moveTo(10,10) to do this but I get an Access Denied error.</p> <p>The window I open contains informat...
<p>You could try to put the information from the other site in an iframe located on the same host that runs the window.open JavaScript. Or maybe even better, get the information server-side and present it directly from your site. Iframes can be trouble.</p>
error C2065: 'CoInitializeEx' : undeclared identifier <p>I get the following error while trying to use <code>hres = CoInitializeEx(0, COINIT_MULTITHREADED);</code></p> <blockquote> <p>error C2065: 'CoInitializeEx' : undeclared identifier</p> </blockquote> <p>I have already included:</p> <pre><code>#define _WIN32_...
<p>Try placing the following line at the beginning of your precompiled header(<em>stdafx.h</em>).</p> <pre><code>#define _WIN32_WINNT 0x0400 </code></pre>
Batch how to end an for-loop properly <p>for testing purposes i need an recursive directory with some files, that comes to maximum path-length.</p> <p>The Script used for the creation consists only of two for-loops, as followed:</p> <pre><code>for /L %%a in (1 1 255) do @( mkdir %%a &amp;&amp; cd %%a &amp...
<p>I don't understand how to add a little comment below an answer, so I'll just do it here.</p> <p>The @ sign in front of the open parenthesis is needed only if echo is not already off. In that case, what would happen without the @ sign is that every command in the FOR loop would be echoed.</p> <p>And, yes, the reaso...
Specifying attribute values as CDATA <p>Can one specify XML attribute values as CDATA ? If yes - what would be the schema for the same. If not - why is this limitation not addressed in XML ?</p>
<p>No you cannot do this.</p> <p>There's a very fine line (and a very large debate) between what constitutes an attribute and what constitutes a child element. See <a href="http://stackoverflow.com/questions/152313/xml-attributes-vs-elements">here</a> for example. </p> <p>That given, the "limitation" isn't addressed ...
How to get the FxCop custom dictionary to work? <p>How is it possible to get the FxCop custom dictionary to work correctly?</p> <p>I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the '...
<p>If you use it inside Visual Studio...</p> <p>From <a href="http://blogs.msdn.com/fxcop/archive/2007/08/20/new-for-visual-studio-2008-custom-dictionaries.aspx">Visual Studio Code Analysis Team Blog</a></p> <blockquote> <p>To add a custom dictionary to a C# and Visual Basic project is simple:</p> <ol> <li...
Creating a delegate type inside a method <p>I want to create a delegate type in C# inside a method for the purpose of creating Anonymous methods.</p> <p>For Example :</p> <pre><code> public void MyMethod(){ delegate int Sum(int a, int b); Sum mySumImplementation=delegate (int a, int b) {return a+b;} Consol...
<p>Why do you want to create the delegate type within the method? What's wrong with declaring it outside the method? Basically, you can't do this - you can't declare a <em>type</em> (any kind of type) within a method.</p> <p>One alternative would be to declare all the Func/Action generic delegates which are present in...
path name and arguments of running processes using java code <p>I want to get the path name and arguments of running processes using java code. Is there any solution?</p>
<p>For instance, on Windows, one possibility is to encapsulate the <a href="http://www.rgagnon.com/javadetails/java-0593.html" rel="nofollow">system call to <code>TASKLIST.EXE</code></a> </p> <p>Extract from the code:</p> <pre><code>Process p = Runtime.getRuntime().exec("tasklist.exe /fo csv /nh"); BufferedRead...
Oxite or S#arp Architecture for new Asp.net CMS site <p>I'd like to build a CMS site based on Asp.Net Mvc and I want to choose my starting point.</p> <p>I have seen that there is a lot of interest in the new Microsoft Oxite project also if it seems to be pretty early to adopt it in a production project.<br /> I've als...
<p>Oxite might be feature rich, but the code quality is very low.</p> <p>I was very surprised when I checkout the code and found controller actions with 100+ lines of very unclean code, tagsoup views, no unit tests, etc.</p> <p>The criticism has been well summed up in these blog posts:</p> <p><a href="http://blog.we...
Cocoa equivalent of .NET's Environment.SpecialFolder for saving preferences/settings? <p>How do I get the reference to a folder for storing per-user-per-application settings when writing an Objective-C Cocoa app in Xcode?</p> <p>In .NET I would use the <code>Environment.SpecialFolder</code> enumeration:</p> <pre><cod...
<p>In Mac OSX application preferences are stored automatically through NSUserDefaults, which saves them to a .plist file <code>~/Library/Preferences/</code>. You shouldn't need to do anything with this file, NSUserDefaults will handle everything for you.</p> <p>If you have a data file in a non-document based applicati...
Getting started with Tomcat docs <p>Are there any <em>good</em> "Getting started with Tomcat" documents/tutorials/sites?</p> <p>The official docs are horribly written and jump from the intricacies of compiling Tomcat to how you should lay out your site on disk.</p> <p>Specifically I want to get Tomcat serving through...
<p>The best source I've found for deep understanding is a book called <em>How Tomcat Works</em>. There's also an O'Reilly title <em>Tomcat: The Definitive Guide</em> for more of a "how to" approach.</p>
Spring-WS: how to use WebserviceTemplate with pre-generated SOAP-envelope <p>Can you use a Spring-WS WebserviceTemplate for calling a webservice and avoid that it generates a SOAP-envelope? That is, the message already contains an SOAP-Envelope and I don't want that the WebserviceTemplate wraps another one around it. :...
<p>You're using ws-security in a strange way... I guess that you're trying to avoid ws-security dependancy by using pre-generated messages - for simple client might make sense, although it's definitely not by-the-book.</p> <p>You can configure WebServiceTemplate to use plain XML without SOAP by setting messageFactory ...
How can I get the value data out of an MSXML::IXMLDOMElement <p>I have an xml string </p> <pre><code>&lt;grandparent&gt; &lt;parent&gt; &lt;child&gt;dave&lt;/child&gt; &lt;child&gt;laurie&lt;/child&gt; &lt;child&gt;gabrielle&lt;/child&gt; &lt;/parent&gt; &lt;/grandparrent&gt; </code></pre> ...
<p>Iterate over the child nodes and build the string manually.</p>
How can I force the PropertyGrid to show a custom dialog for a specific property? <p>I have a class with a string property, having both a getter and a setter, that is often so long that the PropertyGrid truncates the string value. How can I force the PropertyGrid to show an ellipsis and then launch a dialog that contai...
<p>You need to set an <code>[Editor(...)]</code> for the property, giving it a <code>UITypeEditor</code> that does the edit; like so (with your own editor...)</p> <pre><code>using System; using System.ComponentModel; using System.Drawing.Design; using System.Windows.Forms; using System.Windows.Forms.Design; static c...
How can I add a big flash banner to the top of my Wordpress blog? <p>I don't know if it is possible to add a Flash banner into a Wordpress theme... Ideally, this banner would be in the header of the site always. Any ideas on how I might accomplish this?</p>
<p>Yes, it's very much possible. What I would recommend is to use <a href="http://code.google.com/p/swfobject/" rel="nofollow">swfobject</a> to replace the your current header with a Flash movie. This way it will degrade gracefully for everyone that lacks a proper flash player, and also you get the benefit of proper go...
Delete All Emails in a Highrise App <p>How do I delete all the emails in my <a href="http://highrisehq.com/" rel="nofollow">highrise</a> app? I don't want to delete the entire thing and start over, I've got companies and tags and metadata. What's the easiest way?</p> <p>This question paraphrased from <a href="http://g...
<p>It looks like this is available through the <a href="http://developer.37signals.com/highrise" rel="nofollow">API</a>, and should be easy with the <a href="http://developer.37signals.com/highrise/highrise.rb" rel="nofollow">ruby bindings</a>:</p> <pre><code>#!/usr/bin/env ruby ENV['SITE'] = "http://passkey:X@my.hiri...
Get a file system handle to a bluetooth mapped folder <p>Is there any way to get code level access to a bluetooth mapped drive? The simple use case is I have a bluetooth folder in Explorer that looks something like:</p> <p>"My Bluetooth Places\Entire Bluetooth Neighborhood\DEV1\OBEX File Transfer\E:\" </p> <p>which ...
<p>This is not possible. The way to achieve this is to open a Bluetooth serial connection to the device in question, and traverse its file system using the <a href="https://obex4j.dev.java.net/files/documents/2519/9269/OBEX13.pdf" rel="nofollow">OBEX File Transfer profile</a>.</p>
What are pitfalls for agile development methodologies? <p>What are pitfalls for agile development methodologies?</p>
<p>The <a href="http://en.wikipedia.org/wiki/Agile_software_development">common criticisms</a> include:</p> <ul> <li>Lack of structure and necessary documentation</li> <li>Only works with senior-level developers</li> <li>Incorporates insufficient software design</li> <li>Requires too much cultural change to adopt</li>...
Localizing system generated status messages <p>I am working in a .NET environment where the system occasionally generates log entries for a customer. Messages are then appended to a customer log which can be reviewed at a later time.</p> <p>For example, if a customer is subscribing to a new service, or a customer has ...
<ul> <li>Log event identifiers rather than messages.</li> <li>Capture event specific data along with the event identifier.</li> <li>When a user views the log, localize the event message based on the unique identifier.</li> </ul> <p>The problem you'll run into is if you try to insert dynamic data into the messages in a...
How do I set up MySQL to work with C#? <p>I have been tasked with creating a new frontend for a legacy website.</p> <p>It is written in php (pre-oo), and uses a MySQL database. The hosting provides a .Net package, but does not offer Ms Sql Server. </p> <p>This is fine, as the database is working fine, but I really wa...
<p>MySql does have <a href="http://dev.mysql.com/downloads/connector/net/5.2.html" rel="nofollow">connector</a> for .Net. You do not need to use ODBC,</p> <p>MySql Connector will let you interact with your MySql database and is fully managed ADO.Net provider. You have the binary (dll) or the source code if you desire....
How good is Apache POI word support? <p>On the web page, it looks like there is no current development in the old style .doc.</p> <ul> <li>Is it good enough to create complex documents? </li> <li>Can it read all .docs without crashing?</li> <li>What features do (not) work?</li> </ul> <p>I am not currently interested ...
<p>If you are looking for programmatically reading or writing doc files, I believe you're better of with remoting OpenOffice or StarOffice. We've done this at a former company, even though it's a pretty heavy solution, it worked quite well. OpenOffice has (right after Word) a very good doc-Support. For remoting it's a ...
Set Variable from an Array directly into a List of Variables in Java <p>I have a Java method which returns an array of doubles. I would then like to store these values in individual variables in the calling function. Is there an elegant way of doing this in Java.</p> <p>I could write it as this:</p> <pre><code>double...
<p>Basically no, this isn't possible.</p> <p>You'll have to return an object that contains the values.</p> <pre><code>MyObject myObject = calculateMyObject(); </code></pre>
Which is faster, Hash lookup or Binary search? <p>When given a static set of objects (static in the sense that once loaded it seldom if ever changes) into which repeated concurrent lookups are needed with optimal performance, which is better, a <code>HashMap</code> or an array with a binary search using some custom com...
<p>A binary search is going to be O(log n), whereas a hash lookup will be O(1), amortized. You would have to have a pretty terrible hash function to get worse performance than a binary search.</p> <p><strong>EDIT:</strong> When I say "terrible hash", I mean something like:</p> <pre><code>hashCode() { return 0; ...
Mixing Qt and Boost <p>I'm looking at starting a project in C++ using the Qt 4 framework (a cross-platform GUI is required). I've heard great things about the Boost libraries from friends and online. I've started reading up on both and wanted to ask a cursory question before I got too deep: Are these two development ...
<p>Yes it makes perfect sense. I would generally prefer using the boost/stdlib functions where possible rather than their Qt alternatives. </p> <p>It makes the code easier to port to the next framework.<br> It makes is easier for new non-Qt programmers to get upto speed.<br> Boost has some great functionality and is g...
Multi core programming <p>I want to get into multi core programming (not language specific) and wondered what hardware could be recommended for exploring this field. My aim is to upgrade my existing desktop.</p>
<p>If at all possible, I would suggest getting a dual-socket machine, preferably with quad-core chips. You can certainly get a single-socket machine, but dual-socket would let you start seeing some of the effects of NUMA memory that are going to be exacerbated as the core counts get higher and higher.</p> <p>Why do y...
ISO 9797-1 Algorithm 1 [CBC-MAC] in C# <p>It seems that there're 6 variations to CBC-MAC algorithm. I've been trying to match the MAC algorithm on the PINPad 1000SE [which per manual is ISO 9797-1 Algorithm 1].</p> <p>I got an excellent start from <a href="http://bytes.com/topic/net/answers/654069-iso-iec-9797-1-cbc-...
<p>Most CBC MAC algorithms are implemented in <a href="http://www.bouncycastle.org" rel="nofollow">BouncyCastle</a>'s JCE provider.</p> <p>Look at: <a href="http://bouncycastle.org/viewcvs/viewcvs.cgi/java/crypto/src/org/bouncycastle/jce/provider/BouncyCastleProvider.java?rev=1.83&amp;content-type=text/vnd.viewcvs-mar...
SQL Server 2005 -Seeing SPs executing inside SPs <p>I am wondering if it is possible to see stored procs that are being executed by other stored procs in Sql Server Profiler, is it possible, and if so how?</p>
<p>If you profile using the SP::Starting event, you can see all the stored procedures that are executed. You want to make sure to get a couple of the profile columns included:</p> <p>NestLevel - This shows the nesting level of SPs calling each other - so if Test calls EmbeddedTest then the SP::Starting event for Test ...
Unit testing with Spring Security <p>My company has been evaluating Spring MVC to determine if we should use it in one of our next projects. So far I love what I've seen, and right now I'm taking a look at the Spring Security module to determine if it's something we can/should use. </p> <p>Our security requirements ar...
<p>Just do it the usual way and then insert it using <code>SecurityContextHolder.setContext()</code> in your test class, for example:</p> <p>Controller:</p> <pre><code>Authentication a = SecurityContextHolder.getContext().getAuthentication(); </code></pre> <p>Test:</p> <pre><code>Authentication authentication = Moc...
Eclipse PDT HTML attribute assignment operator colour? <p>I would like to know how to change the colour of the equality sign and double quotes for html documents in the eclipse PDT IDE. I can change most colours in Preferences -> Web &amp; XML -> HTML Files -> syntax coloring, but can't change the characters <code>=</c...
<p>It was the only remaining element being overridden by the default <em>Foreground color</em> in the general text editors options.</p>
LinkageError: loader constraints violated when linking javax/xml/namespace/QName in Websphere6.1 using resteasy <p>I am getting this error when making a web services call. I couldn't figure out a workround for this. ANy help is greatly appreciated.</p> <p>related library I have is: axis-1.3.jar<br /> axis-jaxrpc-1.3.j...
<p>The basic problem is that you're loading one or more class files related to xml from an incorrect jar. Your application server does not permit you to change these libraries, because it has already loaded most of the parser from a different implementation. I tried to inspect the content of the jar files looking for j...
Regular Expressions in unicode strings <p>I have some unicode text that I want to clean up using regular expressions. For example I have cases where u'(2'. This exists because for formatting reasons the closing paren ends up in an adjacent html cell. My initial solution to this problem was to look ahead at the conte...
<p>Okay sorry for using this a a stream of consciousness thinking stimulator but it appears that writing out my original question got me on the path. It seems to me that this is a solution for what I am trying to do:</p> <pre><code> missingParen=re.compile(r"^\(\d$") </code></pre>
How to save objects when approval is needed to actually make changes? <p>So I have an object graph, let's just say it's an order. You have the order class, line item class, tracking number class, payment class. You get the idea.</p> <p>Now the business requirement is any user can change the order, but order changes mu...
<p>I would create a transaction table. It would have a record for each pending change. It would reference the order table.</p> <p>So an order would get created but have a pending change; a record would be inserted into the orders table, with a status column of pending, and a record would be insterted into the OrderTra...
SQL Server to Excel 2007 - New Lines <p>I'm trying to retrieve data from an SQL Server 2000 server, and place into Excel. Which sounds simple I know. I'm currently Copying, and Pasting into Excel, from Management Studio</p> <p>The problem is one of the columns is an address, and it’s not retaining the newlines. Thes...
<p>Try running this macro on the worksheet. (Right click the worksheet tab and click "View Code" to summon the VB IDE.)</p> <pre><code>Sub FixNewlines() For Each Cell In UsedRange Cell.FormulaR1C1 = Replace(Cell.FormulaR1C1, Chr(13), "") Next Cell End Sub </code></pre>
What is domain logic? <p>What is domain logic? The Wikipedia page for domain logic redirects to business logic. Are they the same thing, and, if not, how do they differ?</p>
<p>Domain is the world your application lives in. So if you are working on say a flight reservation system, the application domain would be flight reservations.</p> <p>Business Logic on the other hand is a more discrete block of the entire Application Domain. Business Logic is usually a chuck of code built to perform ...
Sending data from one page to another server. Language agnostic <p>I'll try to keep this short and simple. I haven't begun writing the code for this project yet, but I'm trying to work out the pre-coding logistics as of right now.</p> <p>What I am looking to do, is create a method of sending data from one/any site, to...
<p>Please do not create another one of those services that annoyingly double-underlines words in web site content and then pops up a ugly, slow-to-load ad over the content if I accidentally mouse over the word. Because that sounds like what you're doing.</p> <p>If you're going to do it anyway, then what the "remote se...
Correct way to handle 2D z-indexing in a 3D scene (DirectX) <p>I need to achieve the following:</p> <p>Two 2D quads appear as though they are stacked one on top of the other (like two halves of the same texture) but are in fact seperated on the z axis by n coordinates. So that if a 3D object passes between them one ha...
<p>The simple answer is yes,if you have z write turned on while rendering your quads. Your z data is never discarded unless you do it explicitly.</p> <p>Getting orthagonal depths to play nicely with projection depths may be tricky, however. (I've never tried, but I imagine it's not going to line up nicely.) In that ca...
Datamart vs. reporting Cube, what are the differences? <p>The terms are used all over the place, and I don't know of crisp definitions. I'm pretty sure I know what a data mart is. And I've created reporting cubes with tools like Business Objects and Cognos.</p> <p>I've also had folks tell me that a datamart is more ...
<p><a href="http://en.wikipedia.org/wiki/Olap_cube">Cube</a> can (and arguably should) mean something quite specific - OLAP artifacts presented through an <a href="http://en.wikipedia.org/wiki/MOLAP">OLAP server</a> such as <a href="http://msdn.microsoft.com/en-us/library/ms175609(SQL.90).aspx">MS Analysis Services</a>...
SQL Sorting and hyphens <p>Is there a way to easily sort in SQL Server 2005 while ignoring hyphens in a string field? Currently I have to do a REPLACE(fieldname,'-','') or a function to remove the hyphen in the sort clause. I was hoping there was a flag I could set at the top of the stored procedure or something.</p>...
<p>I learned something new, just like you as well</p> <p>I believe the difference is between a "<strong>String Sort</strong>" vs a "<strong>Word Sort</strong>" (ignores hyphen)</p> <p>Sample difference between WORD sort and STRING sort <a href="http://andrusdevelopment.blogspot.com/2007/10/string-sort-vs-word-sort-in...
How detect whether running under valgrind in make file or shell script? <p>I need to detect whether my Makefile is running under valgrind (indirectly, using valgrind --trace-children=yes), I know how to do it from C but I have not found a way to do it from a script,</p> <p>The earlier answers works on Linux only. For...
<p>from a shell:</p> <p><code>grep -q '/valgrind' /proc/$$/maps &amp;&amp; echo "valgrindage"</code></p> <p>This determines if the valgrind preloaded libraries are present in address map of the process. This is <em>reasonably</em> effective, but if you happen to have a non-valgrind related library that shares the '/v...
How would I get the column names from a Model LINQ? <p>I am looking to get a list of the column names returned from a Model. Anyone know how this would be done, any help would be greatly appreciated.</p> <p>Example Code:</p> <pre><code>var project = db.Projects.Single(p =&gt; p.ProjectID.Equals(Id)); </code></pre> <...
<p>This would be nice to have as an extension method:</p> <pre><code>public static class LinqExtensions { public static ReadOnlyCollection&lt;MetaDataMember&gt; ColumnNames&lt;TEntity&gt; (this DataContext source) { return source.Mapping.MappingSource.GetModel (typeof (DataContext)).GetMetaType (typeof (TEnt...
Representing sparse integer sets? <p>What is a good way to represent sparse set of integers (really C memory addresses) in a compact and fast way. I already know about the obvious things like bit-vectors and run-length encoding. but I want something much more compact than one word per set element. I need to add and rem...
<p>You are referring to a judy array. It was a HP project. I think they are used in ruby and are available in c. Very interesting data structure. Making use of the fact that allocations are (at least) word aligned, having separate structures for dense and sparse ranges.</p> <p><a href="http://judy.sourceforge.net/inde...
Excel 2002 Add-In not loading when the application opens <p>Good afternoon,</p> <p>I created an Excel .xla addin for Excel 2002. This weird behavior I am seeing from it happens only on my machine, but not on my coworkers. I would like to understand why.</p> <p>The add-in has a UDF function that gets called from man...
<p>Eventually I figured out that all the problematic spreadsheets had RTD/DDE links in them, and it turns out that the data source process is never really running on my machine. As soon as I went to Edit-Links and removed those links everything worked fine.</p>
Get selected text and selected nodes on a page? <p>When selecting a block of text (possibly spanning across many DOM nodes), is it possible to extract the selected text and nodes using Javascript?</p> <p>Imagine this HTML code:</p> <pre><code>&lt;h1&gt;Hello World&lt;/h1&gt;&lt;p&gt;Hi &lt;b&gt;there!&lt;/b&gt;&lt;/p...
<p>You are in for a bumpy ride, but this is quite possible. The main problem is that IE and W3C expose completely different interfaces to selections so if you want cross browser functionality then you basically have to write the whole thing twice. Also, some basic functionality is missing from both interfaces.</p> <p>...
HowTo Multicast a Stream Captured with DirectShow? <p>I have a requirement to build a very simple streaming server. It needs to be able to capture video from a device and then stream that video via multicast to several clients on a LAN. </p> <p>The capture part of this is pretty easy (in C#) thanks to a library someon...
<p>There are no filters available that you can plug and use.</p> <p>You need to do three things here:</p> <ol> <li>Compress the video into MPEG2 or MPEG4</li> <li>Mux it into MPEG Transport Stream</li> <li>Broadcast it</li> </ol> <p>There are lots of codecs available for part 1, and some devices can even output comp...
SSE4 instructions in VS2005? <p>I need to use the popcnt instruction in a project that is compiled using Visual Stdio 2005<br /> The intrinsic <code>__popcnt()</code> only works with VS2008 and the compiler doesn't seem to recognize the instruction even when I write in a <code>__asm {}</code> block.</p> <p>Is there an...
<p>Okay, this is a wild guess thing but ... assuming you've set up VS2005 like <a href="http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/3e24f203-c516-41e2-a7bf-325452157336/" rel="nofollow">this</a> to do assembly language, then you could get a hold of the <a href="http://www.developers.net/filestore2/do...
Increase number of characters in filename field of GetOpenFileName file selection dialog <p>Our app allows multiple files to be selected in a file selection dialog which is shown via the GetOpenFileName function (this question also applies to folks using CFileDialog, etc...)</p> <p>There appears to be a limit to the n...
<p>Turns out that the edit control (At least in my development environment) is a combo box, so <code>EM_SETLIMITTEXT</code> isn't appropriate. </p> <p>Instead, I tracked down the combo box using <code>GetDlgCtrl</code> on the parent of the file open dialog (I do this in the <code>OnInitDialog</code> handler), cast it ...
Can I hide a directory/path from Launch Services? <p>I would like to be able to build test applications (e.g. the nightly Minefield/Firefox) without Launch Services deciding that they're the best way to open their assigned file types.</p> <p>Is there a way to hide my ~/src directory from Launch Services, so that Finde...
<p>I don't know of a way to do that hiding, but you <em>can</em> change the bundle ID of your development apps so that they don't get treated as the preferred app for that content type/URI scheme by LaunchServices.</p>
Silverlight 2 Error Code: 4004 <p>Hey guys/gals. I have a silverlight 2 app that has an ObservableCollection of a class from a separate assem/lib. When I set my ListBox.ItemsSource on that collection, and run it, I get the error code: 4004 "System.ArgumentException: Value does not fall within the expected range." Here ...
<p>Are you trying to use a standard class library or a "Silverlight Class Library"?</p> <p>Because Silverlight 2 uses a subset of the CLR it cannot access standard class libraries that were compiled using the full CLR. To use an external assembly you must create it as a "Silverlight Class Library". This will create ...
initializing std::string from char* without copy <p>I have a situation where I need to process large (many GB's) amounts of data as such:</p> <ol> <li>build a large string by appending many smaller (C char*) strings</li> <li>trim the string</li> <li>convert the string into a C++ const std::string for processing (read ...
<p>You can't actually form a std::string without copying the data. A stringstream would probably reuse the memory from pass to pass (though I think the standard is silent on whether it actually has to), but it still wouldn't avoid the copying.</p> <p>A common approach to this sort of problem is to write the code which...
Reading an XML File using FileInputStream (for Java)? <p>here's the deal.</p> <p>For my project I have to serialize and deserialize a random tree using Java and XStream. My teacher made the Tree/RandomTree algorithms, so I don't have to worry about that. What I don't know how to do is this: I am using FileInputStre...
<p>The <code>xstream.fromXML()</code> method will do the reading from the input stream for you. I think the problem is that you are casting the return value from <code>xstream.fromXML(fin)</code> into a String when it should be cast to the type of object you originally serialized (<code>RandomTree</code> I assume). S...
ASP.NET MVC vs WebForms for First Page Load Speed for Big Projects <p>We have a pretty big ASP.NET WebForm (web application) project with a lot of references to other libraries, other projects etc and most of the time after a compilation, the first time we load a page it takes a LONG time before rendering anything... ...
<p>MVC still uses the same ASP.NET framework as Web Forms, so you are probably going to see similar behavior, regardless. </p> <p>The long first load time is because your project's build output is still just IL code that needs to be compiled into native code by the JIT compiler before executing. Any code changes that ...
VS2008 binary 3x times slower than VS2005? <p>I've just upgraded a native C++ project from VS2005-SP1 to VS2008-SP1<br /> The first thing I tested was a very basic functionality test of the application and the first thing I noticed is that the main number-crunching algorithm performs three times slower in the VS2008 bi...
<p>Strangest. Thing. Ever. </p> <p>It seems that the project upgrade wizard of vs2008 simply doesn't copy the '<code>Optimization="2"</code>' property so the new project is left with no optimization in release. </p> <p>The fix was to go to the properties dialog, change optimization to 1 and then back to 2. compile ...
Get last MySQL binary log entry <p>I'm using MySQL replication, and I'd like a status script running on the slave to report the last statement that was replicated over to the slave.</p> <p>I can use "SHOW SLAVE STATUS" to get the current read and execute positions. But how do I use that information with mysqlbinlog t...
<p>Are you after the last statement that was sent to the slave, or the last statement that was executed on the slave? You mention that you're assuming the slave is caught up with the master, in which case you simply need to read the last statement in the relay log instead, with the information available in SHOW SLAVE S...
Drupal 6 : CCK : Views2 : What ways would you substitute an image for a view-field <p><strong>Background:</strong> Customer X has a CCK-based Content Type (vendorxxentry) and is using Views2 to generate a listing of all the vendorxxentry nodes in a simple table. </p> <p>One of the fields in vendorxxentry is called "ve...
<p>You can change the 'mood' from a simple data field to a taxonomy vocabulary, with each mood being a term in the vocabulary. Then use <a href="http://drupal.org/project/taxonomy_image" rel="nofollow">Taxonomy Image</a> module to substitute an image for each mood in any way you like.</p>
Recovering from an unfortunate "svn copy" <p>This afternoon, upon noticing a broken build and the fact that some files looked like very old versions (about 2 weeks old), I checked the svn log. Apparently just this afternoon, 1 of the developers did an "svn copy" of a directory from an older revision to the same direct...
<p>According to <a href="http://svnbook.red-bean.com/" rel="nofollow">the SVN book</a>,</p> <pre><code>svn merge -c -1234 </code></pre> <p>should do the trick.</p> <p>There's a whole <a href="http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo" rel="nofollow">sectio...
Is a keyframed transition possible in Core Animation? <p>I know that keyframed transitions are possible in Core Animation via setting the <code>path</code> property on the <code>CAAnimation</code> instance. However, <code>CATransition</code> does not seem to have this functionality. Does anyone know any other ways to c...
<p>The answer seems to be no. If you want to do this sort of thing, you have to add the CAAnimation yourself rather than depending on transitions. The transitions probably depend on some deep workings of CoreAnimation, because they don't work the same way normal animations do (they don't move the object in question, th...
Is there any native way in ASP.NET to do a "success message"? <p>Say you have something like an ASP.NET ASP:DetailsView to show and edit a single record in a database.</p> <p>It's simple to record the error cases... you add validation and a validation summary. When your update form fails validation it naturally makes...
<p>As far as I know, there is no native way of doing this. You may rant about it, maybe Microsoft will hear it :).</p> <p>Resetting the "success message" on Page_Load, or wherever in your code-behind, won't work. This is because ASP.NET validation is usually done both client and server-side. This means for every valid...
How do sites like Hubspot track inbound links? <p>Are all these types of sites just illegally scraping Google or another search engine?<br /> As far as I can tell ther is no 'legal' way to get this data for a commercial site.. The Yahoo! api ( <a href="http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html" ...
<p>For example, if you wanted to find all the links to Google's homepage, search for</p> <pre><code>link:http://www.google.com </code></pre> <p>So if you want to find all the inbound links, you can simply traverse your website's tree, and for each item it finds, build a URL. Then query Google for:</p> <pre><code>lin...
How can I extract or change links in HTML with Perl? <p>I have this input text:</p> <pre><code>&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt;&lt;/head&gt;&lt;body&gt;&lt;table cellspacing="0" cellpadding="0" border="0" align="center" width="603"&gt; &lt;tbody&gt;&lt...
<p>There are excellent HTML parsers for Perl, learn to use them and stick with that. HTML is complex, allows > in attributes, heavily use nesting, etc. Using regexes to parse it, beyond very simple tasks (or machine generated code), is prone to problems.</p>
FontFamily question <p>Why the FontFamily param of the Font object is a string and not an enum?</p>
<p>FontFamily refers to the name of the Font. While you could use "monospace" or "serif" I wouldn't think it would be supported by .Net.</p> <p>Remember, using a enum would be impossible. A enum is a static compile-time feature, which means that it can't "generate" a enum dynamically from fonts on your system. Indeed,...
Literature and tutorials for writing a ray tracer <p>I am interested in finding recommendations on books on writing a raytracer, simple and clear implementations of ray tracing that can be seen on the web, and online resources on introductory ray tracing.</p> <p>Ideally, the approach would be incremental and tutorial ...
<p>"Ray Tracing from the Ground Up" by Kevin Suffern for getting started.</p> <p>"Physically Based Rendering" by Matt Pharr and Greg Humphreys for a more advanced take on it when you've gotten comfortable with the basics.</p> <p>And if you get really into it, the <a href="http://tog.acm.org/resources/RTNews/html/" re...
How to read list of string <p>I have this:</p> <p>Public stringList As New List(Of String)</p> <p>I need to read the whole list using For each statement, what is the best way to do so using VB.net syntax?</p> <p>Thanks,</p>
<p>It sounds like it would be worth you reading <a href="http://msdn.microsoft.com/en-us/library/5ebk1751.aspx" rel="nofollow">the MSDN documentation for the For Each ... Next statement</a>.</p> <p>For example:</p> <pre><code>For Each x As String In stringList Console.WriteLine(x) Next </code></pre> <p>If that's...
Thread safety and `const` <p>How does <code>const</code> (pointers, references and member functions) help with thread safety in C++?</p>
<p>Any immutable (that is, unchangable) data is inherently thread safe - there's no risk for multiple threads concurrently reading the same read-only data because it's never going to change!</p> <p>Marking a variable as const in C++ makes it read-only and thus thread safe.</p>
How to abstract out 2 different implementations of cache <p>I plan to use a distributed cache in my load-balanced webapp. So I'm going to try to abstract out the common functions between apache ehcache and memcached.</p> <p>My goal is to be able to make a simple configuration switch to select the caching solution to u...
<p>After fixing the interface, this is really a creational pattern problem. Dependency Injection is my favourite, if the cache-selection strategy is dynamic you can use spring bean factories to decide at runtime. Spring has support for "session" scopes on web-applications meaning you can let the factory decide per sess...
UITextField input issue <p>In my application there have two Outlet, one is UItextfield and another is UIWebview, textfield used to get the url request by the user and shown it in webview, but I met a problem is when finish the typing in my textfield, and click GO button(return) in the keyboard, that is nothing happen i...
<p>Have you set the delegate of the textfield to be the class with the textFieldShouldReturn: method?</p>
Image resize in Grails <p>I am developing a Web Album using Grails and for image processing, I am using grails-image-tools plugin. I need a functionality to resize the images if the uploaded images size is too big (for eg: more than 600 * 840 ) . In this case I need to resize this image to 600 * 840). What is the most ...
<p>In <code>BuildConfig.groovy</code> add a dependency to <a href="http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/">imgscalr</a></p> <pre><code>dependencies { compile 'org.imgscalr:imgscalr-lib:4.1' } </code></pre> <p>Then resizing images becomes a one-liner:</p> <pre><code>Buffere...
What is the best practice for persistence right now? <p>I come from a java background.</p> <p>But I would like a cross-platform perspective on what is considered best practice for persisting objects.</p> <p>The way I see it, there are 3 camps:</p> <ul> <li>ORM camp</li> <li>direct query camp e.g. JDBC/DAO, iBatis</l...
<p>There is no one best practice for persistence (although the number of people screaming that ORM is best practice might lead you to believe otherwise). The only best practice is to use the method that is most appropriate for your team and your project.</p> <p>We use ADO.NET and stored procedures for data access (tho...
Updating from Java 1.4.2 to Java 6 (both Sun VMs) results in slower performance <p>I've just upgraded some old Java source which has been running on a Sun Java 1.4.2 VM to Sun Java (JRE) 6 VM. More or less the only thing I had to change was to add explicit datatypes for some abstract objects (Hashmap's, Vector's and so...
<p>Not much information here. But here are a couple of things you might want to explore:</p> <ul> <li><p>Start the VM with Xmx and Xms as the same value (in your case 1024M)</p></li> <li><p>Ensure that the server jvm dll is being used to start the virtual machine.</p></li> <li><p>Run a profiler to see what objects are...
How do I detect the DLLs required by an application? <p>In a nutshell: I want to do the same thing "Dependency Walker" does.</p> <p>Is there any Win32 API function which can enumerate the dependencies of a EXE and/or DLL file?</p> <p>And is there any safe way to detect dependencies on ActiveX classes? (I doubt it is ...
<p>The following commands dumps the direct dependencies of some.exe :</p> <pre><code>dumpbin /imports some.exe </code></pre> <p>It works on DLLs too.</p> <p>This won't list dependencies such as plugins loaded at application launch (via LoadLibrary calls). Same for COM dependencies since they work the same way (as fa...
Carbide / Symbian C++ - Change Application Icon <p>I am using Carbide (just upgraded to 2.0) to develop an S60 3rd Edition application.</p> <p>I would like to know the easiest way to change the icon (both the application icon on the device menu <strong>and</strong> the icon at the top left of the main view) because I ...
<p>To change the app icon when you run your app use (in the status bar):</p> <pre><code>CEikStatusPane* sp=iEikonEnv-&gt;AppUiFactory()-&gt;StatusPane(); CAknContextPane* cp=(CAknContextPane *)sp-&gt;ControlL(TUid::Uid(EEikStatusPaneUidContext)); _LIT(KContextBitMapFile, "my_bitmap_file.mbm"); CFbsBitmap* bitmap = iEi...
How can I get an ListView item from the (X,Y) position? <p>I am dropping something in a ListView in WPF. I need to know the item in the (X,Y) position I am dropping. How can I do this?</p> <hr> <p>The WPF ListView doesn't have GetItemAt. I return to my original problem.</p>
<p>Done! Thanks to this article <a href="http://www.codeproject.com/KB/WPF/WPF_Drag_And_Drop_Sample.aspx">http://www.codeproject.com/KB/WPF/WPF_Drag_And_Drop_Sample.aspx</a></p> <pre><code>private int GetCurrentIndex(GetPositionDelegate getPosition) { int index = -1; for (int i = 0; i &lt; clasesListView.Item...
Are iframes considered 'bad practice'? <p>Somewhere along the line I picked up the notion that using iframes is 'bad practice'. </p> <p>Is this true? What are the pros/cons of using them?</p>
<p>As with all technologies, it has its ups and downs. If you are using an iframe to get around a properly developed site, then of course it is bad practice. However sometimes an iframe is acceptable. </p> <p>One of the main problems with an iframe has to do with bookmarks and navigation. If you are using it to simply...
Java memory model - can someone explain it? <p>For years and years, I've tried to understand the <a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4">part</a> of Java specification that deals with memory model and concurrency. I have to admit that I've failed miserably. Yes' I understand abo...
<p>I'm not going to attempt to actually answer your questions here - instead I'll redirect you to the book which I seeing recommended for advice on this topic: <a href="http://rads.stackoverflow.com/amzn/click/0321349601">Java Concurrency in Practice</a>.</p> <p>One word of warning: if there <em>are</em> answers here,...
How do realloc and memcpy work? <p>Dear all, Here are my questions...</p> <p>1- Do realloc and memcpy copy the entries in an array to another in a way faster than just iterating on each element O(N) ? If the answer is yes then what do you think is its complexity ?</p> <p>2- If the size allocated is smaller than the o...
<p>1 - No. They copy a block at a time. See <a href="http://www.embedded.com/design/configurable-systems/4024961/Optimizing-Memcpy-improves-speed" rel="nofollow">http://www.embedded.com/design/configurable-systems/4024961/Optimizing-Memcpy-improves-speed</a> for a pretty good analysis.</p> <p>2 - This is implementatio...
Should an interface that is inherited from base-class be implemented explicitly in subclass? <p>My question is, if an interface that is implemented implicitly by extending a class that already implements it, should be explicitly implemented by the class, if the class wants to advertise the fact, that it fulfills the co...
<p>Avoid redundancy. Use method 2.</p> <p>Use @Override for overrides.</p>
What is the best way to determine application root directory? <p>I need to get all dlls in my application root directory. What is the best way to do that?</p> <pre><code>string root = Application.StartupPath; </code></pre> <p>Or,</p> <pre><code>string root = new FileInfo(Assembly.GetExecutingAssembly().Location).Ful...
<p><code>AppDomain.CurrentDomain.BaseDirectory</code> is my go to way of doing so.</p> <p>However:</p> <p><code>Application.StartupPath</code> gets the directory of your executable</p> <p><code>AppDomain.BaseDirectory</code> gets the directory used to resolve assemblies</p> <p>Since they can be different, perhaps y...
MFC AfxParseURL reverse function? <p>Is there reverse function to MFC AfxParseURL (which creates URL from service type, port and so on)?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/cs1z60t6.aspx" rel="nofollow">AfxParseURL</a> is a wrapper around the <a href="http://msdn.microsoft.com/en-us/library/aa384376.aspx" rel="nofollow">InternetCrackUrl </a> function in <code>&lt;wininet.h&gt;</code>. The reverse function is <a href="http://msdn.microsof...
circular dependencies between dlls with visual studio <p>I have a circular dependency between two functions. I would like each of these functions to reside in its own dll. Is it possible to build this with visual studio?</p> <pre><code>foo(int i) { if (i &gt; 0) bar(i -i); } </code></pre> <p>-> should compil...
<p>The reason it works on Unix-like systems is because they perform actual linking resolution at load time. A shared library does not know where its function definition will come from until it's loaded into a process. The downside of this is that you don't know either. A library can find and call functions in any other...
How long before the line of business app in F# becomes the norm? <p>With the recent news about F# being included with Visual Studio 2010, I got to thinking ... how soon before I see functional programming take hold in the usual "line of business app" space?</p>
<p>I would add the subjective tag to that one ;)</p> <p>Personally, I don't think it will become the norm although it will be used in areas where it is well suited.</p> <p>I don't think it will become the norm because it is best suited to certain layers of the application, but isn't well suited to other layers like U...
jRails vs. Prototype <p>I am not trying to make this a preference question, I am really wondering what people's experiences are with using jQuery and Rails or jRails for development. Most rails users including myself up to now have been using Prototype. However, I am mixing in a lot of jQuery plugins since they are s...
<p>In Rails it really all comes down to the helper methods. Are you using any prototype helper methods? If so then you must use jRails to switch to jQuery. But if not then it really does not matter. They are both great. I used prototype a lot before and it is great. But I prefer the selector way of doing things with jQ...
In WPF, how can I determine what column/row in a grid a control is in? <p>I am building a grid dynamically and putting buttons in one of the columns. When I click a button, I want to know what row of my grid it's in. How can I find this?</p>
<p>In the Click event handler for the button you say:</p> <pre><code>int row; Button btn = sender as Button; if (btn != null) { row = Grid.GetRow(btn); // And you have the row number... } else { // A nasty error occurred... } </code></pre>
How do I set the ideal QPixmapCache::cacheLimit? <p>I have just started using QPixmapCache and I was wondering, since there is not much documentation, about how to adjust the size based on the system the application is running on.</p> <p>Some users might have lots of free memory while others have very little. I have ...
<p>To detect free RAM in Windows, you can use the <a href="http://msdn.microsoft.com/en-us/library/aa366586.aspx" rel="nofollow">GlobalMemoryStatus</a> function.</p> <p>I'm not sure if this will help you size the pixmap cache; perhaps you will need to do some performance measurements and create a lookup table.</p>
How to avoid XML injection <p>I have input field value from that is used for forming XPath query. What symbols in input string should I check to minimise possibility of XML injection?</p>
<p>This <a href="http://packetstormsecurity.org/papers/bypass/Blind_XPath_Injection_20040518.pdf" rel="nofollow"><strong>document</strong></a> describes in detail the concept of "Blind XPath Injection".</p> <p>It provides concrete examples of XPath injections and discusses ways of preventing such.</p> <p>In the secti...
Is it possible to sort numbers in a QTreeWidget column? <p>I have a QTreeWidget with a column filled with some numbers, how can I sort them?</p> <p>If I use setSortingEnabled(true); I can sort correctly only strings, so my column is sorted:</p> <p>1 10 100 2 20 200</p> <p>but this is not the thing I w...
<p>You can sort overriding the &lt; operator and changing sort condiction like this.</p> <pre><code>class TreeWidgetItem : public QTreeWidgetItem { public: TreeWidgetItem(QTreeWidget* parent):QTreeWidgetItem(parent){} private: bool operator&lt;(const QTreeWidgetItem &amp;other)const { int column = treeWid...
Bind an ObjectDataSource to an existing method in my Data access layer <p>I've seen the designer code, and I have seen code which builds the ObjectDataSource in the code-behind, however both methods communicate directly with the database via either text commands or stored procs. This seems like unnecessary code duplica...
<p>In order to use a standard .Net DataSet as an DataSource for a Reporting Services Report I had to:</p> <ol> <li><p>Create an ADO DataSet which uses the same stored procedure as the DAL method</p></li> <li><p>Use the ADO DataSet to populate the fields in the Report in the designer</p></li> <li><p>In the aspx page, u...
Browsing for SQL Servers <p>I'm writing a database application that connects to SQL server. I'd like to implement a similar connection dialog box like the one in SQL Management Studio. I've already found a way to get the list of databases on a server, but I'd really like to get the list of available servers on the netw...
<p>If you are developing your program in .Net you can use the SMO objects to do this. Use the Microsoft.SqlServer.Management.Smo.SmoApplication.EnumAvailableSqlServers method to get a list of all sql servers running in your local network.<br /> The scanning taKes a few seconds, but its not very slow.</p>
Visual Studio Web Design <p>I'm using visual studio 2005 and have been building asp.net applications. Mostly just departmental level apps for reporting and data maintenance. They work and they look ok but they don't look great. I don't have any other tools like Dreamweaver or Expression. Can anyone name any books ...
<p>Honestly, the IDE does a fairly good job at design work. We are transitioning our designers from Dreamweaver to Visual Studio 2008, and they definitely like the tools.</p> <p>Don't take this the wrong way, but some people just can't make a page look good, no matter what tool it is. I am one of those people. I ca...
How can I make a Table of Contents frame in XSL? <p>I have an XML file that I am creating an XSL stylesheet for.</p> <p>What I would like is to have two frames and do two passes on the data, the first would create a Table of Contents in the left frame, and the second would have the body of data in the right.</p> <p>I...
<p>If you want to use frames you need three separate files.</p> <ol> <li>The frame file. This is just a strict HTML file</li> <li>A file for your table of contents</li> <li>A file for your content</li> </ol> <p>The first one is as specified just an HTML file. The second two are XSL files that will eventually turn int...
How To Update Data With Linq By Attach Method <p>I have a update method in my data layer such this:</p> <pre><code>public clacc datalayerSec_User private objUIData as new UIData Public Function Update(ByVal objUser As SEC_USER) As Boolean Try objUIData.SEC_USERs.Attach(objUser) objUIData.Refresh(RefreshMode....
<p>The easiest way to get around this issue is to use the same DataContext when retrieving the user object and updating.</p> <p>In general, a DataContext should be kept alive for a "unit of work", in other words, you use it to retrieve whatever object you want to change, then change its properties, and then just do Su...
Good way to stretch object over multiple classes <p>I have a collection of orders. I would like to hit the database once, retrieve the orders, store them and then be able to access this collection over multiple forms. I know in asp.net, you can use things like Application Object or Session Object but how do you do it i...
<p>The fundamental difference in WebForms &amp; WinForms is that WinForms are stateful. In other words, you can ensure the objects you load once are available till the program is shutdown. The same is not true for WebForms as HTTP is stateless and ASP.Net weaves lots of "magic" [ViewState, Server session, Cookies, Hid...
StringBuilder for string concatenation throws OutOfMemoryException <p>We mostly tend to following the above best practice.</p> <p>Have a look at <a href="http://stackoverflow.com/questions/73883/string-vs-stringbuilder">String vs StringBuilder</a></p> <p>But StringBuilder could throw <strong>OutOfMemoryException even...
<p>The underyling string you create will also need a contiguous block of memory because it is represented as an array of chars (arrays require contiguous memory) . If the StringBuilder throws an OOM exception you woludn't be able to build the underlying without it.</p> <p>If creating a string causes an OOM, there is ...