input
stringlengths
51
42.3k
output
stringlengths
18
55k
Moving items in Dual Listboxes <p>How can I move items from one list box control to another listbox control using JavaScript in ASP.NET?</p>
<p>If you're happy to use jQuery, it's very, very simple.</p> <pre><code>$('#firstSelect option:selected').appendTo('#secondSelect'); </code></pre> <p>Where #firstSelect is the ID of the select box.</p> <p>I've included a working example here:</p> <p><a href="http://jsbin.com/aluzu">http://jsbin.com/aluzu</a> (to e...
How to update a text or ntext field in SQL Server 2000 <p>So I need to update a text field. Neither the UPDATE statement or the WRITETEXT statement work when used below</p> <pre><code>CREATE TABLE MyTable (IDField int, MyField text) INSERT INTO MyTable (IDField) SELECT 1 DECLARE @Data1 varchar(8000), @Data2 varchar(...
<p>Try using UPDATETEXT instead</p> <pre><code>WRITETEXT MyTable.MyField @ptrval @Data1 UPDATETEXT MyTable.MyField @ptrval 8000 NULL @Data2 </code></pre> <p>The insert offset is zero based so 8000 should write into the 8001st character. The delete offset is null as a value of NULL deletes all data from the insert_of...
Spreadsheet-like control for a web application? <p>A client of mine is looking to convert a critical 'application' based on multiple (very complex) spreadsheets into a web app. As part of this they'd like some of the web pages they use to enter/model data to resemble a spreadsheet as much as possible.</p> <p>I'd be i...
<p>I'd say this comes down to data grids.</p> <p>For Javascript frameworks: Jquery has 'plugins' like <a href="http://trirand.com/jqgrid/jqgrid.html" rel="nofollow">this</a>. Serverside: Telerik has asp.net controls like <a href="http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Overview/DefaultCS.aspx" rel="no...
Initialising a struct variable to Nullable<int> <p>Is there a way to declare a variable as Nullable in c#?</p> <pre><code>struct MyStruct { int _yer, _ner; public MyStruct() { _yer = Nullable&lt;int&gt;; //This does not work. _ner = 0; } } </code></pre>
<p>_yer must be declare as int? or Nullable&lt;int&gt;.</p> <pre><code> int? _yer; int _ner; public MyStruct(int? ver, int ner) { _yer = ver; _ner = ner; } } </code></pre> <p>Or like this:</p> <pre><code> Nullable&lt;int&gt; _yer; int _ner; public MyStruct(Nullable&lt;int...
What's the term for design ala "object.method1().method2().method3()"? <p>What's the term for this design?</p> <pre><code>object.method1().method2().method3() </code></pre> <p>..when all methods return *this?</p> <p>I found the term for this a while ago, but lost it meanwhile. I have no clue how to search for this o...
<p>Looks to me like you are describing a fluent interface. Ive also heard it referred to as pipelineing or chaining.</p> <p>Update-Gishu: <a href="http://martinfowler.com/bliki/FluentInterface.html">http://martinfowler.com/bliki/FluentInterface.html</a> </p>
Directory of APIs/WebServices - where do I find one? <p>Where do I find a directory where a lot of APIs or Webservices are collected? I'd like to generate a Web Site getting its content from different services, but I assume that spidering together the content is not legal (e.g. getting the latest financial data from fi...
<p>I'd suggest a visit to <a href="http://www.programmableweb.com/" rel="nofollow">ProgrammableWeb</a>, especially its <a href="http://www.programmableweb.com/apis/directory" rel="nofollow">API Directory</a>.</p>
Encrypt on iSeries <p>What tools are available to encrypt or password-protect a file stored on the IFS?</p> <p>*integrated file-system, accessible from Windows</p>
<ol> <li>You could setup object security so only certain users can view the file.</li> <li>There are encryption tools available for purchase. There is also some built-in APIs for encrypting. </li> </ol> <p>Here are some resources to look into:</p> <ol> <li><a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r...
Version control "in the clouds" <p>I'm a developer who works on both individual and group projects using Microsoft Visual Studio. I could setup one of several different source control packages, such as VSS, SourceGear Vault or SVN on a server of my own and access them remotely; however, I don't want to deal with the h...
<p>For Git, check out <a href="http://github.com">GitHub</a>. Good packages, used by an awful lot of opensource projects. Considered to be one of the best hosting experiences for git.</p>
Any experience with the Deliverance system? <p>My new boss went to a speech where Deliverance, a kind of proxy allowing to add skin to any html output on the fly, was presented. He decided to use it right after that, no matter how young it is.</p> <p>More here :</p> <p><a href="http://www.openplans.org/projects/deliv...
<p>Having used Plone professionally for the last 4 years or so, and Deliverance on 4 commercial sites, I would advise all new front end developers (and old hands alike) to use Deliverance to theme Plone sites.</p> <p>It is <em>much</em> easier to learn (a couple of weeks Vs couple of months) and potentially much more ...
Deploy time Webservice location <p>In my Visual Studio Web application project I am adding a reference to a web service. When I add a web reference the following list of files gets generated. </p> <ul> <li>Reference.map</li> <li>Reference.vb</li> <li>Reference.disco</li> <li>Reference.wsdl</li> </ul> <p>All these fil...
<p>Set the web service reference "Url Behaviour" property to Dynamic, and the address will be cofigured in your app.config file....</p> <p>The app.config file should then contain something like </p> <pre><code> &lt;applicationSettings&gt; &lt;Exceptions.Properties.Settings&gt; &lt;setting name=...
Does anybody familiar with big projects that was build with linqtoSql ORM? <p>does it cost cost effective ? how can i profile the Sql calls to the server?</p>
<p>I don't know what is big for you, but you are using a project running on LINQ to SQL right now, that's Stackoverflow.</p> <p>Also you would find interesting looking at <a href="http://www.codeproject.com/KB/linq/performance_comparisons.aspx" rel="nofollow">this</a> performance benchmarks. <a href="http://jdconley.c...
Best way for retrieving single record results in LINQ to SQL <p>If I query a table with a condition on the key field as in:</p> <pre><code> var user = from u in dc.Users where u.UserName == usn select u; </code></pre> <p>I know that I will either get zero results or one re...
<p>Try something like this:</p> <pre><code>var user = (from u in dc.Users where u.UserName == usn select u).FirstOrDefault(); </code></pre> <p>The <a href="http://msdn.microsoft.com/en-us/library/bb549141.aspx">FirstOrDefault</a> method returns the first element of a sequence tha...
Are threads reused between requests in ASP.Net? <p>I'm just wondering if the same thread is used for each session, or if its dangerous to count on a particular thread between requests. What I'm getting at, is can I use thread static storage?</p>
<p>The short answer is yes. The thread used for a request is returned to the thread pool and can be used to service other requests. They are NOT session specific, and to answer your second question, you should never count on a particular thread being available for subsequent requests on a particular session. Because of...
Best Server-side .NET PDF editing library <p>What's the best .NET PDF editing library available, and why?</p> <p>It needs to be used on an IIS web-server. Specifically, I need to edit a PDF which was generated by reporting services.</p> <p>Factors I'm interested in:</p> <ol> <li>Speed</li> <li>Memory Consumption</li...
<p>Have a look at <a href="http://itextsharp.sourceforge.net/">iTextSharp</a>. iTextSharp is a port of the <a href="http://www.lowagie.com/iText/">iText</a> , a free Java-Pdf library.</p> <p>To quote iText:</p> <p>You can use iText to:</p> <ul> <li>Serve PDF to a browser</li> <li>Generate dynamic documents from XML ...
Tool for parsing smtp logs that finds bounces <p>Our web application sends e-mails. We have lots of users, and we get lots of bounces. For example, user changes company and his company e-mail is no longer valid.</p> <p>To find bounces, I parse smtp log file with log parser.</p> <p>Some bounces are great, like <code>5...
<p>This <a href="http://scriptolog.blogspot.com/2007/08/smtp-log-parsing.html">article</a> is exactly what you are looking for. It is based on the great tool <a href="http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx">log parser</a>.</p> <blockquote> <p>Log parser is a powerful, versatile ...
Krypton Form not showing up in Visual Studio Professional 2008 <p>I have just installed the Krypton Toolkit 3.0.6 from component Factory. I find that in the create new Project Dialog Box , Krypton Form does not show up as an option. I am sure it used to show up ( and I have actually used it in an earlier version of kry...
<p>Thanks Judah,</p> <p>For the sake of completeness and accuracy , I am posting the actual code for inheriting from a krypton form.</p> <pre><code>public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm </code></pre>
How do I split a string on a fixed character sequence? <p>Suppose I have following string:</p> <pre><code>String asd = "this is test ass this is test" </code></pre> <p>and I want to split the string using "ass" character sequence.</p> <p>I used:</p> <pre><code>asd.split("ass"); </code></pre> <p>It doesn't work. Wh...
<p>It seems to work fine for me:</p> <pre><code>public class Test { public static void main(String[] args) { String asd = "this is test ass this is test"; String[] bits = asd.split("ass"); for (String bit : bits) { System.out.println("'" + bit + "'"); } } } </code></...
How do I display a dataset or group as a comma delimited list in SSRS? <p>In my SQL database, I have a one-to-many relationship, something like this:</p> <pre> Teacher Student John Alex John Mike John Sean Bob Jack Gary George Gary Paul </pre> <p>I'd like to display a table listing each teac...
<p>I've found a simpler, straight-forward method to do this -- add an expression as follows:</p> <pre><code>=Join(LookUpSet(Fields!TeacherName.Value, Fields!TeacherName.Value, Fields!StudentName.Value, "YourTeacherDataSet"), ",") </code></pre>
What's the deal with all the different UIDs a process can have? <p>Real UID, effective UID, and some systems even have a "saved UID". What's the purpose of all these, especially the last one?</p>
<p>Each UNIX process has 3 UIDs associated to it. Superuser privilege is UID=0.</p> <p><strong>Real UID</strong></p> <p>This is the UID of the user/process that created THIS process. It can be changed only if the running process has EUID=0.</p> <p><strong>Effective UID</strong></p> <p>This UID is used to evaluate p...
Master page from external library <p>I want to put my master pages in a central library so I can use them in several projects without having the maintanance nightmare. Everything is refactored in a generic and central way, they are all in a "shared" namespace. But if put them in a seperate project, I can't reference th...
<p>I don't believe you can put that actual .master pages in an external library. You can place your own customer MasterPage-derived class in the library, and have your client apps derive from that, but I don't think that's what your intent is, since you're tagged with asp.net-mvc (implying very narrow views without muc...
ASP.NET trusted DB connection to other server works in Casini, not in IIS <p>Our website connects to a database correctly when running the website locally using the built-in web server. But, when we deploy the site to our server running IIS, we get a database connection error. The database server is different from ou...
<p>When you're running a web site using Cassini, the account used by the web server process is your own account that you use to log on to your Windows machine. That account will be different on IIS.</p> <p>Consider the security implications of opening the database up to a broader access than you may need with trusted ...
What can cause intermittent ORA-12519 (TNS: no appropriate handler found) errors <p>We are running our Junit 4 test suite against Weblogic 9 in front of an Oracle 10 database (using Hudson as a continuous integration server) and occasionally we will get an ORA-12519 crash during script teardown. However, the error is ...
<p>Don't know if this will be everybody's answer, but after some digging, here's what we came up with.</p> <p>The error is obviously caused by the fact that the listener was not accepting connections, but why would we get that error when other tests could connect fine (we could also connect no problem through sqlplus)...
How to print a PDF from the browser <p>In a Web application, is it possible to force a PDF file to be printed on the client? If the browser is configured to open the PDF inside the window, I guess that calling window.print() will work, but some browsers (like mine) are configured to open the PDF externally.</p>
<p>The way google docs does it is by embedding JavaScript into the PDF that tells Acrobat Reader or any other compliant reader to print it.</p> <p>You would need a PDF toolkit to do this with a random PDF.</p>
Select from same table as an Insert or Update <p>Clearly the following is incorrect.</p> <pre><code>INSERT INTO `aTable` (`A`,`B`) VALUES((SELECT MAX(`A`) FROM `aTable`)*2),'name'); </code></pre> <p>I get the value:</p> <p>SQL query: </p> <pre><code>INSERT INTO `aTable` (`A`, `B` ) VALUES ( ( SELECT MAX(`A`) ...
<p>try:</p> <pre><code>insert into aTable select max(a)^2, 'name' from aTable; </code></pre> <p>or</p> <pre><code>insert into aTable select max(a)^2, 'name' from aTable group by B; </code></pre> <p>If you need a join, you can do this:</p> <pre><code>insert into aTable select max(a)^2, 'name' from aTable, bTable; <...
Axis2 Web Service Client Generation - Types without modifying the client <p>Is it possible with Axis2 and Eclipse to generate a Web Service client and have it use java types that you already have in packages instead of creating it's own types. Reason being of course if I have type A already created and it creates it's...
<p>If you really want to reuse existing classes, you can call the Axis2 API directly without generating a client using wsdl2java. Below is some relatively simple code to call a web service. You just need to fill in the web service endpoint, method QName, expected return Class(es), and arguments to the service. You c...
Migrating from other Content Management Systems to SharePoint <p>I am currently working on a project which requires migration of content from different content management Systems to SharePoint. Are there any good, preferably open source, tools that would help me do this? Also, what are the best practices that I would h...
<p>You can check <a href="http://www.codeplex.com/SPMigration" rel="nofollow">http://www.codeplex.com/SPMigration</a> (open source, project started by a Microsoft consultant).</p> <p>This framework gives you an importer tool, as well as some exporter example (FileSystem for example). You'll problably have to code your...
ActiveX plugin causes ASSERT to fail on application exit in VS2008 <p>My MFC application using the "ESRI MapObjects LT2" ActiveX plugin throws an ASSERT at me when closing it. The error occurs in <code>cmdtarg.cpp</code>:</p> <pre><code>CCmdTarget::~CCmdTarget() { #ifndef _AFX_NO_OLE_SUPPORT if (m_xDispatch.m_vtbl...
<p>That looks like a reference count. Could this "target" be referenced by something else, something that's not releasing it?</p>
MySQL LEFT JOIN SELECT not selecting all the left side records? <p>I'm getting odd results from a <code>MySQL SELECT</code> query involving a <code>LEFT JOIN</code>, and I can't understand whether my understanding of <code>LEFT JOIN</code> is wrong or whether I'm seeing a genuinely odd behavior.</p> <p>I have a two ta...
<p>You need to <code>GROUP BY d.dateID</code>. In two of your cases, <code>s.DateID</code> is <code>NULL</code> (<code>LEFT JOIN</code>) and these are combined together.</p> <p>I think you will also find that this is invalid (ANSI) SQL, because d.date is not part of a <code>GROUP BY</code> or the result of an aggrega...
DOS batch files: How to write to the prompt and stay in the same line to input text <p>I like to know if there is a way to read the user input inside a batch file, because i have a file named: "fif.bat" that recives two parameters (just call them <strong><em>paramA</em></strong> and <strong><em>paramB</em></strong>) so...
<p>I think this might be what you're looking for:</p> <pre><code>@ECHO OFF SET /p paramA=Parameter A: ECHO you typed %paramA% PAUSE </code></pre> <p>Line one stops commands in batch file from being echoed to the console Line two prompts the user with "Parameter A:" and waits for user to enter a value and press enter....
XML authoring/cms tool <p>I am trying to find a good open source XML authoring tool so the work flow between the client and the developers will be a bit more streamlined.</p> <p>We are basically developing a lot of XML driven micro websites for various clients and products. And often the clients want to have a little ...
<p>A combination of <a href="http://www.altova.com/products/xmlspy/xml_editor.html" rel="nofollow">Altova XMLSpy</a> (expensive, but worth it), <a href="http://www.altova.com/products/stylevision/xslt_stylesheet_designer.html" rel="nofollow">Altova Stylevision</a> (expensive, but worth it) and <a href="http://www.altov...
Best pattern for simulating "continue" in Groovy closure <p>It seems that Groovy does not support break and continue from within a closure. What is the best way to simulate this?</p> <pre><code>revs.eachLine { line -&gt; if (line ==~ /-{28}/) { // continue to next line... } } </code></pre>
<p>You can only support continue cleanly, not break. Especially with stuff like eachLine and each. The inability to support break has to do with how those methods are evaluated, there is no consideration taken for not finishing the loop that can be communicated to the method. Here's how to support continue --</p> ...
Using Ext JS in ASP.NET <p>I don’t have advanced knowledge in JavaScript, and I am trying to learn how to use Ext&nbsp;JS framework in ASP.NET (C# or VB.NET) environment. I’ve got couple of samples, but was unable get the project working. Is there such as website or book so I can go a read up about Ext&nbsp;JS in m...
<p>Mike,</p> <p>The best example site out there is <a href="http://examples.extjs.eu/" rel="nofollow">http://examples.extjs.eu/</a>. Each example has a link for viewing HTML, javascript and CSS separately.</p> <p>We are successfully integrating ExtJS with the ASP.NET MVC framework. A separate post detailing how to ...
Are there any recommendations for tools for remote collaboration on Windows? <p>The company I work for currently uses "Go To Meeting" to share our desktops but it's quite expensive for what we use it for and we are looking for cheaper (or even free) alternatives.</p> <p>We have evaluated yuuguu and yugma but they aren...
<p>I use <a href="http://www.crossloop.com" rel="nofollow">CrossLoop</a> and it works well, it is free!</p>
windows automatic software updates <p>What are some good solutions for handling automatic web based software updates for windows forms projects? I am aware of microsoft one-click, but am not interested in it at this time.</p>
<p>ClickOnce is good for cookie cutter stuff, but has some limitations around security (i.e. can't create a desktop icon, no access to COM, etc)</p> <p>Assuming you are using MSI to install your application. Use WIX (<a href="http://wix.sourceforge.net/" rel="nofollow">http://wix.sourceforge.net/</a>) to create a pat...
Integrated Security for multiple domains? <p>Is there a way to connect to a db with Integrated Security from multiple domains?</p>
<p>yes, you have to set up the active directory domains to handle a restricted trust. Then sql server can use the credentials from both domains.</p>
Dynamically look up column names for a table while in an sql query <p>I'm writing SQL (for Oracle) like:</p> <pre> INSERT INTO Schema1.tableA SELECT * FROM Schema2.tableA; </pre> <p>where Schema1.tableA and Schema2.tableA have the same columns. However, it seems like this is unsafe, since the order of the columns com...
<p>This PL/SQL should do it:</p> <pre><code>declare l_cols long; l_sql long; begin for r in (select column_name from all_tab_columns where table_name = 'TABLEA' and owner = 'SCHEMA1' ) loop l_cols := l_cols || ',' || r.column_name; end loop; ...
Any good team-chat websites? <p>Are there any good team-chat websites, preferably in Python, ideally with CherryPy or Trac?</p> <p>This is similar to <a href="http://stackoverflow.com/questions/46612/whats-a-good-freeware-collaborative-ie-multiuser-instant-messenger#46660">http://stackoverflow.com/questions/46612/what...
<p><a href="http://www.campfirenow.com/" rel="nofollow">Campfire</a> from 37 signals - the rails guys.</p> <p><strong>Edit:</strong> It doesn't meet your requirements but it has some great features...</p>
Visio database diagrams, associating columns <p>I'm trying to be a good developer and create some documentation before I start programming my next project.</p> <p>I have created a database schema diagram in Visio and created relationships between columns.</p> <p>However, I am looking for a way to make the relationshi...
<p>You can use the Visio Drawing tools to force the Relationship Connector to glue to particular Connection Points on the Table Shapes:</p> <ol> <li>Turn on Connection Points in the View menu.</li> <li>On the standard toolbar find the Connector Tool just to the right of the Pointer Tool. Click on the little arrow and ...
How can I use the Twitter Search API to return all tweets that match my search query, posted only within the last five seconds? <p>I would like to use the API to return all tweets that match my search query, but only tweets posted within the last five seconds.</p> <p>With Twitter's Search API, I can use the since_id t...
<p>This sounds like something you can do on your end, as created_at is one of the fields returned in the result set. Just do your query, and only use the ones that are within the last 5 seconds. </p>
Well explained algorithms for indexing and searching in metric spaces <p>I need to implement some kind of metric space search in Postgres(*) (PL or PL/Python). So, I'm looking for good sources (or papers) with a very clear and crisp explanation of the machinery behind these ideas, in such way that I can implement it my...
<p>Especially for geographical data, look at <a href="http://postgis.refractions.net/" rel="nofollow">PostGIS</a> first to see if you need to implement anything. If you do, start with the papers listed in the <a href="http://en.wikipedia.org/wiki/GiST" rel="nofollow">Wikipedia entry on GiST</a>.</p> <p>Looking at your...
How do I distinguish a file from a directory in Perl? <p>I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and...
<p>You can use a <strong>-d</strong> file test operator to check if something is a directory. Here's some of the commonly useful file test operators</p> <pre> -e File exists. -z File has zero size (is empty). -s File has nonzero size (returns size in bytes). -f File is a plain file. -d File is...
Start program on a second monitor? <p>Is there a way to specify which monitor a application appears on in Delphi or C++Builder? </p> <p>I am developing a simple program for a customer, which displays kitchen orders on a secondary monitor, generated by a hospitality system. Currently they need to manually drag the wi...
<p>The global Screen object (part of Forms) has the concept of Monitors. I think this was added circa Delphi 6 or 7. The following code will work:</p> <pre><code>// Put the form in the upper left corner of the 2nd monitor // if more then one monitor is present. if Screen.MonitorCount &gt; 1 then begin Left := Sc...
When does the standard 404 page appear? <p>I am building a simple HTTP server for a project. Most websites have custom 404 error pages. Sometimes though, you'll see Firefox spitting a generic 404 page (or 405, etc...). How does it decide what to do? What should the HTTP response be? Is "HTTP/1.0 404 NOT FOUND" enough?<...
<p>If server can't find the requested resource (e.g. a webpage), it sends an <strong>HTTP/1.0 404 NOT FOUND</strong> in the HTTP header section. </p> <p><strong>Servers can map</strong> an error page for this error, so you can get a readable error page. <strong>Browsers can also map</strong> an own error page, so you ...
Best way to check when a specified date occurs <p>Are there any classes in the .NET framework I can use to throw an event if time has caught up with a specified DateTime object?</p> <p>If there isn't, what are the best practices when checking this? Create a new thread constantly checking? A timer (heaven forbid ;) )?<...
<p>I wouldn't go with the thread approach. While a sleeping thread doesn't consume user CPU time, it does use Kernel/system CPU time. Secondly, in .NET you can't adjust the Thread's stack size. So even if all it does is sleep, you are stuck with a 2MB hit (I believe that is the default stack size of a new thread) fo...
Index varchar on MS SQL Server 2005 <p>I need to index a varchar field on my table in MS SQL Server 2005, but it's not clear to me how to do so. If I try to add a non-clustered index on the field, it says "Column 'xxxx' in table 'mytable' is of a type that is invalid for use as a key column in an index"</p> <p>My tab...
<p>Is your <code>varchar(max)</code>? I think those aren't allowed to be used in an index.</p> <p>Otherwise, post your <code>CREATE TABLE</code> statement, normally there is no problem adding a <code>varchar</code> to an index.</p>
TCP connection quality in .NET <p>I have a mission-critical real-time data application that uses a TCP connection between the client and server. In some cases, the connection periodically dies (SocketException). No problem - just reconnect and move on. However, the customers aren't thrilled with these intermittent drop...
<p>Firstly, you should inspect the details of the SocketExceptions you're getting. I don't know what they contain in .Net, but in Java the detailed message provides a useful hint, such as "Connection closed by peer" or "Connection reset".</p> <p>In my experience, a common cause of socket connections being dropped is a...
SetLimitText() in a CEdit in Vista does not work <p>This is happening on Vista. I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both:</p> <pre><code>this-&gt;m_cedit1.SetLimitText(100000); UpdateData(F...
<p>I contacted microsof support. </p> <p>The goal was to have approximately 240000 characters in one single editable line of text.</p> <p>I am able to reproduce the issue on Windows Vista (x64 and x32 both) but <em>not</em> on Windows XP. </p> <p>this code works fine in XP:</p> <pre><code> BOOL ClongeditXPDlg::...
How can I center content between a header and footer div? <p>In a previous question, I learned how to keep a footer div at the bottom of the page. (<a href="http://stackoverflow.com/questions/206652/how-to-create-div-to-fill-all-space-between-header-and-footer-div">see other question</a>)</p> <p>Now I'm trying to vert...
<p>In CSS2:</p> <pre><code>html,body {height:100%;} body {display:table;} div {display:table-row;} #content { display:table-cell; vertical-align:middle; } </code></pre> <p>&amp;</p> <pre><code>&lt;body&gt; &lt;div&gt;header&lt;/div&gt; &lt;div id="content"&gt;content&lt;/div&gt; &lt;div&gt;footer&lt;/div&gt;...
Best JavaScript Date Parser & Formatter? <p>Since I've started to use jQuery, I have been doing a lot more JavaScript development.</p> <p>I have the need to parse different date formats and then to display them into another format.</p> <p>Do you know of any good tool to do this?</p> <p>Which one would you recommend?...
<p>2014 update: <a href="http://momentjs.com/" rel="nofollow">Moment.js</a> is an excellent date manipulation library, which includes parsing functions. It doesn't include automatic date format detection, but you can <a href="http://momentjs.com/docs/#/parsing/string-formats/" rel="nofollow">specify multiple parsing pa...
How do I prevent and/or handle a StackOverflowException? <p>I would like to either prevent or handle a StackOverflowException that I am getting from a call to the XslCompiledTransform.Transform method within an Xsl Editor I am writing. The problem seems to be that the user can write an Xsl script that is infinitely rec...
<p>From Microsoft:</p> <blockquote> <p>Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default. Consequently, users are advised to write their code to detect and prevent a stack overflow. ...
Printing to a client printer from a web app <p>If I have a printer hooked directly to a pc (a kiosk with a printer), how would I go about creating the ability for a web page (.net web app) to print a jpg to the kiosks printer with no user intervention other than clicking a button on the page?</p>
<p>This has been asked several times already, and the result is always that you <em>can't</em> do it via normal web technologies (HTML + Javascript). The best you can do is open the print dialog, and that is <em>by design</em>. What you can do since you control the kiosks is create some kind of browser extension (lik...
Defining SLAs for WCF Services <p>I have to performance/load test a bunch of interdependant services. They all use net.tcp and most use duplex contracts and internal queueing. [handrolled POCO queue class using lock(syncRoot) { if(queue.Empty) Thread.Wait(); }]</p> <p>Here's the approach I've come up with:</p> <ol>...
<p>Wow...the title was definitely the tip of the iceberg! Hope I'm not way off base here on my responses! :) </p> <ol> <li><p>performance testing of WCF services can be done many different ways: using test tools such as Microsoft Team Test, Borland Silk Performer, Mercury LoadRunner, or something like LoadGen or a cus...
Exporting dataset to excel error: Exception from HRESULT: 0x800A03EC <p>I am having trouble in exporting to excel and it crashes out at the .set_Value function.</p> <p>It seems to work if I change object[,] to string[,] but by doing this I lose the formatting.</p> <p>Anyone Help?</p>
<p>Are you passing '<code>null</code>' for missing parameters rather than <code>System.Reflection.Missing.Value</code> ?</p>
Best Way To Store Multiple Flags In Database <p>I have a web-based application that notifies users of activity on the site via email. Users can choose which kinds of notifcations they want to receive. So far there are about 10 different options (each one is a true/false).</p> <p>I'm currently storing this in one varch...
<p>I would use two tables. One table would store the user data and the other the notifications that they subscribe to. The second table would look something like this:</p> <pre><code>create table notifications ( user_id int, notification_type int ); </code></pre> <p>I'd make a FK relationship between user_id ...
Python: Difference between class and instance attributes <p>Is there any meaningful distinction between:</p> <pre><code>class A(object): foo = 5 # some default value </code></pre> <p>vs.</p> <pre><code>class B(object): def __init__(self, foo=5): self.foo = foo </code></pre> <p>If you're creating a...
<p>Beyond performance considerations, there is a significant <em>semantic</em> difference. In the class attribute case, there is just one object referred to. In the instance-attribute-set-at-instantiation, there can be multiple objects referred to. For instance</p> <pre><code>&gt;&gt;&gt; class A: foo = [] &gt;&gt;...
Stripes: all URLs resolved through StripesDispatcher and forwarded to pre-compiled JSPs <p>Is it possible to have the StripesDispatcher be the sole determiner of webserver urls by looking at the @UrlBinding annotations on action beans AND also having those action beans forward to pre-compiled JSPs / servlets WITHOUT ne...
<p>Maybe I don't understand your question, but I'll give it a go. AFAIK the only mapping you need in a Stripes app's web.xml to use @URLBinding as the 'source of truth' for URLs in your web-app:</p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;StripesFilter&lt;/filter-name&gt; &lt;filter-class&gt;net.sourcefor...
Setting the Body's OnLoad attribute in an Asp.net MVC Master Page <p>I have a view using a master page that contains some javascript that needs to be executed using the OnLoad of the Body. What is the best way to set the OnLoad on my MasterPage only for certain views?</p> <p>On idea I tried was to pass the name of the...
<p>Now that JQuery is officially part of ASP.NET MVC, I would recommend using it. It's small, and adds tons of value to your application.</p> <p>I would recommend adding Mustafa's version of JQuery that has the Intellisense comments included:</p> <p><a href="http://www.mustafaozcan.net/en/file.axd?file=jquery-1.2.6-...
Sql Server string to date conversion <p>I want to convert a string like this:</p> <pre><code>'10/15/2008 10:06:32 PM' </code></pre> <p>into the equivalent DATETIME value in Sql Server.</p> <p>In Oracle, I would say this:</p> <pre><code>TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM') </code></pre> <p><a ...
<p>Try this</p> <pre><code>Cast('7/7/2011' as datetime) </code></pre> <p>and</p> <pre><code>Convert(varchar(30),'7/7/2011',102) </code></pre> <p>See <a href="https://msdn.microsoft.com/en-us/library/ms187928(v=sql.90).aspx">CAST and CONVERT (Transact-SQL)</a> for more details.</p>
Hooking up GUI interface with asynchronous (s)ftp operation <p>Trying to implement a progress dialog window for file uploads that look like a cross between <a href="http://www.codinghorror.com/blog/images/ie6-download-ui.png" rel="nofollow">IE download dialog</a> and <a href="http://www.codinghorror.com/blog/images/fir...
<p>"ftplib" is the standard ftp library built in to Python. In Python 2.6, it had a callback parameter added to the method used for uploading.</p> <p>That callback is a function you provide to the library; it is called once for every block that is completed.</p> <p>Your function can send a message to the GUI (perhaps...
firefox 3 favicons - how to make them? <p>i noticed that paypal displays a very different favicon, one that's not just a simple 16x16 icon and is lengthy? anyone can teach me?</p>
<p>I think you are refering to the green box that shows the PayPal logo followed by "PayPal, Inc. (US)". </p> <p>If so, it is not a favicon, but a feature of Firefox 3 to show sites with extended validation (EV). See also <a href="http://news.cnet.com/8301-13554_3-9974672-33.html" rel="nofollow">http://news.cnet.com/8...
extracting a parenthesized Python expression from a string <p>I've been wondering about how hard it would be to write some Python code to search a string for the index of a substring of the form <code>${</code><em>expr</em><code>}</code>, for example, where <em>expr</em> is meant to be a Python expression or something ...
<p>I think what you're asking about is being able to insert Python code into text files to be evaluated. There are several modules that already exist to provide this kind of functionality. You can check the Python.org <a href="http://wiki.python.org/moin/Templating" rel="nofollow"><strong>Templating wiki page</strong><...
How do ASP.NET applications work when deployed without the code-behind files? <p>When you deploy an application to IIS without all files that contains code (VB/C#) then how exactly are events &amp; all things handled?</p>
<p>The VB or C# compiler compiles the ASPX pages and classes in App_Code into runtime binary DLLs. For Web projects, the DLLs get created each time you build the project; for Websites, the DLLs get created in a temp folder under c:\Windows. Maybe this is what's confusing you--you don't see the DLLs for Websites until y...
Updated Firefox Extension - Still says "No updates were found." <p>I am working on a new version of a firefox extension, but after releasing it, and incrementing the em:version in install.rdf and update.rdf, when I click "Find updates" Firefox reports that "No updates were found." When I run it with debugging on, the ...
<p>Make sure your update.rdf file is being served with an appropriate Content-Type, i.e. text/rdf, text/xml or application/xml+rdf </p>
What is the key sequence for closing the current buffer in Emacs? <p>If I click on File -> Close, it closes the buffer like I want, but doesn't list a key mapping. What is the key mapping?</p>
<p>You can use <code>C-x k</code> to kill current buffer. See <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Kill-Buffer.html">Emacs Manual</a> .</p>
Logging Library for .NET Compact Framework? <p>Any good logging libraries that support .NET compact framework?</p>
<p>log4net is a good choice, I use it for all projects.</p>
Best mobile application development tool/environment? <p>I would like to develop a mobile application that is able to access all the features of the mobile device it runs on (camera, files, phone and network connectivity). I intend to build a series of applications that each have a specific function to perform, rather ...
<p>J2ME is the way to go to reach the masses, in the consumer or the business market. From a consumer standpoint, most of the world's mobile phones support J2ME. From a business standpoint, most of the world's smart phones support J2ME. </p> <p>Nokia owns a 40% share of the smart phone market (and the whole market) wo...
Computing a cross-browser iframe height <p>One of the most difficult problems in my javascript experience has been the correct (that is "cross-browser") computing of a <strong>iframe height</strong>. In my applications I have a lot of dynamically generated iframe and I want them all do a sort of autoresize at the end o...
<p>Although I like your solution, I've always found IFRAMEs to be more trouble than they're worth.</p> <p>Why ? 1. The sizing issue. 2. the iframe has that src attribute to worry about. i.e. absolute path. 3. the extra complexity with the pages.</p> <p>My solution - DIVs which are dynamically loaded through AJAX ca...
Templated superclass linking problem <p>I'm trying to create a C++ class, with a templated superclass. The idea being, I can easily create lots of similar subclasses from a number of superclasses which have similar characteristics.</p> <p>I have distilled the problematic code as follows:</p> <p><code>template_test.h<...
<p>With templated classes, the definitions must be available for each translation unit that uses it. The definitions can go in a separate file, usually with <code>.inl</code> or <code>.tcc</code> extension; the header file <code>#include</code>s that file at the bottom. Thus, even though it's in a separate file, it's s...
What causes this integer pointer reassignment to crash? <p>I am new to C and i have this question. why does the following code crash:</p> <pre><code>int *a = 10; *a = 100; </code></pre>
<p>Because you are trying to write 100 to the memory location 0x0000000A which is probably not allocated to your program. That is,</p> <pre><code>int *a = 10; </code></pre> <p>does not mean that the pointer 'a' will point to a location in memory having the value of 10. It means it is pointing to address 10 (0x0000000...
Redirect to a link using the default broswser in Windows Form based application <p>I am not use: Process.Start (String, String) to open a link. But every time the browser open a new tab or new window to open the link. Is there a way that to open the link in the latest opened page? Just redirection, no new tab or new wi...
<p>This is not really up to you (the programmer) to decide but to the user: Some browsers have an option for this setting. You shouldn't try modifying the user's selected browser behaviour.</p> <p>Someone of my team did this once in an instant messenger application that we were writing, without asking for other opinio...
How can I use RLIKE MySQL function inside of SQL Server 2005? <p>I need to run a RLIKE query on a database mmoved from MySQL to SQL Server 2005 however having problems replicating the "RLIKE" functionality that MySQL provides.</p> <p>Does anyone have any ideas?</p> <p>Cheers,</p> <p>Chris</p>
<p>The only way I know of to do that is to add user defined CLR functions.</p> <p>To begin with, here's an MSDN Magazine article, "<a href="http://msdn.microsoft.com/en-us/magazine/cc163473.aspx" rel="nofollow">Regular Expressions Make Pattern Matching And Data Extraction Easier</a>"</p> <p>The code for that article,...
How do I get Srcsrv with SVNindex.cmd to index extern files? <p>I have recently made use of the SrcSrv feature in the <a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" rel="nofollow">Debugging Tools For Windows</a>, but have noticed that when I index the pdb with <strong>SVNIndex.cmd</strong> it d...
<p>Finally i got some time again to figure everything out:</p> <p>To also get the files included with svn:externals property indexed, you just have to add the directories of them to /source= switch! easier than i thought! so if you have an external in "Ext1" dir under your Projectdir, just call ssindex.cmd with /sourc...
How to read and write multiple files? <p>I want to write a program for this: In a folder I have <em>n</em> number of files; first read one file and perform some operation then store result in a separate file. Then read 2nd file, perform operation again and save result in new 2nd file. Do the same procedure for <em>n</e...
<pre><code>import sys # argv is your commandline arguments, argv[0] is your program name, so skip it for n in sys.argv[1:]: print(n) #print out the filename we are currently processing input = open(n, "r") output = open(n + ".out", "w") # do some processing input.close() output.close() </code><...
Forcibly rollback an installer in c# setup projects <p>I have created a custom action dll.I just want to check if a product with same name exists(Done).If yes tell the user to uninstall the product by throwing a InstallException.However if the products are installed in same directory the Install state of the prev produ...
<p>It sounds like you really want to use the Upgrade logic provided by the Windows Installer to find the other products and set a Property. The Property can then control a LaunchCondition (or a Type19 CustomAction). That way you don't need any CustomActions.</p>
How are most AS3 Video Players Created? <p>Are most flash video players created all programmatically? Or they done using static buttons that are referenced in classes? Is it better to create all your buttons on the fly or does it not really matter?</p>
<p>I've found the easiest way was to use AS3 video components and customize them as needed. For example, the play head does all the scrubbing for you automatically, but you can control placement and design.</p> <p>Here's a great tutorial: <a href="http://www.adobe.com/devnet/flash/articles/skinning_as3_flvcomp_03.htm...
How to summarize view-components/widgets-information in a JAR-File? <p>I would like to use an ajax toolkit/framework like ZK (www.zkoss.org) or GWT. But I don't know whether it's possible to bundle resources in a JAR? Do you know which one support such resource loading?</p>
<p>Not sure what your goal is, but if its to bundle a web application into one file, then you can do that with a WAR file - assuming your deploying onto a java webcontainer like tomcat or jboss.</p>
When should the Win32 InterlockedExchange function be used? <p>I came across the function <a href="http://msdn.microsoft.com/en-us/library/ms683590(VS.85).aspx">InterlockedExchange</a> and was wondering when I should use this function. In my opinion, setting a 32 Bit value on an x86 processor should always be atomic? <...
<p>As well as writing the new value, <code>InterlockedExchange</code> also reads and returns the previous value; this whole operation is atomic. This is useful for <a href="http://en.wikipedia.org/wiki/Lock-free_and_wait-free_algorithms">lock-free algorithms</a>.</p> <p>(Incidentally, 32-bit writes are not guaranteed ...
Why does MSI require the original .msi file to proceed with an uninstall? <p>As most of you probably noticed, when uninstalling an MSI package Windows will ask for the original <code>.msi</code> file. Why is that?</p> <p>I can only see disadvantages to that:</p> <ul> <li>not resilient to network changes.</li> <li>not...
<hr> <p><strong>UPDATE</strong>:</p> <p><del><a href="http://support2.microsoft.com/default.aspx?scid=kb;en-us;290301" rel="nofollow"><strong>This new support tool</strong></a></del> (this tool is now also deprecated) can be tried on recent Windows versions if you have <strong>defunct MSI packages needing uninstall</...
How do I get the instance value of a property marked with a Attribute? <p>I have a class which is marked with a custom attribute, like this:</p> <pre><code>public class OrderLine : Entity { ... [Parent] public Order Order { get; set; } public Address ShippingAddress{ get; set; } ... } </code></pre>...
<p>Use Type.GetProperties() and PropertyInfo.GetValue()</p> <pre><code> T GetPropertyValue&lt;T&gt;(object o) { T value = default(T); foreach (System.Reflection.PropertyInfo prop in o.GetType().GetProperties()) { object[] attrs = prop.GetCustomAttributes(typeof(ParentAttribu...
Naming of ID columns in database tables <p>I was wondering peoples opinions on the naming of ID columns in database tables.</p> <p>If I have a table called Invoices with a primary key of an identity column I would call that column InvoiceID so that I would not conflict with other tables and it's obvious what it is.</p...
<p>I always prefered ID to TableName + ID for the id column and then TableName + ID for a foreign key. That way all tables have a the same name for the id field and there isn't a redundant description. This seems simpler to me because all the tables have the same primary key field name. </p> <p>As far as joining ta...
What is the reasoning for and the basic concepts behind an interstitial loading page? <p>I'm interested in finding out why this is used on some Web sites for processing user-initiated search submissions, how it affects the request and response flow, and programmatically why it would be necessary (or beneficial). In an ...
<p>It is often used in long running requests to prevent the web server from timing out the request. With an interstitial page, you are able to continuously refresh the page until you get results back.</p> <p>EDIT:</p> <p>Also, for long running requests, it is beneficial to have a "Loading.." page in order to show th...
Export all contacts as vcards from Outlook <p>So, I want to export all my contacts from Outlook as vcards. If I google that, I get a bunch of shareware programs, but I want something free that just works. </p> <p>If I'm to code it myself, I guess I should use the Microsoft.Office.Interop.Outlook assembly. Has anyone a...
<p>I solved it in a non-programmatically way:</p> <ul> <li>Selected all contacts in Outlook</li> <li>Forwarded them as cards to myself</li> <li>Saved all the attachments (vcards) in a folder, <code>c:\temp</code></li> <li>Opened a command prompt and typed the command <code>copy /a *.vcf c:\allcards.vcf</code> which co...
Aggregate Login Control [ASP.NET] <p>Is there a control out in the world that allows a user to log in to a website with MS Passport (Windows Live ID, whatever), Facebook, OpenID, etc. all in one control?</p> <p>Thanks, everyone!</p>
<p>I am not aware of any control that allows all of them, but the API's are pretty simple that would allow you to implement it yourself.</p>
MFC: Showing / Hiding Splitter Panes <p>In my application I have a number of panes from m_wndspliter classes. What I want to do is at run time show and hide one of these panes. Whilst with the following code I can show and hide the view associated with the pane, I can't temporarily remove the pane itself. </p> <pre><c...
<p>You need to call CSplitterWnd::DeleteView to do this, which basically means that you have to save your CView elsewhere if you intend to restore it. Usually this is not a problem as all data should be stored in the CDocument rather than CView, but in practice this may not be the case.</p> <p>The way I have handled ...
.net system tray application to launch when a USB device is plugged in <p>How do I get my .net system tray application to popup when a USB device is plugged in?</p>
<p>You might look <a href="http://www.codeproject.com/KB/system/DriveDetector.aspx" rel="nofollow">here</a> for an example app that does something like what you want.</p>
Nullable type as a generic parameter possible? <p>I want to do something like this :</p> <pre><code>myYear = record.GetValueOrNull&lt;int?&gt;("myYear"), </code></pre> <p>Notice the nullable type as the generic parameter. </p> <p>Since the <code>GetValueOrNull</code> function could return null my first attempt was t...
<p>Change the return type to Nullable, and call the method with the non nullable parameter</p> <pre><code>static void Main(string[] args) { int? i = GetValueOrNull&lt;int&gt;(null, string.Empty); } public static Nullable&lt;T&gt; GetValueOrNull&lt;T&gt;(DbDataRecord reader, string columnName) where T : struct { ...
How much does it cost to develop an iPhone application? <p>How much can a developer charge for an iPhone app like <a href="http://en.wikipedia.org/wiki/Twitterrific">Twitterrific</a>?</p> <p>I want to know this because I need such an application with the same functionality for a new community website. I can do Ruby bu...
<p>I'm one of the developers for Twitterrific and to be honest, I can't tell you how many hours have gone into the product. I can tell you everyone who upvoted the estimate of 160 hours for development and 40 hours for design is fricken' high. (I'd use another phrase, but this is my first post on Stack Overflow, so I'm...
Javascript registering event to object <p>I have an activex object I loaded into an html page. I then use that activex object to create another object, but I need to register an event with the new object created. The object is expecting an event listener of a certain type.</p> <p>I can load this same dll in c# and i...
<p>Your javascript should look something like this:</p> <pre><code>function uploadAction::stateChanged( parms ) { // ... // implementation // ... } </code></pre> <p>Note, that this is a static function declaration, assuming that you have an Active X object named 'uploadAction'. I know that this does work...
Can I use Python as a Bash replacement? <p>I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.</p> <p>I've seen mentioned a few places that python is good for this kind of thing, I know a little and I would like to know more. Is Python a good choice for th...
<p>Any shell has several sets of features.</p> <ul> <li><p>The Essential Linux/Unix commands. All of these are available through the <a href="https://docs.python.org/3/library/subprocess.html">subprocess</a> library. This isn't always the best first choice for doing <em>all</em> external commands. Look also at <a h...
Powershell - Increase the timeout for retrieving XML from a URL <p>I'm trying to retrieve an XML stream from a URL. For most URLs my code below works fine. But, I have a couple URLs that timeout. The URLs in question <b>do</b> work from Internet Explorer.</p> <pre><code>$webclient=New-Object "System.Net.WebClient" [xm...
<p>By default the <strong>WebRequest.AuthenticationLevel</strong> is set to <strong>MutualAuthRequested</strong>, therefore it will wait for some type of authentication response. Therefore, a timeout is probably being exceeded while waiting for the authentication to occur. It didn't look like you were messing with the ...
Payroll System Design, Business Logic in SPs or Application Layer (C#.Net), Maintainability - Repost <p>We are designing a Payroll Generation System for a client.</p> <p>The organization we are targeting has a hierarchy as follows: Company -> Cluster -> Business Unit (BU) -> Department -> Employee</p> <p>The salary f...
<p>I always try to shy away from putting business logic in the DB layer. It is more difficult to write, debug and maintain. In addition, the DB is generally the most expensive layer to scale. If you end up needing to beef up your system to support more users it is relatively cheap and easy to add new webservers to a...
Good freeware clone of the VMS editor EDT for unix or the pc? <p>I would like to have the same editor available on all of the platforms I frequent.</p> <p>Emacs and Vi are not desired solutions.</p>
<p>There is <a href="http://www.asoft-dev.com/" rel="nofollow">nu/TPU</a> which is more like EVE/TPU, and also <a href="http://www.jedsoft.org/jed/" rel="nofollow">JED</a>, I've never found anything better than either of these. </p> <p>I used to be the world's biggest fan of VMS and EVE/EDT/TPU - you're probably going...
Algorithm to order 'tag line' campaigns based on resulting sales <p>I want to be able to introduce new 'tag lines' into a database that are shown 'randomly' to users. (These tag lines are shown as an introduction as animated text.)</p> <p>Based upon the number of sales that result from those taglines I'd like the good...
<p>Looking at your problem, I would modify the requirements a bit -</p> <p>1) The most popular one should be shown most often. 2) Taglines should "age", so one that got a lot of votes (purchase) in the past, but none recently should be shown less often 3) Brand new taglines should be shown more often during their firs...
Map two lists into a dictionary in Python <p>Imagine that you have:</p> <pre><code>keys = ('name', 'age', 'food') values = ('Monty', 42, 'spam') </code></pre> <p>What is the simplest way to produce the following dictionary ?</p> <pre><code>dict = {'name' : 'Monty', 'age' : 42, 'food' : 'spam'} </code></pre> <p>This...
<p>Like this:</p> <pre><code>&gt;&gt;&gt; keys = ['a', 'b', 'c'] &gt;&gt;&gt; values = [1, 2, 3] &gt;&gt;&gt; dictionary = dict(zip(keys, values)) &gt;&gt;&gt; print dictionary {'a': 1, 'b': 2, 'c': 3} </code></pre> <p>Voila :-) The pairwise dict constructor and zip function are awesomely useful: <a href="https://do...
Pulling data out of quotes? <p>I'm looking for a regex that can pull out quoted sections in a string, both single and double quotes.</p> <p>IE:</p> <pre><code>"This is 'an example', \"of an input string\"" </code></pre> <p>Matches:</p> <ul> <li>an example</li> <li>of an input string</li> </ul> <p>I wrote up this:<...
<p>How does it handle single quotes inside of double quotes (or vice versa)?</p> <pre><code>"This is 'an example', \"of 'quotes within quotes'\"" </code></pre> <p>should match</p> <ul> <li>an example <li>of 'quotes within quotes' </ul> <p>Use a backreference if you need to support this.</p> <pre><code>(\"|')[A-Za-...
Giving a custom UserControl an ID in rendered HTML <p>When I use a ASP:Calendar control, and give it an ID:</p> <p><code>&lt;asp:Calendar runat="server" ID="MyCal" /&gt;</code></p> <p>It looks like this in the rendered html:</p> <p><code>&lt;table id="NameMangled_MyCal"... /&gt;</code></p> <p>And I can access the e...
<p>UserControls only render their contents, nothing else. What you could do is </p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="WeeklyEventsCalendar.ascx.cs" Inherits="WeeklyEventsCalendar" %&gt; &lt;div id="&lt;%= this.ControlID %&gt;"&gt; &lt;asp:Calendar runat="server" ID="Inne...
How can I give each <li> its own bullet image? <p>I have tried</p> <pre><code>&lt;ul id="contact_list"&gt; &lt;li id="phone"&gt;Local 604-555-5555&lt;/li&gt; &lt;li id="i18l_phone"&gt;Toll-Free 1-800-555-5555&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>with</p> <pre><code>#contact_list { list-style: disc non...
<p>Try this:</p> <pre><code>#contact_list li { list-style: none; } #contact_list li#phone { list-style-image: url('images/small_wood_phone.png'); } #contact_list li#i18l_phone { list-style-image: url('images/i18l_wood_phone.png'); } </code></pre>
Suspending and notifying threads when there is work to do <p>I have multiple threads (C# application running on IIS) running that all need to communicate with the same MQ backend. To minimize network traffic, I need to only send a backend request when there is work to be done. There will be one thread to monitor if t...
<p>Check out <a href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.aspx" rel="nofollow">WaitHandle</a> and its descending classes. <a href="http://msdn.microsoft.com/en-us/library/system.threading.eventwaithandle.aspx" rel="nofollow">EventWaitHandle</a> may suit your needs.</p>
Regex greedy issue <p>I'm sure this one is easy but I've tried a ton of variations and still cant match what I need. The thing is being too greedy and I cant get it to stop being greedy.</p> <p>Given the text:</p> <pre><code>test=this=that=more text follows </code></pre> <p>I want to just select:</p> <pre><code>te...
<p>here:</p> <pre><code>// matches "test=, test" (\S+?)= or // matches "test=, test" too (\S[^=]+)= </code></pre> <p>you should consider using the second version over the first. given your string <code>"test=this=that=more text follows"</code>, version 1 will match <code>test=this=that=</code> then continue parsing...
Remove a symlink to a directory <p>I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it. </p> <p>I tried <code>rm</code> and get back <code>rm: cannot remove 'foo'</code>.<br> I tried <code>rmdir</code> and got back <code>rmdir: failed to remove 'foo': D...
<pre><code># this works rm foo # versus rm foo/ </code></pre> <p>Basically, you need to tell it to delete a file, not delete a directory. I believe the difference between <code>rm</code> and <code>rmdir</code> exists because of differences in the way the C library treats each.</p> <p>At any rate, the first should wor...